From 7cec4fc39f8f94b5ba611678202f60e73d5ddecd Mon Sep 17 00:00:00 2001 From: cvs2svn Date: Mon, 2 May 2011 11:27:50 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'branch_3_0'. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Sprout from master 2011-05-02 11:27:49 UTC František Dvořák 'Fix locations in automatic purge (SB #81646).' Delete: org.glite.deployment.jpis/build.xml org.glite.deployment.jpis/config/scripts/glite-jpis-config.py org.glite.deployment.jpis/config/templates/glite-jpis.cfg.xml org.glite.deployment.jpis/project/build.number org.glite.deployment.jpis/project/build.properties org.glite.deployment.jpis/project/glite-jp.sdf.xml.template org.glite.deployment.jpis/project/glite-jpis.sdf.xml.template org.glite.deployment.jpis/project/lxscript-rpm.xsl org.glite.deployment.jpis/project/lxscript-tgz.xsl org.glite.deployment.jpis/project/properties.xml org.glite.deployment.jpis/project/quattor-template.xsl org.glite.deployment.jpis/project/version.properties org.glite.deployment.jpps/build.xml org.glite.deployment.jpps/config/scripts/glite-jpps-config.py org.glite.deployment.jpps/config/templates/glite-jpps.cfg.xml org.glite.deployment.jpps/project/build.number org.glite.deployment.jpps/project/build.properties org.glite.deployment.jpps/project/glite-jpps.sdf.xml.template org.glite.deployment.jpps/project/lxscript-rpm.xsl org.glite.deployment.jpps/project/lxscript-tgz.xsl org.glite.deployment.jpps/project/properties.xml org.glite.deployment.jpps/project/quattor-template.xsl org.glite.deployment.jpps/project/version.properties org.glite.deployment.lb/.cvsignore org.glite.deployment.lb/CHANGELOG org.glite.deployment.lb/LICENSE org.glite.deployment.lb/build.xml org.glite.deployment.lb/config/scripts/glite-lb-config.py org.glite.deployment.lb/config/templates/glite-lb.cfg.xml org.glite.deployment.lb/doc/release_notes/release_notes.doc org.glite.deployment.lb/doc/release_notes/release_notes.html org.glite.deployment.lb/doc/release_notes/release_notes.pdf org.glite.deployment.lb/project/.cvsignore org.glite.deployment.lb/project/build.number org.glite.deployment.lb/project/build.properties org.glite.deployment.lb/project/glite-lb.sdf.xml.template org.glite.deployment.lb/project/lxscript-rpm.xsl org.glite.deployment.lb/project/lxscript-tgz.xsl org.glite.deployment.lb/project/properties.xml org.glite.deployment.lb/project/quattor-template.xsl org.glite.deployment.lb/project/version.properties org.glite.jp.client/.cvsignore org.glite.jp.client/Makefile org.glite.jp.client/build.xml org.glite.jp.client/config/startup org.glite.jp.client/configure org.glite.jp.client/doc/README.jpimporter org.glite.jp.client/examples/glite-jp-importer.sh org.glite.jp.client/examples/jpps_upload_files.c org.glite.jp.client/examples/mill_feed.c org.glite.jp.client/interface/jp_client.h org.glite.jp.client/interface/jpcl_ctx_int.h org.glite.jp.client/interface/jpimporter.h org.glite.jp.client/project/ChangeLog org.glite.jp.client/project/build.number org.glite.jp.client/project/build.properties org.glite.jp.client/project/configure.properties.xml org.glite.jp.client/project/properties.xml org.glite.jp.client/project/tar_exclude org.glite.jp.client/project/version.properties org.glite.jp.client/src/jpcl_ctx.c org.glite.jp.client/src/jpimp_lib.c org.glite.jp.client/src/jpimporter.c org.glite.jp.client/src/jptype_map.h org.glite.jp.client/src/typemap.dat org.glite.jp.common/.cvsignore org.glite.jp.common/Makefile org.glite.jp.common/build.xml org.glite.jp.common/interface/attr.h org.glite.jp.common/interface/backend.h org.glite.jp.common/interface/builtin_plugins.h org.glite.jp.common/interface/context.h org.glite.jp.common/interface/file_plugin.h org.glite.jp.common/interface/indexdb.h org.glite.jp.common/interface/known_attr.h org.glite.jp.common/interface/type_plugin.h org.glite.jp.common/interface/types.h org.glite.jp.common/project/build.number org.glite.jp.common/project/build.properties org.glite.jp.common/project/configure.properties.xml org.glite.jp.common/project/properties.xml org.glite.jp.common/project/tar_exclude org.glite.jp.common/project/version.properties org.glite.jp.common/src/attr.c org.glite.jp.common/src/context.c org.glite.jp.common/src/indexdb.c org.glite.jp.common/src/utils.c org.glite.jp.common/test/type_test.cpp org.glite.jp.doc/LICENSE org.glite.jp.doc/Makefile org.glite.jp.doc/configure org.glite.jp.doc/project/ChangeLog org.glite.jp.doc/project/version.properties org.glite.jp.doc/src/JPAG-Configuration.tex org.glite.jp.doc/src/JPAG-Installation.tex org.glite.jp.doc/src/JPAG-Introduction.tex org.glite.jp.doc/src/JPAG-Running.tex org.glite.jp.doc/src/JPAG-Testing.tex org.glite.jp.doc/src/JPAG-Troubleshooting.tex org.glite.jp.doc/src/JPAG.tex org.glite.jp.doc/src/JPDG-Introduction.tex org.glite.jp.doc/src/JPDG-WS.tex org.glite.jp.doc/src/JPDG.tex org.glite.jp.doc/src/JPUG-Introduction.tex org.glite.jp.doc/src/JPUG-Tools.tex org.glite.jp.doc/src/JPUG-UseCases.tex org.glite.jp.doc/src/JPUG.tex org.glite.jp.doc/src/LB-JP-interaction.tex org.glite.jp.doc/src/README org.glite.jp.doc/src/copyright.tex org.glite.jp.doc/src/definitions.tex org.glite.jp.doc/src/egee.cls org.glite.jp.doc/src/frontmatter.tex org.glite.jp.doc/src/glite-jpis-client.tex org.glite.jp.doc/src/glite_installation_guide_JP.doc org.glite.jp.doc/src/glite_installation_guide_LB.doc org.glite.jp.doc/src/gui.tex org.glite.jp.doc/src/images/JP-interactions.cdr org.glite.jp.doc/src/images/JP-interactions.pdf org.glite.jp.doc/src/images/JP-query.cdr org.glite.jp.doc/src/images/JP-query.pdf org.glite.jp.doc/src/images/LB-JP-interaction-details.cdr org.glite.jp.doc/src/images/LB-JP-interaction-details.pdf org.glite.jp.doc/src/images/LB-JP-interaction-drawing.pdf org.glite.jp.doc/src/images/egee.pdf org.glite.jp.doc/src/images/isi.pdf org.glite.jp.doc/src/jpimporter.tex org.glite.jp.doc/src/jpws.tex org.glite.jp.doc/src/lbjp.bib org.glite.jp.index/.cvsignore org.glite.jp.index/Makefile org.glite.jp.index/build.xml org.glite.jp.index/config/dbsetup.sh org.glite.jp.index/config/defaults/glite-jpis.pre org.glite.jp.index/config/functions/config_glite_jpis org.glite.jp.index/config/glite-jp-index-dbsetup.sql org.glite.jp.index/config/glite-jpis-config.xml org.glite.jp.index/config/glite-jpis-test-config.xml org.glite.jp.index/config/node-info.d/glite-jpis org.glite.jp.index/config/site-info.def.example org.glite.jp.index/config/startup org.glite.jp.index/configure org.glite.jp.index/doc/README org.glite.jp.index/doc/client_conf.xsd org.glite.jp.index/doc/glite-jp-indexd.sgml org.glite.jp.index/doc/glite-jpis-client.sgml org.glite.jp.index/doc/server_conf.xsd org.glite.jp.index/examples/jpis-client.c org.glite.jp.index/examples/jpis-db-internal.c org.glite.jp.index/examples/jpis-test.c org.glite.jp.index/examples/pch06/pch.pm org.glite.jp.index/examples/pch06/query1.pl org.glite.jp.index/examples/pch06/query2.pl org.glite.jp.index/examples/pch06/query3.pl org.glite.jp.index/examples/pch06/query4.pl org.glite.jp.index/examples/pch06/query5.pl org.glite.jp.index/examples/pch06/query6.pl org.glite.jp.index/examples/query-tests/authz.out org.glite.jp.index/examples/query-tests/complex_query.in org.glite.jp.index/examples/query-tests/complex_query.out org.glite.jp.index/examples/query-tests/dump1.sql org.glite.jp.index/examples/query-tests/exists_query.in org.glite.jp.index/examples/query-tests/exists_query.out org.glite.jp.index/examples/query-tests/jobid_query.in org.glite.jp.index/examples/query-tests/jobid_query.out org.glite.jp.index/examples/query-tests/origin_query.in org.glite.jp.index/examples/query-tests/origin_query.out org.glite.jp.index/examples/query-tests/run-test.sh org.glite.jp.index/examples/query-tests/simple_query.in org.glite.jp.index/examples/query-tests/simple_query.out org.glite.jp.index/examples/query-tests/within_query.in org.glite.jp.index/examples/query-tests/within_query.out org.glite.jp.index/interface/JobProvenanceISClient.xsd org.glite.jp.index/project/ChangeLog org.glite.jp.index/project/build.number org.glite.jp.index/project/build.properties org.glite.jp.index/project/configure.properties.xml org.glite.jp.index/project/properties.xml org.glite.jp.index/project/tar_exclude org.glite.jp.index/project/version.properties org.glite.jp.index/src/bones_server.c org.glite.jp.index/src/common.c org.glite.jp.index/src/common.h org.glite.jp.index/src/conf.c org.glite.jp.index/src/conf.h org.glite.jp.index/src/context.c org.glite.jp.index/src/context.h org.glite.jp.index/src/db_ops.c org.glite.jp.index/src/db_ops.h org.glite.jp.index/src/simple_server.c org.glite.jp.index/src/soap_ops.c org.glite.jp.index/src/soap_ps_calls.c org.glite.jp.index/src/soap_ps_calls.h org.glite.jp.index/src/type_plugin.c org.glite.jp.index/src/typemap.dat org.glite.jp.index/src/ws_is_typeref.c org.glite.jp.index/src/ws_is_typeref.h org.glite.jp.index/src/ws_ps_typeref.c org.glite.jp.index/src/ws_ps_typeref.h org.glite.jp.index/src/ws_typemap.h org.glite.jp.primary/.cvsignore org.glite.jp.primary/Makefile org.glite.jp.primary/build.xml org.glite.jp.primary/config/defaults/glite-jpps.pre org.glite.jp.primary/config/functions/config_glite_jpps org.glite.jp.primary/config/glite-jp-primary-dbsetup.sh org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql org.glite.jp.primary/config/gsi_authz.conf.example org.glite.jp.primary/config/node-info.d/glite-jpps org.glite.jp.primary/config/site-info.def.example org.glite.jp.primary/config/startup org.glite.jp.primary/configure org.glite.jp.primary/doc/README.install org.glite.jp.primary/examples/README.test org.glite.jp.primary/examples/dag-deps.c org.glite.jp.primary/examples/getjobattr.pl org.glite.jp.primary/examples/job_template org.glite.jp.primary/examples/jpps-test.c org.glite.jp.primary/examples/jpps_store_test org.glite.jp.primary/examples/recordmultitags.pl org.glite.jp.primary/examples/sample_job_aborted org.glite.jp.primary/examples/sample_job_cleared org.glite.jp.primary/examples/sample_job_tagged_done org.glite.jp.primary/examples/sample_job_waiting org.glite.jp.primary/project/ChangeLog org.glite.jp.primary/project/build.number org.glite.jp.primary/project/build.properties org.glite.jp.primary/project/configure.properties.xml org.glite.jp.primary/project/properties.xml org.glite.jp.primary/project/tar_exclude org.glite.jp.primary/project/version.properties org.glite.jp.primary/src/attrs.c org.glite.jp.primary/src/attrs.h org.glite.jp.primary/src/authz.c org.glite.jp.primary/src/authz.h org.glite.jp.primary/src/backend.h org.glite.jp.primary/src/backend_private.h org.glite.jp.primary/src/bones_server.c org.glite.jp.primary/src/classad_plugin.c org.glite.jp.primary/src/feed.c org.glite.jp.primary/src/feed.h org.glite.jp.primary/src/file_plugin.c org.glite.jp.primary/src/ftpd_auth.c org.glite.jp.primary/src/is_client.c org.glite.jp.primary/src/is_client.h org.glite.jp.primary/src/jp_callouts.c org.glite.jp.primary/src/jp_callouts.h org.glite.jp.primary/src/jptype_map.h org.glite.jp.primary/src/mk_soap_switch.pl org.glite.jp.primary/src/new_ftp_backend.c org.glite.jp.primary/src/sandbox_plugin.c org.glite.jp.primary/src/simple_server.c org.glite.jp.primary/src/soap_ops.c org.glite.jp.primary/src/soap_util.c org.glite.jp.primary/src/tags.c org.glite.jp.primary/src/tags.h org.glite.jp.primary/src/typemap.dat org.glite.jp.server-common/Makefile org.glite.jp.server-common/build.xml org.glite.jp.server-common/configure org.glite.jp.server-common/examples/db-test-int.c org.glite.jp.server-common/interface/db.h org.glite.jp.server-common/project/ChangeLog org.glite.jp.server-common/project/build.number org.glite.jp.server-common/project/configure.properties.xml org.glite.jp.server-common/project/properties.xml org.glite.jp.server-common/project/tar_exclude org.glite.jp.server-common/project/version.properties org.glite.jp.server-common/src/db.c org.glite.jp.ws-interface/.cvsignore org.glite.jp.ws-interface/LICENSE org.glite.jp.ws-interface/Makefile org.glite.jp.ws-interface/build.xml org.glite.jp.ws-interface/configure org.glite.jp.ws-interface/project/ChangeLog org.glite.jp.ws-interface/project/build.number org.glite.jp.ws-interface/project/build.properties org.glite.jp.ws-interface/project/configure.properties.xml org.glite.jp.ws-interface/project/properties.xml org.glite.jp.ws-interface/project/tar_exclude org.glite.jp.ws-interface/project/version.properties org.glite.jp.ws-interface/src/JobProvenanceIS.xml org.glite.jp.ws-interface/src/JobProvenancePS.xml org.glite.jp.ws-interface/src/JobProvenanceTypes.xml org.glite.jp.ws-interface/src/doc.xml org.glite.jp.ws-interface/src/jpdev.sh org.glite.jp.ws-interface/src/jpdev.xml.sh org.glite.jp.ws-interface/src/puke-schema.xsl org.glite.jp.ws-interface/src/puke-ug.xsl org.glite.jp.ws-interface/src/puke-wsdl.xsl org.glite.jp.ws-interface/src/ws_fault.c org.glite.jp/.cvsignore org.glite.jp/build.xml org.glite.jp/configure org.glite.jp/doc/README org.glite.jp/project/build.number org.glite.jp/project/build.properties org.glite.jp/project/dependencies.properties org.glite.jp/project/glite.jp.csf.xml org.glite.jp/project/properties.xml org.glite.jp/project/run-workspace org.glite.jp/project/taskdefs.xml org.glite.jp/project/version.properties org.glite.lb-utils.context/.cvsignore org.glite.lb-utils.context/LICENSE org.glite.lb-utils.context/build.xml org.glite.lb-utils.context/project/build.number org.glite.lb-utils.context/project/build.properties org.glite.lb-utils.context/project/configure.properties.xml org.glite.lb-utils.context/project/properties.xml org.glite.lb-utils.context/project/version.properties org.glite.lb-utils.db/.cvsignore org.glite.lb-utils.db/LICENSE org.glite.lb-utils.db/Makefile org.glite.lb-utils.db/build.xml org.glite.lb-utils.db/examples/db_expire.c org.glite.lb-utils.db/examples/db_test.c org.glite.lb-utils.db/interface/db.h org.glite.lb-utils.db/project/build.number org.glite.lb-utils.db/project/build.properties org.glite.lb-utils.db/project/configure.properties.xml org.glite.lb-utils.db/project/properties.xml org.glite.lb-utils.db/project/tar_exclude org.glite.lb-utils.db/project/version.properties org.glite.lb-utils.db/src/db.c org.glite.lb-utils.jobid/.cvsignore org.glite.lb-utils.jobid/LICENSE org.glite.lb-utils.jobid/Makefile org.glite.lb-utils.jobid/build.xml org.glite.lb-utils.jobid/interface/Exception.h org.glite.lb-utils.jobid/interface/JobId.h org.glite.lb-utils.jobid/interface/JobIdExceptions.h org.glite.lb-utils.jobid/interface/cjobid.h org.glite.lb-utils.jobid/interface/strmd5.h org.glite.lb-utils.jobid/project/build.number org.glite.lb-utils.jobid/project/build.properties org.glite.lb-utils.jobid/project/configure.properties.xml org.glite.lb-utils.jobid/project/properties.xml org.glite.lb-utils.jobid/project/tar_exclude org.glite.lb-utils.jobid/project/version.properties org.glite.lb-utils.jobid/src/cjobid.c org.glite.lb-utils.jobid/src/strmd5.c org.glite.lb-utils.server-bones/.cvsignore org.glite.lb-utils.server-bones/LICENSE org.glite.lb-utils.server-bones/build.xml org.glite.lb-utils.server-bones/project/build.number org.glite.lb-utils.server-bones/project/build.properties org.glite.lb-utils.server-bones/project/configure.properties.xml org.glite.lb-utils.server-bones/project/properties.xml org.glite.lb-utils.server-bones/project/version.properties org.glite.lb-utils.trio/.cvsignore org.glite.lb-utils.trio/LICENSE org.glite.lb-utils.trio/Makefile org.glite.lb-utils.trio/build.xml org.glite.lb-utils.trio/interface/escape.h org.glite.lb-utils.trio/interface/trio.h org.glite.lb-utils.trio/project/build.number org.glite.lb-utils.trio/project/build.properties org.glite.lb-utils.trio/project/configure.properties.xml org.glite.lb-utils.trio/project/properties.xml org.glite.lb-utils.trio/project/version.properties org.glite.lb-utils.trio/src/escape.c org.glite.lb-utils.trio/src/strio.c org.glite.lb-utils.trio/src/strio.h org.glite.lb-utils.trio/src/trio.c org.glite.lb-utils.trio/src/triop.h org.glite.lb-utils.trio/test/trio_test.cpp org.glite.lb-utils/.cvsignore org.glite.lb-utils/LICENSE org.glite.lb-utils/build.xml org.glite.lb-utils/project/build.number org.glite.lb-utils/project/build.properties org.glite.lb-utils/project/dependencies.properties org.glite.lb-utils/project/glite.lb-utils.csf.xml org.glite.lb-utils/project/properties.xml org.glite.lb-utils/project/taskdefs.xml org.glite.lb-utils/project/version.properties org.glite.lb.client-interface/.cvsignore org.glite.lb.client-interface/IMPORTANT-README org.glite.lb.client-interface/LICENSE org.glite.lb.client-interface/Makefile org.glite.lb.client-interface/build.xml org.glite.lb.client-interface/project/build.number org.glite.lb.client-interface/project/build.properties org.glite.lb.client-interface/project/configure.properties.xml org.glite.lb.client-interface/project/properties.xml org.glite.lb.client-interface/project/tar_exclude org.glite.lb.client-interface/project/version.properties org.glite.lb.proxy/.cvsignore org.glite.lb.proxy/LICENSE org.glite.lb.proxy/Makefile org.glite.lb.proxy/build.xml org.glite.lb.proxy/config/glite-lb-dbsetup-proxy.sql org.glite.lb.proxy/config/startup org.glite.lb.proxy/doc/README org.glite.lb.proxy/doc/README.deploy org.glite.lb.proxy/examples/test.sh org.glite.lb.proxy/examples/test1.sh org.glite.lb.proxy/examples/test2.sh org.glite.lb.proxy/examples/test3.sh org.glite.lb.proxy/project/build.number org.glite.lb.proxy/project/build.properties org.glite.lb.proxy/project/configure.properties.xml org.glite.lb.proxy/project/properties.xml org.glite.lb.proxy/project/tar_exclude org.glite.lb.proxy/project/version.properties org.glite.lb.proxy/src/fake_write2rgma.c org.glite.lb.proxy/src/lbproxy.c org.glite.lb.proxy/src/perftest_proxy.sh org.glite.lb.server-bones/.cvsignore org.glite.lb.server-bones/Makefile org.glite.lb.server-bones/build.xml org.glite.lb.server-bones/examples/cnt_example.c org.glite.lb.server-bones/examples/srv_example.c org.glite.lb.server-bones/interface/srvbones.h org.glite.lb.server-bones/project/build.number org.glite.lb.server-bones/project/build.properties org.glite.lb.server-bones/project/configure.properties.xml org.glite.lb.server-bones/project/properties.xml org.glite.lb.server-bones/project/tar_exclude org.glite.lb.server-bones/project/version.properties org.glite.lb.server-bones/src/srvbones.c org.glite.lbjp-utils.db/.cvsignore org.glite.lbjp-utils.db/LICENSE org.glite.lbjp-utils.db/Makefile org.glite.lbjp-utils.db/examples/db_expire.c org.glite.lbjp-utils.db/examples/db_test.c org.glite.lbjp-utils.db/interface/db.h org.glite.lbjp-utils.db/src/db.c org.glite.lbjp-utils.jobid/.cvsignore org.glite.lbjp-utils.jobid/LICENSE org.glite.lbjp-utils.jobid/Makefile org.glite.lbjp-utils.jobid/interface/Exception.h org.glite.lbjp-utils.jobid/interface/JobId.h org.glite.lbjp-utils.jobid/interface/JobIdExceptions.h org.glite.lbjp-utils.jobid/interface/cjobid.h org.glite.lbjp-utils.jobid/interface/strmd5.h org.glite.lbjp-utils.jobid/src/cjobid.c org.glite.lbjp-utils.jobid/src/strmd5.c org.glite.lbjp-utils.server-bones/.cvsignore org.glite.lbjp-utils.server-bones/Makefile org.glite.lbjp-utils.server-bones/examples/cnt_example.c org.glite.lbjp-utils.server-bones/examples/srv_example.c org.glite.lbjp-utils.server-bones/interface/srvbones.h org.glite.lbjp-utils.server-bones/src/srvbones.c org.glite.lbjp-utils.trio/.cvsignore org.glite.lbjp-utils.trio/LICENSE org.glite.lbjp-utils.trio/Makefile org.glite.lbjp-utils.trio/interface/escape.h org.glite.lbjp-utils.trio/interface/trio.h org.glite.lbjp-utils.trio/src/escape.c org.glite.lbjp-utils.trio/src/strio.c org.glite.lbjp-utils.trio/src/strio.h org.glite.lbjp-utils.trio/src/trio.c org.glite.lbjp-utils.trio/src/triop.h org.glite.lbjp-utils.trio/test/trio_test.cpp org.glite.myproxy-config/.cvsignore org.glite.myproxy-config/Makefile org.glite.myproxy-config/myproxy-config.spec org.glite.myproxy-config/myproxy-initd org.glite.px.emi-px/Makefile org.glite.px.emi-px/configure org.glite.px.emi-px/project/ChangeLog org.glite.px.emi-px/project/package.description org.glite.px.emi-px/project/package.summary org.glite.px.emi-px/project/version.properties org.glite.px.glite-PX/Makefile org.glite.px.glite-PX/configure org.glite.px.glite-PX/project/ChangeLog org.glite.px.glite-PX/project/package.description org.glite.px.glite-PX/project/package.summary org.glite.px.glite-PX/project/version.properties org.glite.px.myproxy-yaim/Makefile org.glite.px.myproxy-yaim/config/defaults/glite-px.pre org.glite.px.myproxy-yaim/config/functions/config_gip_px org.glite.px.myproxy-yaim/config/functions/config_info_service_px org.glite.px.myproxy-yaim/config/functions/config_proxy_server org.glite.px.myproxy-yaim/config/functions/emi/config_info_service_px org.glite.px.myproxy-yaim/config/man/myproxy-yaim.1 org.glite.px.myproxy-yaim/config/node-info.d/emi/glite-px org.glite.px.myproxy-yaim/config/node-info.d/glite-px org.glite.px.myproxy-yaim/config/node-info.d/glite-px_30 org.glite.px.myproxy-yaim/config/services/glite-px org.glite.px.myproxy-yaim/configure org.glite.px.myproxy-yaim/project/ChangeLog org.glite.px.myproxy-yaim/project/package.description org.glite.px.myproxy-yaim/project/package.summary org.glite.px.myproxy-yaim/project/version.properties org.glite.px.proxyrenewal/LICENSE org.glite.px.proxyrenewal/Makefile org.glite.px.proxyrenewal/config/startup org.glite.px.proxyrenewal/configure org.glite.px.proxyrenewal/examples/renew_core.c org.glite.px.proxyrenewal/interface/renewal.h org.glite.px.proxyrenewal/interface/renewal_core.h org.glite.px.proxyrenewal/project/.post org.glite.px.proxyrenewal/project/.postun org.glite.px.proxyrenewal/project/ChangeLog org.glite.px.proxyrenewal/project/package.description org.glite.px.proxyrenewal/project/package.summary org.glite.px.proxyrenewal/project/version.properties org.glite.px.proxyrenewal/src/api.c org.glite.px.proxyrenewal/src/client.c org.glite.px.proxyrenewal/src/commands.c org.glite.px.proxyrenewal/src/common.c org.glite.px.proxyrenewal/src/glite-proxy-renew.1 org.glite.px.proxyrenewal/src/glite-proxy-renewd.8 org.glite.px.proxyrenewal/src/renew.c org.glite.px.proxyrenewal/src/renewal_core.c org.glite.px.proxyrenewal/src/renewal_locl.h org.glite.px.proxyrenewal/src/renewd.c org.glite.px.proxyrenewal/src/renewd_locl.h org.glite.px.proxyrenewal/src/voms.c org.glite.px/project/version.properties org.glite.security.gsoap-plugin/LICENSE org.glite.security.gsoap-plugin/Makefile org.glite.security.gsoap-plugin/build.xml org.glite.security.gsoap-plugin/configure org.glite.security.gsoap-plugin/examples/calc.h.S org.glite.security.gsoap-plugin/examples/wscalc_clt_ex.c org.glite.security.gsoap-plugin/examples/wscalc_srv_ex.c org.glite.security.gsoap-plugin/examples/wscalc_srv_ex2.c org.glite.security.gsoap-plugin/interface/glite_gscompat.h org.glite.security.gsoap-plugin/interface/glite_gsplugin-int.h org.glite.security.gsoap-plugin/interface/glite_gsplugin.h org.glite.security.gsoap-plugin/project/ChangeLog org.glite.security.gsoap-plugin/project/build.number org.glite.security.gsoap-plugin/project/build.properties org.glite.security.gsoap-plugin/project/configure.properties.xml org.glite.security.gsoap-plugin/project/libtoolhack/gcc org.glite.security.gsoap-plugin/project/package.description org.glite.security.gsoap-plugin/project/package.summary org.glite.security.gsoap-plugin/project/properties.xml org.glite.security.gsoap-plugin/project/tar_exclude org.glite.security.gsoap-plugin/project/version.properties org.glite.security.gsoap-plugin/src/glite_gsplugin.c org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.c org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.h org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.c org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.h org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp org.glite.security.gss/LICENSE org.glite.security.gss/Makefile org.glite.security.gss/configure org.glite.security.gss/interface/glite_gss.h org.glite.security.gss/project/ChangeLog org.glite.security.gss/project/package.description org.glite.security.gss/project/package.summary org.glite.security.gss/project/version.properties org.glite.security.gss/src/glite_gss.c org.glite.security.gss/test/test_gss.cpp org.glite.security.proxyrenewal/.cvsignore org.glite.security.proxyrenewal/LICENSE org.glite.security.proxyrenewal/Makefile org.glite.security.proxyrenewal/build.xml org.glite.security.proxyrenewal/config/startup org.glite.security.proxyrenewal/examples/renew_core.c org.glite.security.proxyrenewal/interface/renewal.h org.glite.security.proxyrenewal/interface/renewal_core.h org.glite.security.proxyrenewal/project/build.number org.glite.security.proxyrenewal/project/build.properties org.glite.security.proxyrenewal/project/configure.properties.xml org.glite.security.proxyrenewal/project/properties.xml org.glite.security.proxyrenewal/project/tar_exclude org.glite.security.proxyrenewal/project/taskdefs.xml org.glite.security.proxyrenewal/project/version.properties org.glite.security.proxyrenewal/src/api.c org.glite.security.proxyrenewal/src/client.c org.glite.security.proxyrenewal/src/commands.c org.glite.security.proxyrenewal/src/common.c org.glite.security.proxyrenewal/src/renew.c org.glite.security.proxyrenewal/src/renewal_core.c org.glite.security.proxyrenewal/src/renewal_locl.h org.glite.security.proxyrenewal/src/renewd.c org.glite.security.proxyrenewal/src/renewd_locl.h org.glite.security.proxyrenewal/src/voms.c org.glite.testsuites.ctb/LB/LB-certconfig org.glite.testsuites.ctb/LB/LB-certtest.sh org.glite.testsuites.ctb/LB/Makefile org.glite.testsuites.ctb/LB/manual/Readme.txt org.glite.testsuites.ctb/LB/manual/Readme2.txt.old org.glite.testsuites.ctb/LB/tests/Makefile org.glite.testsuites.ctb/LB/tests/lb-common.sh org.glite.testsuites.ctb/LB/tests/lb-l2.sh org.glite.testsuites.ctb/LB/tests/lb-l2ILR.sh org.glite.testsuites.ctb/LB/tests/lb-l2Stat.sh org.glite.testsuites.ctb/LB/tests/lb-run-tests.sh org.glite.testsuites.ctb/LB/tests/lb-test-acl-authz.sh org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh org.glite.testsuites.ctb/LB/tests/lb-test-binaries.sh org.glite.testsuites.ctb/LB/tests/lb-test-changeacl.sh org.glite.testsuites.ctb/LB/tests/lb-test-event-delivery.sh org.glite.testsuites.ctb/LB/tests/lb-test-harvester.sh org.glite.testsuites.ctb/LB/tests/lb-test-https.sh org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh org.glite.testsuites.ctb/LB/tests/lb-test-job-states.sh org.glite.testsuites.ctb/LB/tests/lb-test-logevent.sh org.glite.testsuites.ctb/LB/tests/lb-test-logger-local.sh org.glite.testsuites.ctb/LB/tests/lb-test-logger-remote.sh org.glite.testsuites.ctb/LB/tests/lb-test-notif-msg.sh org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh org.glite.testsuites.ctb/LB/tests/lb-test-proxy-delivery.sh org.glite.testsuites.ctb/LB/tests/lb-test-purge.pl org.glite.testsuites.ctb/LB/tests/lb-test-sandbox-transfer.sh org.glite.testsuites.ctb/LB/tests/lb-test-server-local.sh org.glite.testsuites.ctb/LB/tests/lb-test-server-remote.sh org.glite.testsuites.ctb/LB/tests/lb-test-statistics.sh org.glite.testsuites.ctb/LB/tests/lb-test-switch-owner.sh org.glite.testsuites.ctb/LB/tests/lb-test-threaded.sh org.glite.testsuites.ctb/LB/tests/lb-test-wild.sh org.glite.testsuites.ctb/LB/tests/lb-test-ws.sh org.glite.testsuites.ctb/LB/tests/test-common.sh org.glite.testsuites.ctb/LB/tests/testSocket.c org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh org.glite.testsuites.ctb/gridsite/tests/gridsite-test-all.sh org.glite.testsuites.ctb/gridsite/tests/ping-local.sh org.glite.testsuites.ctb/gridsite/tests/ping-remote.sh org.glite.testsuites.ctb/gridsite/tests/test-common.sh org.glite.wms-utils.exception/.cvsignore org.glite.wms-utils.exception/LICENSE org.glite.wms-utils.exception/Makefile.am org.glite.wms-utils.exception/bootstrap org.glite.wms-utils.exception/build.xml org.glite.wms-utils.exception/configure.ac org.glite.wms-utils.exception/interface/Makefile.am org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h org.glite.wms-utils.exception/interface/glite/wmsutils/exception/exception_codes.h org.glite.wms-utils.exception/project/build.number org.glite.wms-utils.exception/project/build.properties org.glite.wms-utils.exception/project/configure.properties.xml org.glite.wms-utils.exception/project/properties.xml org.glite.wms-utils.exception/project/version.properties org.glite.wms-utils.exception/src/Exception.cpp org.glite.wms-utils.exception/src/Makefile.am org.glite.wms-utils.exception/test/Makefile.am org.glite.wms-utils.exception/test/exception_cu_main.cpp org.glite.wms-utils.exception/test/exception_cu_suite.cpp org.glite.wms-utils.exception/test/exception_cu_suite.h org.glite.wms-utils.jobid/.cvsignore org.glite.wms-utils.jobid/LICENSE org.glite.wms-utils.jobid/Makefile.am org.glite.wms-utils.jobid/bootstrap org.glite.wms-utils.jobid/build.xml org.glite.wms-utils.jobid/configure.ac org.glite.wms-utils.jobid/examples/Makefile.am org.glite.wms-utils.jobid/examples/testjobid.c org.glite.wms-utils.jobid/interface/Makefile.am org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobIdExceptions.h org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/cjobid.h org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/manipulation.h org.glite.wms-utils.jobid/project/build.number org.glite.wms-utils.jobid/project/build.properties org.glite.wms-utils.jobid/project/configure.properties.xml org.glite.wms-utils.jobid/project/properties.xml org.glite.wms-utils.jobid/project/version.properties org.glite.wms-utils.jobid/src/Makefile.am org.glite.wms-utils.jobid/src/jobid/JobId.cpp org.glite.wms-utils.jobid/src/jobid/JobIdExceptions.cpp org.glite.wms-utils.jobid/src/jobid/Makefile.am org.glite.wms-utils.jobid/src/jobid/cjobid.c org.glite.wms-utils.jobid/src/jobid/manipulation.cpp org.glite.wms-utils.jobid/src/jobid/strmd5.c org.glite.wms-utils.jobid/src/jobid/strmd5.h org.glite.wms-utils.jobid/test/Makefile.am org.glite.wms-utils.jobid/test/jobid_cu_main.cpp org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp org.glite.wms-utils.jobid/test/jobid_cu_suite.h org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp org.glite.wms-utils.jobid/test/manipulation_cu_suite.h org.glite.yaim.lb/.cvsignore org.glite.yaim.lb/LICENSE org.glite.yaim.lb/Makefile org.glite.yaim.lb/config/defaults/glite-lb.pre org.glite.yaim.lb/config/defaults/glite-lb_30.pre org.glite.yaim.lb/config/functions/config_gip_lb org.glite.yaim.lb/config/functions/config_gip_lb_30 org.glite.yaim.lb/config/functions/config_glite_lb org.glite.yaim.lb/config/functions/config_glite_lb_30 org.glite.yaim.lb/config/functions/config_info_service_lb org.glite.yaim.lb/config/functions/config_jobmon org.glite.yaim.lb/config/node-info.d/glite-lb org.glite.yaim.lb/config/node-info.d/glite-lb_30 org.glite.yaim.lb/glite-yaim-lb.spec org.glite.yaim.myproxy/.cvsignore org.glite.yaim.myproxy/Changelog org.glite.yaim.myproxy/LICENSE org.glite.yaim.myproxy/Makefile org.glite.yaim.myproxy/config/functions/config_gip_px org.glite.yaim.myproxy/config/functions/config_info_service_px org.glite.yaim.myproxy/config/functions/config_proxy_server org.glite.yaim.myproxy/config/man/yaim-myproxy.1 org.glite.yaim.myproxy/config/node-info.d/glite-px org.glite.yaim.myproxy/config/node-info.d/glite-px_30 org.glite.yaim.myproxy/config/services/glite-px org.glite.yaim.myproxy/glite-yaim-myproxy.spec org.gridsite.core/.cvsignore org.gridsite.core/CHANGES org.gridsite.core/INSTALL org.gridsite.core/LICENSE org.gridsite.core/README org.gridsite.core/VERSION org.gridsite.core/build.xml org.gridsite.core/doc/README.htcp-bin org.gridsite.core/doc/build-apache2.sh org.gridsite.core/doc/delegation-1.1.0.wsdl org.gridsite.core/doc/findproxyfile.1 org.gridsite.core/doc/fuse.spec org.gridsite.core/doc/gridsite-delegation.8 org.gridsite.core/doc/gsexec.8 org.gridsite.core/doc/gsoap-devel.spec org.gridsite.core/doc/htcp.1 org.gridsite.core/doc/htfind.1 org.gridsite.core/doc/htll.1 org.gridsite.core/doc/htls.1 org.gridsite.core/doc/htmkdir.1 org.gridsite.core/doc/htmv.1 org.gridsite.core/doc/htping.1 org.gridsite.core/doc/htproxydestroy.1 org.gridsite.core/doc/htproxyinfo.1 org.gridsite.core/doc/htproxyput.1 org.gridsite.core/doc/htproxyrenew.1 org.gridsite.core/doc/htproxytime.1 org.gridsite.core/doc/htproxyunixtime.1 org.gridsite.core/doc/htrm.1 org.gridsite.core/doc/httpd-fileserver.conf org.gridsite.core/doc/httpd-storage.conf org.gridsite.core/doc/httpd-webserver.conf org.gridsite.core/doc/index.html org.gridsite.core/doc/mod_gridsite.8 org.gridsite.core/doc/slashgrid.8 org.gridsite.core/doc/urlencode.1 org.gridsite.core/interface/gridsite-gacl.h org.gridsite.core/interface/gridsite.h org.gridsite.core/project/build.number org.gridsite.core/project/build.properties org.gridsite.core/project/compat-1.5.patch org.gridsite.core/project/configure.properties.xml org.gridsite.core/project/dependencies.properties org.gridsite.core/project/gridsite.core.csf.xml org.gridsite.core/project/properties.xml org.gridsite.core/project/taskdefs.xml org.gridsite.core/project/version.properties org.gridsite.core/src/Doxyfile org.gridsite.core/src/Makefile org.gridsite.core/src/delegation.h org.gridsite.core/src/doxygen.css org.gridsite.core/src/doxyheader.html org.gridsite.core/src/findproxyfile.c org.gridsite.core/src/gaclexample.c org.gridsite.core/src/gridsite-copy.c org.gridsite.core/src/gridsite-storage.c org.gridsite.core/src/grst-delegation.c org.gridsite.core/src/grst_admin.h org.gridsite.core/src/grst_admin_file.c org.gridsite.core/src/grst_admin_gacl.c org.gridsite.core/src/grst_admin_main.c org.gridsite.core/src/grst_asn1.c org.gridsite.core/src/grst_err.c org.gridsite.core/src/grst_gacl.c org.gridsite.core/src/grst_htcp.c org.gridsite.core/src/grst_http.c org.gridsite.core/src/grst_x509.c org.gridsite.core/src/grst_xacml.c org.gridsite.core/src/gsexec.c org.gridsite.core/src/gsexec.h org.gridsite.core/src/htcp.c org.gridsite.core/src/htproxyput.c org.gridsite.core/src/make-gridsite-spec org.gridsite.core/src/mod_gridsite.c org.gridsite.core/src/mod_gridsite_example.c org.gridsite.core/src/mod_ssl-private.h org.gridsite.core/src/roffit org.gridsite.core/src/showx509exts.c org.gridsite.core/src/slashgrid.c org.gridsite.core/src/slashgrid.init org.gridsite.core/src/urlencode.c org.gridsite.core/src/xacmlexample.c --- org.glite.deployment.jpis/build.xml | 94 - .../config/scripts/glite-jpis-config.py | 492 - .../config/templates/glite-jpis.cfg.xml | 92 - org.glite.deployment.jpis/project/build.number | 2 - org.glite.deployment.jpis/project/build.properties | 0 .../project/glite-jp.sdf.xml.template | 117 - .../project/glite-jpis.sdf.xml.template | 117 - org.glite.deployment.jpis/project/lxscript-rpm.xsl | 336 - org.glite.deployment.jpis/project/lxscript-tgz.xsl | 62 - org.glite.deployment.jpis/project/properties.xml | 63 - .../project/quattor-template.xsl | 64 - .../project/version.properties | 4 - org.glite.deployment.jpps/build.xml | 94 - .../config/scripts/glite-jpps-config.py | 500 - .../config/templates/glite-jpps.cfg.xml | 93 - org.glite.deployment.jpps/project/build.number | 2 - org.glite.deployment.jpps/project/build.properties | 0 .../project/glite-jpps.sdf.xml.template | 127 - org.glite.deployment.jpps/project/lxscript-rpm.xsl | 336 - org.glite.deployment.jpps/project/lxscript-tgz.xsl | 62 - org.glite.deployment.jpps/project/properties.xml | 63 - .../project/quattor-template.xsl | 64 - .../project/version.properties | 4 - org.glite.deployment.lb/.cvsignore | 1 - org.glite.deployment.lb/CHANGELOG | 40 - org.glite.deployment.lb/LICENSE | 69 - org.glite.deployment.lb/build.xml | 110 - .../config/scripts/glite-lb-config.py | 574 - .../config/templates/glite-lb.cfg.xml | 73 - .../doc/release_notes/release_notes.doc | Bin 192512 -> 0 bytes .../doc/release_notes/release_notes.html | 2712 ---- .../doc/release_notes/release_notes.pdf | Bin 157326 -> 0 bytes org.glite.deployment.lb/project/.cvsignore | 1 - org.glite.deployment.lb/project/build.number | 2 - org.glite.deployment.lb/project/build.properties | 0 .../project/glite-lb.sdf.xml.template | 157 - org.glite.deployment.lb/project/lxscript-rpm.xsl | 336 - org.glite.deployment.lb/project/lxscript-tgz.xsl | 62 - org.glite.deployment.lb/project/properties.xml | 73 - .../project/quattor-template.xsl | 64 - org.glite.deployment.lb/project/version.properties | 4 - org.glite.jp.client/.cvsignore | 1 - org.glite.jp.client/Makefile | 188 - org.glite.jp.client/build.xml | 86 - org.glite.jp.client/config/startup | 115 - org.glite.jp.client/configure | 701 - org.glite.jp.client/doc/README.jpimporter | 115 - org.glite.jp.client/examples/glite-jp-importer.sh | 83 - org.glite.jp.client/examples/jpps_upload_files.c | 99 - org.glite.jp.client/examples/mill_feed.c | 334 - org.glite.jp.client/interface/jp_client.h | 48 - org.glite.jp.client/interface/jpcl_ctx_int.h | 40 - org.glite.jp.client/interface/jpimporter.h | 52 - org.glite.jp.client/project/ChangeLog | 6 - org.glite.jp.client/project/build.number | 2 - org.glite.jp.client/project/build.properties | 0 .../project/configure.properties.xml | 44 - org.glite.jp.client/project/properties.xml | 44 - org.glite.jp.client/project/tar_exclude | 10 - org.glite.jp.client/project/version.properties | 3 - org.glite.jp.client/src/jpcl_ctx.c | 93 - org.glite.jp.client/src/jpimp_lib.c | 134 - org.glite.jp.client/src/jpimporter.c | 1070 -- org.glite.jp.client/src/jptype_map.h | 35 - org.glite.jp.client/src/typemap.dat | 3 - org.glite.jp.common/.cvsignore | 1 - org.glite.jp.common/Makefile | 90 - org.glite.jp.common/build.xml | 97 - org.glite.jp.common/interface/attr.h | 49 - org.glite.jp.common/interface/backend.h | 131 - org.glite.jp.common/interface/builtin_plugins.h | 25 - org.glite.jp.common/interface/context.h | 43 - org.glite.jp.common/interface/file_plugin.h | 103 - org.glite.jp.common/interface/indexdb.h | 76 - org.glite.jp.common/interface/known_attr.h | 58 - org.glite.jp.common/interface/type_plugin.h | 91 - org.glite.jp.common/interface/types.h | 83 - org.glite.jp.common/project/build.number | 2 - org.glite.jp.common/project/build.properties | 0 .../project/configure.properties.xml | 62 - org.glite.jp.common/project/properties.xml | 52 - org.glite.jp.common/project/tar_exclude | 10 - org.glite.jp.common/project/version.properties | 2 - org.glite.jp.common/src/attr.c | 308 - org.glite.jp.common/src/context.c | 162 - org.glite.jp.common/src/indexdb.c | 88 - org.glite.jp.common/src/utils.c | 80 - org.glite.jp.common/test/type_test.cpp | 217 - org.glite.jp.doc/LICENSE | 69 - org.glite.jp.doc/Makefile | 79 - org.glite.jp.doc/configure | 701 - org.glite.jp.doc/project/ChangeLog | 6 - org.glite.jp.doc/project/version.properties | 3 - org.glite.jp.doc/src/JPAG-Configuration.tex | 36 - org.glite.jp.doc/src/JPAG-Installation.tex | 9 - org.glite.jp.doc/src/JPAG-Introduction.tex | 75 - org.glite.jp.doc/src/JPAG-Running.tex | 33 - org.glite.jp.doc/src/JPAG-Testing.tex | 545 - org.glite.jp.doc/src/JPAG-Troubleshooting.tex | 6 - org.glite.jp.doc/src/JPAG.tex | 48 - org.glite.jp.doc/src/JPDG-Introduction.tex | 4 - org.glite.jp.doc/src/JPDG-WS.tex | 34 - org.glite.jp.doc/src/JPDG.tex | 36 - org.glite.jp.doc/src/JPUG-Introduction.tex | 693 - org.glite.jp.doc/src/JPUG-Tools.tex | 25 - org.glite.jp.doc/src/JPUG-UseCases.tex | 159 - org.glite.jp.doc/src/JPUG.tex | 43 - org.glite.jp.doc/src/LB-JP-interaction.tex | 74 - org.glite.jp.doc/src/README | 12 - org.glite.jp.doc/src/copyright.tex | 24 - org.glite.jp.doc/src/definitions.tex | 24 - org.glite.jp.doc/src/egee.cls | 507 - org.glite.jp.doc/src/frontmatter.tex | 40 - org.glite.jp.doc/src/glite-jpis-client.tex | 93 - .../src/glite_installation_guide_JP.doc | Bin 349184 -> 0 bytes .../src/glite_installation_guide_LB.doc | Bin 174080 -> 0 bytes org.glite.jp.doc/src/gui.tex | 3 - org.glite.jp.doc/src/images/JP-interactions.cdr | Bin 49340 -> 0 bytes org.glite.jp.doc/src/images/JP-interactions.pdf | Bin 85708 -> 0 bytes org.glite.jp.doc/src/images/JP-query.cdr | Bin 37774 -> 0 bytes org.glite.jp.doc/src/images/JP-query.pdf | Bin 41756 -> 0 bytes .../src/images/LB-JP-interaction-details.cdr | Bin 42198 -> 0 bytes .../src/images/LB-JP-interaction-details.pdf | Bin 72334 -> 0 bytes .../src/images/LB-JP-interaction-drawing.pdf | Bin 167722 -> 0 bytes org.glite.jp.doc/src/images/egee.pdf | Bin 8922 -> 0 bytes org.glite.jp.doc/src/images/isi.pdf | Bin 19672 -> 0 bytes org.glite.jp.doc/src/jpimporter.tex | 4 - org.glite.jp.doc/src/jpws.tex | 599 - org.glite.jp.doc/src/lbjp.bib | 709 - org.glite.jp.index/.cvsignore | 1 - org.glite.jp.index/Makefile | 178 - org.glite.jp.index/build.xml | 98 - org.glite.jp.index/config/dbsetup.sh | 30 - org.glite.jp.index/config/defaults/glite-jpis.pre | 2 - .../config/functions/config_glite_jpis | 148 - .../config/glite-jp-index-dbsetup.sql | 96 - org.glite.jp.index/config/glite-jpis-config.xml | 541 - .../config/glite-jpis-test-config.xml | 105 - org.glite.jp.index/config/node-info.d/glite-jpis | 8 - org.glite.jp.index/config/site-info.def.example | 77 - org.glite.jp.index/config/startup | 135 - org.glite.jp.index/configure | 701 - org.glite.jp.index/doc/README | 41 - org.glite.jp.index/doc/client_conf.xsd | 84 - org.glite.jp.index/doc/glite-jp-indexd.sgml | 372 - org.glite.jp.index/doc/glite-jpis-client.sgml | 193 - org.glite.jp.index/doc/server_conf.xsd | 97 - org.glite.jp.index/examples/jpis-client.c | 538 - org.glite.jp.index/examples/jpis-db-internal.c | 151 - org.glite.jp.index/examples/jpis-test.c | 255 - org.glite.jp.index/examples/pch06/pch.pm | 237 - org.glite.jp.index/examples/pch06/query1.pl | 132 - org.glite.jp.index/examples/pch06/query2.pl | 147 - org.glite.jp.index/examples/pch06/query3.pl | 140 - org.glite.jp.index/examples/pch06/query4.pl | 150 - org.glite.jp.index/examples/pch06/query5.pl | 142 - org.glite.jp.index/examples/pch06/query6.pl | 172 - org.glite.jp.index/examples/query-tests/authz.out | 14 - .../examples/query-tests/complex_query.in | 36 - .../examples/query-tests/complex_query.out | 36 - org.glite.jp.index/examples/query-tests/dump1.sql | 594 - .../examples/query-tests/exists_query.in | 17 - .../examples/query-tests/exists_query.out | 28 - .../examples/query-tests/jobid_query.in | 19 - .../examples/query-tests/jobid_query.out | 23 - .../examples/query-tests/origin_query.in | 20 - .../examples/query-tests/origin_query.out | 23 - .../examples/query-tests/run-test.sh | 314 - .../examples/query-tests/simple_query.in | 19 - .../examples/query-tests/simple_query.out | 23 - .../examples/query-tests/within_query.in | 19 - .../examples/query-tests/within_query.out | 28 - .../interface/JobProvenanceISClient.xsd | 28 - org.glite.jp.index/project/ChangeLog | 6 - org.glite.jp.index/project/build.number | 2 - org.glite.jp.index/project/build.properties | 0 .../project/configure.properties.xml | 74 - org.glite.jp.index/project/properties.xml | 52 - org.glite.jp.index/project/tar_exclude | 10 - org.glite.jp.index/project/version.properties | 3 - org.glite.jp.index/src/bones_server.c | 560 - org.glite.jp.index/src/common.c | 77 - org.glite.jp.index/src/common.h | 36 - org.glite.jp.index/src/conf.c | 345 - org.glite.jp.index/src/conf.h | 85 - org.glite.jp.index/src/context.c | 55 - org.glite.jp.index/src/context.h | 45 - org.glite.jp.index/src/db_ops.c | 889 -- org.glite.jp.index/src/db_ops.h | 67 - org.glite.jp.index/src/simple_server.c | 56 - org.glite.jp.index/src/soap_ops.c | 738 - org.glite.jp.index/src/soap_ps_calls.c | 197 - org.glite.jp.index/src/soap_ps_calls.h | 29 - org.glite.jp.index/src/type_plugin.c | 75 - org.glite.jp.index/src/typemap.dat | 4 - org.glite.jp.index/src/ws_is_typeref.c | 231 - org.glite.jp.index/src/ws_is_typeref.h | 30 - org.glite.jp.index/src/ws_ps_typeref.c | 161 - org.glite.jp.index/src/ws_ps_typeref.h | 27 - org.glite.jp.index/src/ws_typemap.h | 45 - org.glite.jp.primary/.cvsignore | 1 - org.glite.jp.primary/Makefile | 223 - org.glite.jp.primary/build.xml | 116 - .../config/defaults/glite-jpps.pre | 2 - .../config/functions/config_glite_jpps | 126 - .../config/glite-jp-primary-dbsetup.sh | 30 - .../config/glite-jp-primary-dbsetup.sql | 63 - org.glite.jp.primary/config/gsi_authz.conf.example | 6 - org.glite.jp.primary/config/node-info.d/glite-jpps | 6 - org.glite.jp.primary/config/site-info.def.example | 64 - org.glite.jp.primary/config/startup | 169 - org.glite.jp.primary/configure | 701 - org.glite.jp.primary/doc/README.install | 59 - org.glite.jp.primary/examples/README.test | 94 - org.glite.jp.primary/examples/dag-deps.c | 194 - org.glite.jp.primary/examples/getjobattr.pl | 60 - org.glite.jp.primary/examples/job_template | 14 - org.glite.jp.primary/examples/jpps-test.c | 303 - org.glite.jp.primary/examples/jpps_store_test | 86 - org.glite.jp.primary/examples/recordmultitags.pl | 77 - org.glite.jp.primary/examples/sample_job_aborted | 9 - org.glite.jp.primary/examples/sample_job_cleared | 15 - .../examples/sample_job_tagged_done | 15 - org.glite.jp.primary/examples/sample_job_waiting | 8 - org.glite.jp.primary/project/ChangeLog | 6 - org.glite.jp.primary/project/build.number | 2 - org.glite.jp.primary/project/build.properties | 0 .../project/configure.properties.xml | 85 - org.glite.jp.primary/project/properties.xml | 51 - org.glite.jp.primary/project/tar_exclude | 10 - org.glite.jp.primary/project/version.properties | 2 - org.glite.jp.primary/src/attrs.c | 278 - org.glite.jp.primary/src/attrs.h | 19 - org.glite.jp.primary/src/authz.c | 102 - org.glite.jp.primary/src/authz.h | 35 - org.glite.jp.primary/src/backend.h | 180 - org.glite.jp.primary/src/backend_private.h | 93 - org.glite.jp.primary/src/bones_server.c | 436 - org.glite.jp.primary/src/classad_plugin.c | 232 - org.glite.jp.primary/src/feed.c | 995 -- org.glite.jp.primary/src/feed.h | 54 - org.glite.jp.primary/src/file_plugin.c | 142 - org.glite.jp.primary/src/ftpd_auth.c | 219 - org.glite.jp.primary/src/is_client.c | 499 - org.glite.jp.primary/src/is_client.h | 21 - org.glite.jp.primary/src/jp_callouts.c | 539 - org.glite.jp.primary/src/jp_callouts.h | 29 - org.glite.jp.primary/src/jptype_map.h | 51 - org.glite.jp.primary/src/mk_soap_switch.pl | 79 - org.glite.jp.primary/src/new_ftp_backend.c | 2145 --- org.glite.jp.primary/src/sandbox_plugin.c | 280 - org.glite.jp.primary/src/simple_server.c | 76 - org.glite.jp.primary/src/soap_ops.c | 620 - org.glite.jp.primary/src/soap_util.c | 91 - org.glite.jp.primary/src/tags.c | 476 - org.glite.jp.primary/src/tags.h | 27 - org.glite.jp.primary/src/typemap.dat | 3 - org.glite.jp.server-common/Makefile | 77 - org.glite.jp.server-common/build.xml | 101 - org.glite.jp.server-common/configure | 701 - org.glite.jp.server-common/examples/db-test-int.c | 129 - org.glite.jp.server-common/interface/db.h | 44 - org.glite.jp.server-common/project/ChangeLog | 6 - org.glite.jp.server-common/project/build.number | 2 - .../project/configure.properties.xml | 72 - org.glite.jp.server-common/project/properties.xml | 56 - org.glite.jp.server-common/project/tar_exclude | 10 - .../project/version.properties | 2 - org.glite.jp.server-common/src/db.c | 128 - org.glite.jp.ws-interface/.cvsignore | 2 - org.glite.jp.ws-interface/LICENSE | 69 - org.glite.jp.ws-interface/Makefile | 63 - org.glite.jp.ws-interface/build.xml | 120 - org.glite.jp.ws-interface/configure | 701 - org.glite.jp.ws-interface/project/ChangeLog | 6 - org.glite.jp.ws-interface/project/build.number | 2 - org.glite.jp.ws-interface/project/build.properties | 0 .../project/configure.properties.xml | 54 - org.glite.jp.ws-interface/project/properties.xml | 73 - org.glite.jp.ws-interface/project/tar_exclude | 0 .../project/version.properties | 2 - org.glite.jp.ws-interface/src/JobProvenanceIS.xml | 104 - org.glite.jp.ws-interface/src/JobProvenancePS.xml | 110 - .../src/JobProvenanceTypes.xml | 137 - org.glite.jp.ws-interface/src/doc.xml | 2 - org.glite.jp.ws-interface/src/jpdev.sh | 36 - org.glite.jp.ws-interface/src/jpdev.xml.sh | 38 - org.glite.jp.ws-interface/src/puke-schema.xsl | 161 - org.glite.jp.ws-interface/src/puke-ug.xsl | 170 - org.glite.jp.ws-interface/src/puke-wsdl.xsl | 292 - org.glite.jp.ws-interface/src/ws_fault.c | 209 - org.glite.jp/.cvsignore | 1 - org.glite.jp/build.xml | 410 - org.glite.jp/configure | 691 - org.glite.jp/doc/README | 1 - org.glite.jp/project/build.number | 2 - org.glite.jp/project/build.properties | 2 - org.glite.jp/project/dependencies.properties | 16 - org.glite.jp/project/glite.jp.csf.xml | 322 - org.glite.jp/project/properties.xml | 47 - org.glite.jp/project/run-workspace | 10 - org.glite.jp/project/taskdefs.xml | 24 - org.glite.jp/project/version.properties | 3 - org.glite.lb-utils.context/.cvsignore | 2 - org.glite.lb-utils.context/LICENSE | 69 - org.glite.lb-utils.context/build.xml | 122 - org.glite.lb-utils.context/project/build.number | 1 - .../project/build.properties | 0 .../project/configure.properties.xml | 37 - org.glite.lb-utils.context/project/properties.xml | 73 - .../project/version.properties | 2 - org.glite.lb-utils.db/.cvsignore | 5 - org.glite.lb-utils.db/LICENSE | 69 - org.glite.lb-utils.db/Makefile | 137 - org.glite.lb-utils.db/build.xml | 126 - org.glite.lb-utils.db/examples/db_expire.c | 115 - org.glite.lb-utils.db/examples/db_test.c | 196 - org.glite.lb-utils.db/interface/db.h | 344 - org.glite.lb-utils.db/project/build.number | 1 - org.glite.lb-utils.db/project/build.properties | 3 - .../project/configure.properties.xml | 81 - org.glite.lb-utils.db/project/properties.xml | 73 - org.glite.lb-utils.db/project/tar_exclude | 10 - org.glite.lb-utils.db/project/version.properties | 2 - org.glite.lb-utils.db/src/db.c | 1039 -- org.glite.lb-utils.jobid/.cvsignore | 2 - org.glite.lb-utils.jobid/LICENSE | 69 - org.glite.lb-utils.jobid/Makefile | 98 - org.glite.lb-utils.jobid/build.xml | 129 - org.glite.lb-utils.jobid/interface/Exception.h | 138 - org.glite.lb-utils.jobid/interface/JobId.h | 126 - .../interface/JobIdExceptions.h | 80 - org.glite.lb-utils.jobid/interface/cjobid.h | 109 - org.glite.lb-utils.jobid/interface/strmd5.h | 30 - org.glite.lb-utils.jobid/project/build.number | 1 - org.glite.lb-utils.jobid/project/build.properties | 4 - .../project/configure.properties.xml | 63 - org.glite.lb-utils.jobid/project/properties.xml | 73 - org.glite.lb-utils.jobid/project/tar_exclude | 10 - .../project/version.properties | 2 - org.glite.lb-utils.jobid/src/cjobid.c | 260 - org.glite.lb-utils.jobid/src/strmd5.c | 122 - org.glite.lb-utils.server-bones/.cvsignore | 2 - org.glite.lb-utils.server-bones/LICENSE | 69 - org.glite.lb-utils.server-bones/build.xml | 122 - .../project/build.number | 1 - .../project/build.properties | 0 .../project/configure.properties.xml | 37 - .../project/properties.xml | 73 - .../project/version.properties | 2 - org.glite.lb-utils.trio/.cvsignore | 2 - org.glite.lb-utils.trio/LICENSE | 69 - org.glite.lb-utils.trio/Makefile | 114 - org.glite.lb-utils.trio/build.xml | 126 - org.glite.lb-utils.trio/interface/escape.h | 59 - org.glite.lb-utils.trio/interface/trio.h | 187 - org.glite.lb-utils.trio/project/build.number | 1 - org.glite.lb-utils.trio/project/build.properties | 4 - .../project/configure.properties.xml | 59 - org.glite.lb-utils.trio/project/properties.xml | 73 - org.glite.lb-utils.trio/project/version.properties | 2 - org.glite.lb-utils.trio/src/escape.c | 224 - org.glite.lb-utils.trio/src/strio.c | 581 - org.glite.lb-utils.trio/src/strio.h | 227 - org.glite.lb-utils.trio/src/trio.c | 5706 ------- org.glite.lb-utils.trio/src/triop.h | 138 - org.glite.lb-utils.trio/test/trio_test.cpp | 85 - org.glite.lb-utils/.cvsignore | 1 - org.glite.lb-utils/LICENSE | 69 - org.glite.lb-utils/build.xml | 303 - org.glite.lb-utils/project/build.number | 1 - org.glite.lb-utils/project/build.properties | 0 org.glite.lb-utils/project/dependencies.properties | 13 - org.glite.lb-utils/project/glite.lb-utils.csf.xml | 218 - org.glite.lb-utils/project/properties.xml | 64 - org.glite.lb-utils/project/taskdefs.xml | 38 - org.glite.lb-utils/project/version.properties | 2 - org.glite.lb.client-interface/.cvsignore | 2 - org.glite.lb.client-interface/IMPORTANT-README | 39 - org.glite.lb.client-interface/LICENSE | 69 - org.glite.lb.client-interface/Makefile | 2 - org.glite.lb.client-interface/build.xml | 144 - org.glite.lb.client-interface/project/build.number | 2 - .../project/build.properties | 0 .../project/configure.properties.xml | 96 - .../project/properties.xml | 62 - org.glite.lb.client-interface/project/tar_exclude | 10 - .../project/version.properties | 4 - org.glite.lb.proxy/.cvsignore | 1 - org.glite.lb.proxy/LICENSE | 69 - org.glite.lb.proxy/Makefile | 142 - org.glite.lb.proxy/build.xml | 126 - .../config/glite-lb-dbsetup-proxy.sql | 112 - org.glite.lb.proxy/config/startup | 77 - org.glite.lb.proxy/doc/README | 68 - org.glite.lb.proxy/doc/README.deploy | 64 - org.glite.lb.proxy/examples/test.sh | 266 - org.glite.lb.proxy/examples/test1.sh | 295 - org.glite.lb.proxy/examples/test2.sh | 298 - org.glite.lb.proxy/examples/test3.sh | 326 - org.glite.lb.proxy/project/build.number | 2 - org.glite.lb.proxy/project/build.properties | 0 .../project/configure.properties.xml | 55 - org.glite.lb.proxy/project/properties.xml | 57 - org.glite.lb.proxy/project/tar_exclude | 10 - org.glite.lb.proxy/project/version.properties | 3 - org.glite.lb.proxy/src/fake_write2rgma.c | 21 - org.glite.lb.proxy/src/lbproxy.c | 652 - org.glite.lb.proxy/src/perftest_proxy.sh | 128 - org.glite.lb.server-bones/.cvsignore | 1 - org.glite.lb.server-bones/Makefile | 81 - org.glite.lb.server-bones/build.xml | 117 - org.glite.lb.server-bones/examples/cnt_example.c | 179 - org.glite.lb.server-bones/examples/srv_example.c | 224 - org.glite.lb.server-bones/interface/srvbones.h | 92 - org.glite.lb.server-bones/project/build.number | 2 - org.glite.lb.server-bones/project/build.properties | 0 .../project/configure.properties.xml | 56 - org.glite.lb.server-bones/project/properties.xml | 62 - org.glite.lb.server-bones/project/tar_exclude | 10 - .../project/version.properties | 3 - org.glite.lb.server-bones/src/srvbones.c | 680 - org.glite.lbjp-utils.db/.cvsignore | 3 - org.glite.lbjp-utils.db/LICENSE | 69 - org.glite.lbjp-utils.db/Makefile | 137 - org.glite.lbjp-utils.db/examples/db_expire.c | 115 - org.glite.lbjp-utils.db/examples/db_test.c | 196 - org.glite.lbjp-utils.db/interface/db.h | 344 - org.glite.lbjp-utils.db/src/db.c | 1039 -- org.glite.lbjp-utils.jobid/.cvsignore | 2 - org.glite.lbjp-utils.jobid/LICENSE | 69 - org.glite.lbjp-utils.jobid/Makefile | 98 - org.glite.lbjp-utils.jobid/interface/Exception.h | 138 - org.glite.lbjp-utils.jobid/interface/JobId.h | 126 - .../interface/JobIdExceptions.h | 80 - org.glite.lbjp-utils.jobid/interface/cjobid.h | 109 - org.glite.lbjp-utils.jobid/interface/strmd5.h | 30 - org.glite.lbjp-utils.jobid/src/cjobid.c | 260 - org.glite.lbjp-utils.jobid/src/strmd5.c | 122 - org.glite.lbjp-utils.server-bones/.cvsignore | 1 - org.glite.lbjp-utils.server-bones/Makefile | 95 - .../examples/cnt_example.c | 179 - .../examples/srv_example.c | 224 - .../interface/srvbones.h | 92 - org.glite.lbjp-utils.server-bones/src/srvbones.c | 661 - org.glite.lbjp-utils.trio/.cvsignore | 1 - org.glite.lbjp-utils.trio/LICENSE | 69 - org.glite.lbjp-utils.trio/Makefile | 114 - org.glite.lbjp-utils.trio/interface/escape.h | 59 - org.glite.lbjp-utils.trio/interface/trio.h | 187 - org.glite.lbjp-utils.trio/src/escape.c | 224 - org.glite.lbjp-utils.trio/src/strio.c | 581 - org.glite.lbjp-utils.trio/src/strio.h | 227 - org.glite.lbjp-utils.trio/src/trio.c | 5706 ------- org.glite.lbjp-utils.trio/src/triop.h | 138 - org.glite.lbjp-utils.trio/test/trio_test.cpp | 85 - org.glite.myproxy-config/.cvsignore | 1 - org.glite.myproxy-config/Makefile | 35 - org.glite.myproxy-config/myproxy-config.spec | 50 - org.glite.myproxy-config/myproxy-initd | 173 - org.glite.px.emi-px/Makefile | 23 - org.glite.px.emi-px/configure | 1353 -- org.glite.px.emi-px/project/ChangeLog | 3 - org.glite.px.emi-px/project/package.description | 1 - org.glite.px.emi-px/project/package.summary | 1 - org.glite.px.emi-px/project/version.properties | 2 - org.glite.px.glite-PX/Makefile | 23 - org.glite.px.glite-PX/configure | 1353 -- org.glite.px.glite-PX/project/ChangeLog | 30 - org.glite.px.glite-PX/project/package.description | 1 - org.glite.px.glite-PX/project/package.summary | 1 - org.glite.px.glite-PX/project/version.properties | 2 - org.glite.px.myproxy-yaim/Makefile | 59 - .../config/defaults/glite-px.pre | 3 - .../config/functions/config_gip_px | 52 - .../config/functions/config_info_service_px | 88 - .../config/functions/config_proxy_server | 141 - .../config/functions/emi/config_info_service_px | 95 - .../config/man/myproxy-yaim.1 | 86 - .../config/node-info.d/emi/glite-px | 41 - .../config/node-info.d/glite-px | 45 - .../config/node-info.d/glite-px_30 | 48 - org.glite.px.myproxy-yaim/config/services/glite-px | 55 - org.glite.px.myproxy-yaim/configure | 1353 -- org.glite.px.myproxy-yaim/project/ChangeLog | 33 - .../project/package.description | 1 - org.glite.px.myproxy-yaim/project/package.summary | 1 - .../project/version.properties | 2 - org.glite.px.proxyrenewal/LICENSE | 15 - org.glite.px.proxyrenewal/Makefile | 204 - org.glite.px.proxyrenewal/config/startup | 97 - org.glite.px.proxyrenewal/configure | 1393 -- org.glite.px.proxyrenewal/examples/renew_core.c | 85 - org.glite.px.proxyrenewal/interface/renewal.h | 181 - org.glite.px.proxyrenewal/interface/renewal_core.h | 93 - org.glite.px.proxyrenewal/project/.post | 1 - org.glite.px.proxyrenewal/project/.postun | 1 - org.glite.px.proxyrenewal/project/ChangeLog | 38 - .../project/package.description | 1 - org.glite.px.proxyrenewal/project/package.summary | 1 - .../project/version.properties | 2 - org.glite.px.proxyrenewal/src/api.c | 568 - org.glite.px.proxyrenewal/src/client.c | 129 - org.glite.px.proxyrenewal/src/commands.c | 1345 -- org.glite.px.proxyrenewal/src/common.c | 340 - org.glite.px.proxyrenewal/src/glite-proxy-renew.1 | 85 - org.glite.px.proxyrenewal/src/glite-proxy-renewd.8 | 133 - org.glite.px.proxyrenewal/src/renew.c | 278 - org.glite.px.proxyrenewal/src/renewal_core.c | 352 - org.glite.px.proxyrenewal/src/renewal_locl.h | 166 - org.glite.px.proxyrenewal/src/renewd.c | 619 - org.glite.px.proxyrenewal/src/renewd_locl.h | 110 - org.glite.px.proxyrenewal/src/voms.c | 478 - org.glite.px/project/version.properties | 2 - org.glite.security.gsoap-plugin/LICENSE | 69 - org.glite.security.gsoap-plugin/Makefile | 338 - org.glite.security.gsoap-plugin/build.xml | 128 - org.glite.security.gsoap-plugin/configure | 975 -- org.glite.security.gsoap-plugin/examples/calc.h.S | 13 - .../examples/wscalc_clt_ex.c | 69 - .../examples/wscalc_srv_ex.c | 128 - .../examples/wscalc_srv_ex2.c | 167 - .../interface/glite_gscompat.h | 111 - .../interface/glite_gsplugin-int.h | 45 - .../interface/glite_gsplugin.h | 51 - org.glite.security.gsoap-plugin/project/ChangeLog | 45 - .../project/build.number | 1 - .../project/build.properties | 0 .../project/configure.properties.xml | 54 - .../project/libtoolhack/gcc | 1 - .../project/package.description | 1 - .../project/package.summary | 1 - .../project/properties.xml | 55 - .../project/tar_exclude | 10 - .../project/version.properties | 3 - .../src/glite_gsplugin.c | 594 - .../src/stdsoap2_2.6.2.c | 11020 -------------- .../src/stdsoap2_2.6.2.h | 1647 -- .../src/stdsoap2_2.7.0.c | 11692 --------------- .../src/stdsoap2_2.7.0.h | 1764 --- .../src/stdsoap2_2.7.0f.c | 12026 --------------- .../src/stdsoap2_2.7.0f.h | 1885 --- .../src/stdsoap2_2.7.10.c | 14890 ------------------- .../src/stdsoap2_2.7.10.h | 2281 --- .../src/stdsoap2_2.7.6b.c | 13101 ---------------- .../src/stdsoap2_2.7.6b.h | 2053 --- .../src/stdsoap2_2.7.6d.c | 13362 ----------------- .../src/stdsoap2_2.7.6d.h | 2075 --- .../src/stdsoap2_2.7.9b.c | 14172 ------------------ .../src/stdsoap2_2.7.9b.h | 2166 --- .../src/stdsoap2_2.7.9d.c | 14414 ------------------ .../src/stdsoap2_2.7.9d.h | 2184 --- .../test/test_gsplugin_cxx.cpp | 63 - org.glite.security.gss/LICENSE | 69 - org.glite.security.gss/Makefile | 170 - org.glite.security.gss/configure | 975 -- org.glite.security.gss/interface/glite_gss.h | 193 - org.glite.security.gss/project/ChangeLog | 39 - org.glite.security.gss/project/package.description | 1 - org.glite.security.gss/project/package.summary | 1 - org.glite.security.gss/project/version.properties | 3 - org.glite.security.gss/src/glite_gss.c | 1578 -- org.glite.security.gss/test/test_gss.cpp | 237 - org.glite.security.proxyrenewal/.cvsignore | 1 - org.glite.security.proxyrenewal/LICENSE | 69 - org.glite.security.proxyrenewal/Makefile | 167 - org.glite.security.proxyrenewal/build.xml | 128 - org.glite.security.proxyrenewal/config/startup | 80 - .../examples/renew_core.c | 63 - .../interface/renewal.h | 175 - .../interface/renewal_core.h | 62 - .../project/build.number | 1 - .../project/build.properties | 0 .../project/configure.properties.xml | 60 - .../project/properties.xml | 62 - .../project/tar_exclude | 10 - .../project/taskdefs.xml | 4 - .../project/version.properties | 2 - org.glite.security.proxyrenewal/src/api.c | 550 - org.glite.security.proxyrenewal/src/client.c | 111 - org.glite.security.proxyrenewal/src/commands.c | 1256 -- org.glite.security.proxyrenewal/src/common.c | 322 - org.glite.security.proxyrenewal/src/renew.c | 256 - org.glite.security.proxyrenewal/src/renewal_core.c | 283 - org.glite.security.proxyrenewal/src/renewal_locl.h | 148 - org.glite.security.proxyrenewal/src/renewd.c | 606 - org.glite.security.proxyrenewal/src/renewd_locl.h | 82 - org.glite.security.proxyrenewal/src/voms.c | 356 - org.glite.testsuites.ctb/LB/LB-certconfig | 10 - org.glite.testsuites.ctb/LB/LB-certtest.sh | 153 - org.glite.testsuites.ctb/LB/Makefile | 14 - org.glite.testsuites.ctb/LB/manual/Readme.txt | 147 - org.glite.testsuites.ctb/LB/manual/Readme2.txt.old | 158 - org.glite.testsuites.ctb/LB/tests/Makefile | 14 - org.glite.testsuites.ctb/LB/tests/lb-common.sh | 281 - org.glite.testsuites.ctb/LB/tests/lb-l2.sh | 280 - org.glite.testsuites.ctb/LB/tests/lb-l2ILR.sh | 278 - org.glite.testsuites.ctb/LB/tests/lb-l2Stat.sh | 239 - org.glite.testsuites.ctb/LB/tests/lb-run-tests.sh | 247 - .../LB/tests/lb-test-acl-authz.sh | 268 - org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh | 232 - .../LB/tests/lb-test-binaries.sh | 48 - .../LB/tests/lb-test-changeacl.sh | 228 - .../LB/tests/lb-test-event-delivery.sh | 343 - .../LB/tests/lb-test-harvester.sh | 220 - org.glite.testsuites.ctb/LB/tests/lb-test-https.sh | 271 - .../LB/tests/lb-test-il-recovery.sh | 224 - .../LB/tests/lb-test-job-registration.sh | 270 - .../LB/tests/lb-test-job-states.sh | 242 - .../LB/tests/lb-test-logevent.sh | 319 - .../LB/tests/lb-test-logger-local.sh | 151 - .../LB/tests/lb-test-logger-remote.sh | 137 - .../LB/tests/lb-test-notif-msg.sh | 223 - .../LB/tests/lb-test-notif-recovery.sh | 198 - .../LB/tests/lb-test-notif-stream.sh | 217 - .../LB/tests/lb-test-notif-switch.sh | 263 - org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh | 197 - .../LB/tests/lb-test-proxy-delivery.sh | 287 - org.glite.testsuites.ctb/LB/tests/lb-test-purge.pl | 310 - .../LB/tests/lb-test-sandbox-transfer.sh | 660 - .../LB/tests/lb-test-server-local.sh | 190 - .../LB/tests/lb-test-server-remote.sh | 156 - .../LB/tests/lb-test-statistics.sh | 335 - .../LB/tests/lb-test-switch-owner.sh | 205 - .../LB/tests/lb-test-threaded.sh | 188 - org.glite.testsuites.ctb/LB/tests/lb-test-wild.sh | 515 - org.glite.testsuites.ctb/LB/tests/lb-test-ws.sh | 250 - org.glite.testsuites.ctb/LB/tests/test-common.sh | 258 - org.glite.testsuites.ctb/LB/tests/testSocket.c | 73 - .../gridsite/tests/gridsite-common.sh | 180 - .../gridsite/tests/gridsite-test-all.sh | 384 - .../gridsite/tests/ping-local.sh | 120 - .../gridsite/tests/ping-remote.sh | 117 - .../gridsite/tests/test-common.sh | 258 - org.glite.wms-utils.exception/.cvsignore | 1 - org.glite.wms-utils.exception/LICENSE | 69 - org.glite.wms-utils.exception/Makefile.am | 67 - org.glite.wms-utils.exception/bootstrap | 28 - org.glite.wms-utils.exception/build.xml | 104 - org.glite.wms-utils.exception/configure.ac | 56 - .../interface/Makefile.am | 14 - .../interface/glite/wmsutils/exception/Exception.h | 138 - .../glite/wmsutils/exception/exception_codes.h | 41 - org.glite.wms-utils.exception/project/build.number | 2 - .../project/build.properties | 2 - .../project/configure.properties.xml | 9 - .../project/properties.xml | 83 - .../project/version.properties | 2 - org.glite.wms-utils.exception/src/Exception.cpp | 124 - org.glite.wms-utils.exception/src/Makefile.am | 17 - org.glite.wms-utils.exception/test/Makefile.am | 33 - .../test/exception_cu_main.cpp | 33 - .../test/exception_cu_suite.cpp | 56 - .../test/exception_cu_suite.h | 29 - org.glite.wms-utils.jobid/.cvsignore | 2 - org.glite.wms-utils.jobid/LICENSE | 69 - org.glite.wms-utils.jobid/Makefile.am | 69 - org.glite.wms-utils.jobid/bootstrap | 9 - org.glite.wms-utils.jobid/build.xml | 104 - org.glite.wms-utils.jobid/configure.ac | 147 - org.glite.wms-utils.jobid/examples/Makefile.am | 28 - org.glite.wms-utils.jobid/examples/testjobid.c | 33 - org.glite.wms-utils.jobid/interface/Makefile.am | 16 - .../interface/glite/wmsutils/jobid/JobId.h | 126 - .../glite/wmsutils/jobid/JobIdExceptions.h | 80 - .../interface/glite/wmsutils/jobid/cjobid.h | 109 - .../interface/glite/wmsutils/jobid/manipulation.h | 24 - org.glite.wms-utils.jobid/project/build.number | 2 - org.glite.wms-utils.jobid/project/build.properties | 2 - .../project/configure.properties.xml | 9 - org.glite.wms-utils.jobid/project/properties.xml | 86 - .../project/version.properties | 2 - org.glite.wms-utils.jobid/src/Makefile.am | 12 - org.glite.wms-utils.jobid/src/jobid/JobId.cpp | 183 - .../src/jobid/JobIdExceptions.cpp | 58 - org.glite.wms-utils.jobid/src/jobid/Makefile.am | 30 - org.glite.wms-utils.jobid/src/jobid/cjobid.c | 258 - .../src/jobid/manipulation.cpp | 180 - org.glite.wms-utils.jobid/src/jobid/strmd5.c | 118 - org.glite.wms-utils.jobid/src/jobid/strmd5.h | 28 - org.glite.wms-utils.jobid/test/Makefile.am | 48 - org.glite.wms-utils.jobid/test/jobid_cu_main.cpp | 33 - org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp | 102 - org.glite.wms-utils.jobid/test/jobid_cu_suite.h | 34 - .../test/manipulation_cu_main.cpp | 33 - .../test/manipulation_cu_suite.cpp | 34 - .../test/manipulation_cu_suite.h | 29 - org.glite.yaim.lb/.cvsignore | 1 - org.glite.yaim.lb/LICENSE | 69 - org.glite.yaim.lb/Makefile | 46 - org.glite.yaim.lb/config/defaults/glite-lb.pre | 3 - org.glite.yaim.lb/config/defaults/glite-lb_30.pre | 3 - org.glite.yaim.lb/config/functions/config_gip_lb | 14 - .../config/functions/config_gip_lb_30 | 44 - org.glite.yaim.lb/config/functions/config_glite_lb | 253 - .../config/functions/config_glite_lb_30 | 141 - .../config/functions/config_info_service_lb | 92 - org.glite.yaim.lb/config/functions/config_jobmon | 87 - org.glite.yaim.lb/config/node-info.d/glite-lb | 14 - org.glite.yaim.lb/config/node-info.d/glite-lb_30 | 15 - org.glite.yaim.lb/glite-yaim-lb.spec | 39 - org.glite.yaim.myproxy/.cvsignore | 1 - org.glite.yaim.myproxy/Changelog | 38 - org.glite.yaim.myproxy/LICENSE | 69 - org.glite.yaim.myproxy/Makefile | 47 - .../config/functions/config_gip_px | 52 - .../config/functions/config_info_service_px | 88 - .../config/functions/config_proxy_server | 132 - org.glite.yaim.myproxy/config/man/yaim-myproxy.1 | 86 - org.glite.yaim.myproxy/config/node-info.d/glite-px | 45 - .../config/node-info.d/glite-px_30 | 48 - org.glite.yaim.myproxy/config/services/glite-px | 55 - org.glite.yaim.myproxy/glite-yaim-myproxy.spec | 41 - org.gridsite.core/.cvsignore | 1 - org.gridsite.core/CHANGES | 484 - org.gridsite.core/INSTALL | 37 - org.gridsite.core/LICENSE | 47 - org.gridsite.core/README | 6 - org.gridsite.core/VERSION | 5 - org.gridsite.core/build.xml | 294 - org.gridsite.core/doc/README.htcp-bin | 13 - org.gridsite.core/doc/build-apache2.sh | 79 - org.gridsite.core/doc/delegation-1.1.0.wsdl | 459 - org.gridsite.core/doc/findproxyfile.1 | 63 - org.gridsite.core/doc/fuse.spec | 139 - org.gridsite.core/doc/gridsite-delegation.8 | 19 - org.gridsite.core/doc/gsexec.8 | 134 - org.gridsite.core/doc/gsoap-devel.spec | 52 - org.gridsite.core/doc/htcp.1 | 200 - org.gridsite.core/doc/htfind.1 | 1 - org.gridsite.core/doc/htll.1 | 1 - org.gridsite.core/doc/htls.1 | 1 - org.gridsite.core/doc/htmkdir.1 | 1 - org.gridsite.core/doc/htmv.1 | 1 - org.gridsite.core/doc/htping.1 | 1 - org.gridsite.core/doc/htproxydestroy.1 | 1 - org.gridsite.core/doc/htproxyinfo.1 | 1 - org.gridsite.core/doc/htproxyput.1 | 121 - org.gridsite.core/doc/htproxyrenew.1 | 1 - org.gridsite.core/doc/htproxytime.1 | 1 - org.gridsite.core/doc/htproxyunixtime.1 | 1 - org.gridsite.core/doc/htrm.1 | 1 - org.gridsite.core/doc/httpd-fileserver.conf | 155 - org.gridsite.core/doc/httpd-storage.conf | 220 - org.gridsite.core/doc/httpd-webserver.conf | 231 - org.gridsite.core/doc/index.html | 82 - org.gridsite.core/doc/mod_gridsite.8 | 356 - org.gridsite.core/doc/slashgrid.8 | 101 - org.gridsite.core/doc/urlencode.1 | 43 - org.gridsite.core/interface/gridsite-gacl.h | 188 - org.gridsite.core/interface/gridsite.h | 452 - org.gridsite.core/project/build.number | 2 - org.gridsite.core/project/build.properties | 0 org.gridsite.core/project/compat-1.5.patch | 89 - org.gridsite.core/project/configure.properties.xml | 9 - org.gridsite.core/project/dependencies.properties | 9 - org.gridsite.core/project/gridsite.core.csf.xml | 221 - org.gridsite.core/project/properties.xml | 53 - org.gridsite.core/project/taskdefs.xml | 31 - org.gridsite.core/project/version.properties | 2 - org.gridsite.core/src/Doxyfile | 993 -- org.gridsite.core/src/Makefile | 577 - org.gridsite.core/src/delegation.h | 86 - org.gridsite.core/src/doxygen.css | 49 - org.gridsite.core/src/doxyheader.html | 1 - org.gridsite.core/src/findproxyfile.c | 122 - org.gridsite.core/src/gaclexample.c | 145 - org.gridsite.core/src/gridsite-copy.c | 168 - org.gridsite.core/src/gridsite-storage.c | 269 - org.gridsite.core/src/grst-delegation.c | 337 - org.gridsite.core/src/grst_admin.h | 62 - org.gridsite.core/src/grst_admin_file.c | 1768 --- org.gridsite.core/src/grst_admin_gacl.c | 1034 -- org.gridsite.core/src/grst_admin_main.c | 391 - org.gridsite.core/src/grst_asn1.c | 508 - org.gridsite.core/src/grst_err.c | 40 - org.gridsite.core/src/grst_gacl.c | 1394 -- org.gridsite.core/src/grst_htcp.c | 311 - org.gridsite.core/src/grst_http.c | 475 - org.gridsite.core/src/grst_x509.c | 2640 ---- org.gridsite.core/src/grst_xacml.c | 566 - org.gridsite.core/src/gsexec.c | 1104 -- org.gridsite.core/src/gsexec.h | 126 - org.gridsite.core/src/htcp.c | 2069 --- org.gridsite.core/src/htproxyput.c | 678 - org.gridsite.core/src/make-gridsite-spec | 320 - org.gridsite.core/src/mod_gridsite.c | 4561 ------ org.gridsite.core/src/mod_gridsite_example.c | 262 - org.gridsite.core/src/mod_ssl-private.h | 211 - org.gridsite.core/src/roffit | 370 - org.gridsite.core/src/showx509exts.c | 134 - org.gridsite.core/src/slashgrid.c | 2734 ---- org.gridsite.core/src/slashgrid.init | 67 - org.gridsite.core/src/urlencode.c | 73 - org.gridsite.core/src/xacmlexample.c | 148 - 795 files changed, 259050 deletions(-) delete mode 100644 org.glite.deployment.jpis/build.xml delete mode 100755 org.glite.deployment.jpis/config/scripts/glite-jpis-config.py delete mode 100644 org.glite.deployment.jpis/config/templates/glite-jpis.cfg.xml delete mode 100644 org.glite.deployment.jpis/project/build.number delete mode 100644 org.glite.deployment.jpis/project/build.properties delete mode 100644 org.glite.deployment.jpis/project/glite-jp.sdf.xml.template delete mode 100644 org.glite.deployment.jpis/project/glite-jpis.sdf.xml.template delete mode 100644 org.glite.deployment.jpis/project/lxscript-rpm.xsl delete mode 100644 org.glite.deployment.jpis/project/lxscript-tgz.xsl delete mode 100644 org.glite.deployment.jpis/project/properties.xml delete mode 100644 org.glite.deployment.jpis/project/quattor-template.xsl delete mode 100644 org.glite.deployment.jpis/project/version.properties delete mode 100644 org.glite.deployment.jpps/build.xml delete mode 100755 org.glite.deployment.jpps/config/scripts/glite-jpps-config.py delete mode 100644 org.glite.deployment.jpps/config/templates/glite-jpps.cfg.xml delete mode 100644 org.glite.deployment.jpps/project/build.number delete mode 100644 org.glite.deployment.jpps/project/build.properties delete mode 100644 org.glite.deployment.jpps/project/glite-jpps.sdf.xml.template delete mode 100644 org.glite.deployment.jpps/project/lxscript-rpm.xsl delete mode 100644 org.glite.deployment.jpps/project/lxscript-tgz.xsl delete mode 100644 org.glite.deployment.jpps/project/properties.xml delete mode 100644 org.glite.deployment.jpps/project/quattor-template.xsl delete mode 100644 org.glite.deployment.jpps/project/version.properties delete mode 100644 org.glite.deployment.lb/.cvsignore delete mode 100644 org.glite.deployment.lb/CHANGELOG delete mode 100644 org.glite.deployment.lb/LICENSE delete mode 100644 org.glite.deployment.lb/build.xml delete mode 100644 org.glite.deployment.lb/config/scripts/glite-lb-config.py delete mode 100644 org.glite.deployment.lb/config/templates/glite-lb.cfg.xml delete mode 100644 org.glite.deployment.lb/doc/release_notes/release_notes.doc delete mode 100644 org.glite.deployment.lb/doc/release_notes/release_notes.html delete mode 100644 org.glite.deployment.lb/doc/release_notes/release_notes.pdf delete mode 100644 org.glite.deployment.lb/project/.cvsignore delete mode 100644 org.glite.deployment.lb/project/build.number delete mode 100644 org.glite.deployment.lb/project/build.properties delete mode 100644 org.glite.deployment.lb/project/glite-lb.sdf.xml.template delete mode 100644 org.glite.deployment.lb/project/lxscript-rpm.xsl delete mode 100644 org.glite.deployment.lb/project/lxscript-tgz.xsl delete mode 100644 org.glite.deployment.lb/project/properties.xml delete mode 100644 org.glite.deployment.lb/project/quattor-template.xsl delete mode 100644 org.glite.deployment.lb/project/version.properties delete mode 100644 org.glite.jp.client/.cvsignore delete mode 100644 org.glite.jp.client/Makefile delete mode 100755 org.glite.jp.client/build.xml delete mode 100755 org.glite.jp.client/config/startup delete mode 100755 org.glite.jp.client/configure delete mode 100644 org.glite.jp.client/doc/README.jpimporter delete mode 100644 org.glite.jp.client/examples/glite-jp-importer.sh delete mode 100644 org.glite.jp.client/examples/jpps_upload_files.c delete mode 100644 org.glite.jp.client/examples/mill_feed.c delete mode 100644 org.glite.jp.client/interface/jp_client.h delete mode 100644 org.glite.jp.client/interface/jpcl_ctx_int.h delete mode 100644 org.glite.jp.client/interface/jpimporter.h delete mode 100644 org.glite.jp.client/project/ChangeLog delete mode 100644 org.glite.jp.client/project/build.number delete mode 100644 org.glite.jp.client/project/build.properties delete mode 100644 org.glite.jp.client/project/configure.properties.xml delete mode 100755 org.glite.jp.client/project/properties.xml delete mode 100644 org.glite.jp.client/project/tar_exclude delete mode 100644 org.glite.jp.client/project/version.properties delete mode 100644 org.glite.jp.client/src/jpcl_ctx.c delete mode 100644 org.glite.jp.client/src/jpimp_lib.c delete mode 100644 org.glite.jp.client/src/jpimporter.c delete mode 100644 org.glite.jp.client/src/jptype_map.h delete mode 100644 org.glite.jp.client/src/typemap.dat delete mode 100644 org.glite.jp.common/.cvsignore delete mode 100644 org.glite.jp.common/Makefile delete mode 100755 org.glite.jp.common/build.xml delete mode 100644 org.glite.jp.common/interface/attr.h delete mode 100644 org.glite.jp.common/interface/backend.h delete mode 100644 org.glite.jp.common/interface/builtin_plugins.h delete mode 100644 org.glite.jp.common/interface/context.h delete mode 100644 org.glite.jp.common/interface/file_plugin.h delete mode 100644 org.glite.jp.common/interface/indexdb.h delete mode 100644 org.glite.jp.common/interface/known_attr.h delete mode 100644 org.glite.jp.common/interface/type_plugin.h delete mode 100644 org.glite.jp.common/interface/types.h delete mode 100644 org.glite.jp.common/project/build.number delete mode 100644 org.glite.jp.common/project/build.properties delete mode 100644 org.glite.jp.common/project/configure.properties.xml delete mode 100755 org.glite.jp.common/project/properties.xml delete mode 100644 org.glite.jp.common/project/tar_exclude delete mode 100644 org.glite.jp.common/project/version.properties delete mode 100644 org.glite.jp.common/src/attr.c delete mode 100644 org.glite.jp.common/src/context.c delete mode 100644 org.glite.jp.common/src/indexdb.c delete mode 100644 org.glite.jp.common/src/utils.c delete mode 100644 org.glite.jp.common/test/type_test.cpp delete mode 100644 org.glite.jp.doc/LICENSE delete mode 100644 org.glite.jp.doc/Makefile delete mode 100755 org.glite.jp.doc/configure delete mode 100644 org.glite.jp.doc/project/ChangeLog delete mode 100644 org.glite.jp.doc/project/version.properties delete mode 100644 org.glite.jp.doc/src/JPAG-Configuration.tex delete mode 100644 org.glite.jp.doc/src/JPAG-Installation.tex delete mode 100644 org.glite.jp.doc/src/JPAG-Introduction.tex delete mode 100644 org.glite.jp.doc/src/JPAG-Running.tex delete mode 100644 org.glite.jp.doc/src/JPAG-Testing.tex delete mode 100644 org.glite.jp.doc/src/JPAG-Troubleshooting.tex delete mode 100644 org.glite.jp.doc/src/JPAG.tex delete mode 100644 org.glite.jp.doc/src/JPDG-Introduction.tex delete mode 100644 org.glite.jp.doc/src/JPDG-WS.tex delete mode 100644 org.glite.jp.doc/src/JPDG.tex delete mode 100644 org.glite.jp.doc/src/JPUG-Introduction.tex delete mode 100644 org.glite.jp.doc/src/JPUG-Tools.tex delete mode 100644 org.glite.jp.doc/src/JPUG-UseCases.tex delete mode 100644 org.glite.jp.doc/src/JPUG.tex delete mode 100644 org.glite.jp.doc/src/LB-JP-interaction.tex delete mode 100644 org.glite.jp.doc/src/README delete mode 100644 org.glite.jp.doc/src/copyright.tex delete mode 100644 org.glite.jp.doc/src/definitions.tex delete mode 100644 org.glite.jp.doc/src/egee.cls delete mode 100644 org.glite.jp.doc/src/frontmatter.tex delete mode 100644 org.glite.jp.doc/src/glite-jpis-client.tex delete mode 100644 org.glite.jp.doc/src/glite_installation_guide_JP.doc delete mode 100644 org.glite.jp.doc/src/glite_installation_guide_LB.doc delete mode 100644 org.glite.jp.doc/src/gui.tex delete mode 100644 org.glite.jp.doc/src/images/JP-interactions.cdr delete mode 100644 org.glite.jp.doc/src/images/JP-interactions.pdf delete mode 100644 org.glite.jp.doc/src/images/JP-query.cdr delete mode 100644 org.glite.jp.doc/src/images/JP-query.pdf delete mode 100644 org.glite.jp.doc/src/images/LB-JP-interaction-details.cdr delete mode 100644 org.glite.jp.doc/src/images/LB-JP-interaction-details.pdf delete mode 100644 org.glite.jp.doc/src/images/LB-JP-interaction-drawing.pdf delete mode 100644 org.glite.jp.doc/src/images/egee.pdf delete mode 100644 org.glite.jp.doc/src/images/isi.pdf delete mode 100644 org.glite.jp.doc/src/jpimporter.tex delete mode 100644 org.glite.jp.doc/src/jpws.tex delete mode 100644 org.glite.jp.doc/src/lbjp.bib delete mode 100644 org.glite.jp.index/.cvsignore delete mode 100644 org.glite.jp.index/Makefile delete mode 100755 org.glite.jp.index/build.xml delete mode 100755 org.glite.jp.index/config/dbsetup.sh delete mode 100644 org.glite.jp.index/config/defaults/glite-jpis.pre delete mode 100644 org.glite.jp.index/config/functions/config_glite_jpis delete mode 100644 org.glite.jp.index/config/glite-jp-index-dbsetup.sql delete mode 100644 org.glite.jp.index/config/glite-jpis-config.xml delete mode 100644 org.glite.jp.index/config/glite-jpis-test-config.xml delete mode 100644 org.glite.jp.index/config/node-info.d/glite-jpis delete mode 100644 org.glite.jp.index/config/site-info.def.example delete mode 100755 org.glite.jp.index/config/startup delete mode 100755 org.glite.jp.index/configure delete mode 100644 org.glite.jp.index/doc/README delete mode 100644 org.glite.jp.index/doc/client_conf.xsd delete mode 100644 org.glite.jp.index/doc/glite-jp-indexd.sgml delete mode 100644 org.glite.jp.index/doc/glite-jpis-client.sgml delete mode 100644 org.glite.jp.index/doc/server_conf.xsd delete mode 100644 org.glite.jp.index/examples/jpis-client.c delete mode 100644 org.glite.jp.index/examples/jpis-db-internal.c delete mode 100644 org.glite.jp.index/examples/jpis-test.c delete mode 100644 org.glite.jp.index/examples/pch06/pch.pm delete mode 100644 org.glite.jp.index/examples/pch06/query1.pl delete mode 100644 org.glite.jp.index/examples/pch06/query2.pl delete mode 100644 org.glite.jp.index/examples/pch06/query3.pl delete mode 100644 org.glite.jp.index/examples/pch06/query4.pl delete mode 100644 org.glite.jp.index/examples/pch06/query5.pl delete mode 100644 org.glite.jp.index/examples/pch06/query6.pl delete mode 100644 org.glite.jp.index/examples/query-tests/authz.out delete mode 100644 org.glite.jp.index/examples/query-tests/complex_query.in delete mode 100644 org.glite.jp.index/examples/query-tests/complex_query.out delete mode 100644 org.glite.jp.index/examples/query-tests/dump1.sql delete mode 100644 org.glite.jp.index/examples/query-tests/exists_query.in delete mode 100644 org.glite.jp.index/examples/query-tests/exists_query.out delete mode 100644 org.glite.jp.index/examples/query-tests/jobid_query.in delete mode 100644 org.glite.jp.index/examples/query-tests/jobid_query.out delete mode 100644 org.glite.jp.index/examples/query-tests/origin_query.in delete mode 100644 org.glite.jp.index/examples/query-tests/origin_query.out delete mode 100755 org.glite.jp.index/examples/query-tests/run-test.sh delete mode 100644 org.glite.jp.index/examples/query-tests/simple_query.in delete mode 100644 org.glite.jp.index/examples/query-tests/simple_query.out delete mode 100644 org.glite.jp.index/examples/query-tests/within_query.in delete mode 100644 org.glite.jp.index/examples/query-tests/within_query.out delete mode 100644 org.glite.jp.index/interface/JobProvenanceISClient.xsd delete mode 100644 org.glite.jp.index/project/ChangeLog delete mode 100644 org.glite.jp.index/project/build.number delete mode 100644 org.glite.jp.index/project/build.properties delete mode 100644 org.glite.jp.index/project/configure.properties.xml delete mode 100755 org.glite.jp.index/project/properties.xml delete mode 100644 org.glite.jp.index/project/tar_exclude delete mode 100644 org.glite.jp.index/project/version.properties delete mode 100644 org.glite.jp.index/src/bones_server.c delete mode 100644 org.glite.jp.index/src/common.c delete mode 100644 org.glite.jp.index/src/common.h delete mode 100644 org.glite.jp.index/src/conf.c delete mode 100644 org.glite.jp.index/src/conf.h delete mode 100644 org.glite.jp.index/src/context.c delete mode 100644 org.glite.jp.index/src/context.h delete mode 100644 org.glite.jp.index/src/db_ops.c delete mode 100644 org.glite.jp.index/src/db_ops.h delete mode 100644 org.glite.jp.index/src/simple_server.c delete mode 100644 org.glite.jp.index/src/soap_ops.c delete mode 100644 org.glite.jp.index/src/soap_ps_calls.c delete mode 100644 org.glite.jp.index/src/soap_ps_calls.h delete mode 100644 org.glite.jp.index/src/type_plugin.c delete mode 100644 org.glite.jp.index/src/typemap.dat delete mode 100644 org.glite.jp.index/src/ws_is_typeref.c delete mode 100644 org.glite.jp.index/src/ws_is_typeref.h delete mode 100644 org.glite.jp.index/src/ws_ps_typeref.c delete mode 100644 org.glite.jp.index/src/ws_ps_typeref.h delete mode 100644 org.glite.jp.index/src/ws_typemap.h delete mode 100644 org.glite.jp.primary/.cvsignore delete mode 100644 org.glite.jp.primary/Makefile delete mode 100755 org.glite.jp.primary/build.xml delete mode 100644 org.glite.jp.primary/config/defaults/glite-jpps.pre delete mode 100644 org.glite.jp.primary/config/functions/config_glite_jpps delete mode 100644 org.glite.jp.primary/config/glite-jp-primary-dbsetup.sh delete mode 100644 org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql delete mode 100644 org.glite.jp.primary/config/gsi_authz.conf.example delete mode 100644 org.glite.jp.primary/config/node-info.d/glite-jpps delete mode 100755 org.glite.jp.primary/config/site-info.def.example delete mode 100644 org.glite.jp.primary/config/startup delete mode 100755 org.glite.jp.primary/configure delete mode 100644 org.glite.jp.primary/doc/README.install delete mode 100644 org.glite.jp.primary/examples/README.test delete mode 100644 org.glite.jp.primary/examples/dag-deps.c delete mode 100644 org.glite.jp.primary/examples/getjobattr.pl delete mode 100644 org.glite.jp.primary/examples/job_template delete mode 100644 org.glite.jp.primary/examples/jpps-test.c delete mode 100755 org.glite.jp.primary/examples/jpps_store_test delete mode 100755 org.glite.jp.primary/examples/recordmultitags.pl delete mode 100644 org.glite.jp.primary/examples/sample_job_aborted delete mode 100644 org.glite.jp.primary/examples/sample_job_cleared delete mode 100644 org.glite.jp.primary/examples/sample_job_tagged_done delete mode 100644 org.glite.jp.primary/examples/sample_job_waiting delete mode 100644 org.glite.jp.primary/project/ChangeLog delete mode 100644 org.glite.jp.primary/project/build.number delete mode 100644 org.glite.jp.primary/project/build.properties delete mode 100644 org.glite.jp.primary/project/configure.properties.xml delete mode 100755 org.glite.jp.primary/project/properties.xml delete mode 100644 org.glite.jp.primary/project/tar_exclude delete mode 100644 org.glite.jp.primary/project/version.properties delete mode 100644 org.glite.jp.primary/src/attrs.c delete mode 100644 org.glite.jp.primary/src/attrs.h delete mode 100644 org.glite.jp.primary/src/authz.c delete mode 100644 org.glite.jp.primary/src/authz.h delete mode 100644 org.glite.jp.primary/src/backend.h delete mode 100644 org.glite.jp.primary/src/backend_private.h delete mode 100644 org.glite.jp.primary/src/bones_server.c delete mode 100644 org.glite.jp.primary/src/classad_plugin.c delete mode 100644 org.glite.jp.primary/src/feed.c delete mode 100644 org.glite.jp.primary/src/feed.h delete mode 100644 org.glite.jp.primary/src/file_plugin.c delete mode 100644 org.glite.jp.primary/src/ftpd_auth.c delete mode 100644 org.glite.jp.primary/src/is_client.c delete mode 100644 org.glite.jp.primary/src/is_client.h delete mode 100644 org.glite.jp.primary/src/jp_callouts.c delete mode 100644 org.glite.jp.primary/src/jp_callouts.h delete mode 100644 org.glite.jp.primary/src/jptype_map.h delete mode 100755 org.glite.jp.primary/src/mk_soap_switch.pl delete mode 100644 org.glite.jp.primary/src/new_ftp_backend.c delete mode 100644 org.glite.jp.primary/src/sandbox_plugin.c delete mode 100644 org.glite.jp.primary/src/simple_server.c delete mode 100644 org.glite.jp.primary/src/soap_ops.c delete mode 100644 org.glite.jp.primary/src/soap_util.c delete mode 100644 org.glite.jp.primary/src/tags.c delete mode 100644 org.glite.jp.primary/src/tags.h delete mode 100644 org.glite.jp.primary/src/typemap.dat delete mode 100644 org.glite.jp.server-common/Makefile delete mode 100755 org.glite.jp.server-common/build.xml delete mode 100755 org.glite.jp.server-common/configure delete mode 100644 org.glite.jp.server-common/examples/db-test-int.c delete mode 100644 org.glite.jp.server-common/interface/db.h delete mode 100644 org.glite.jp.server-common/project/ChangeLog delete mode 100644 org.glite.jp.server-common/project/build.number delete mode 100644 org.glite.jp.server-common/project/configure.properties.xml delete mode 100755 org.glite.jp.server-common/project/properties.xml delete mode 100644 org.glite.jp.server-common/project/tar_exclude delete mode 100644 org.glite.jp.server-common/project/version.properties delete mode 100644 org.glite.jp.server-common/src/db.c delete mode 100755 org.glite.jp.ws-interface/.cvsignore delete mode 100755 org.glite.jp.ws-interface/LICENSE delete mode 100644 org.glite.jp.ws-interface/Makefile delete mode 100644 org.glite.jp.ws-interface/build.xml delete mode 100755 org.glite.jp.ws-interface/configure delete mode 100644 org.glite.jp.ws-interface/project/ChangeLog delete mode 100644 org.glite.jp.ws-interface/project/build.number delete mode 100755 org.glite.jp.ws-interface/project/build.properties delete mode 100644 org.glite.jp.ws-interface/project/configure.properties.xml delete mode 100644 org.glite.jp.ws-interface/project/properties.xml delete mode 100644 org.glite.jp.ws-interface/project/tar_exclude delete mode 100755 org.glite.jp.ws-interface/project/version.properties delete mode 100644 org.glite.jp.ws-interface/src/JobProvenanceIS.xml delete mode 100644 org.glite.jp.ws-interface/src/JobProvenancePS.xml delete mode 100644 org.glite.jp.ws-interface/src/JobProvenanceTypes.xml delete mode 100644 org.glite.jp.ws-interface/src/doc.xml delete mode 100755 org.glite.jp.ws-interface/src/jpdev.sh delete mode 100644 org.glite.jp.ws-interface/src/jpdev.xml.sh delete mode 100644 org.glite.jp.ws-interface/src/puke-schema.xsl delete mode 100644 org.glite.jp.ws-interface/src/puke-ug.xsl delete mode 100644 org.glite.jp.ws-interface/src/puke-wsdl.xsl delete mode 100644 org.glite.jp.ws-interface/src/ws_fault.c delete mode 100644 org.glite.jp/.cvsignore delete mode 100644 org.glite.jp/build.xml delete mode 100755 org.glite.jp/configure delete mode 100644 org.glite.jp/doc/README delete mode 100644 org.glite.jp/project/build.number delete mode 100644 org.glite.jp/project/build.properties delete mode 100644 org.glite.jp/project/dependencies.properties delete mode 100644 org.glite.jp/project/glite.jp.csf.xml delete mode 100755 org.glite.jp/project/properties.xml delete mode 100644 org.glite.jp/project/run-workspace delete mode 100755 org.glite.jp/project/taskdefs.xml delete mode 100644 org.glite.jp/project/version.properties delete mode 100755 org.glite.lb-utils.context/.cvsignore delete mode 100755 org.glite.lb-utils.context/LICENSE delete mode 100644 org.glite.lb-utils.context/build.xml delete mode 100644 org.glite.lb-utils.context/project/build.number delete mode 100755 org.glite.lb-utils.context/project/build.properties delete mode 100644 org.glite.lb-utils.context/project/configure.properties.xml delete mode 100644 org.glite.lb-utils.context/project/properties.xml delete mode 100755 org.glite.lb-utils.context/project/version.properties delete mode 100755 org.glite.lb-utils.db/.cvsignore delete mode 100755 org.glite.lb-utils.db/LICENSE delete mode 100644 org.glite.lb-utils.db/Makefile delete mode 100644 org.glite.lb-utils.db/build.xml delete mode 100644 org.glite.lb-utils.db/examples/db_expire.c delete mode 100644 org.glite.lb-utils.db/examples/db_test.c delete mode 100644 org.glite.lb-utils.db/interface/db.h delete mode 100644 org.glite.lb-utils.db/project/build.number delete mode 100755 org.glite.lb-utils.db/project/build.properties delete mode 100644 org.glite.lb-utils.db/project/configure.properties.xml delete mode 100644 org.glite.lb-utils.db/project/properties.xml delete mode 100644 org.glite.lb-utils.db/project/tar_exclude delete mode 100755 org.glite.lb-utils.db/project/version.properties delete mode 100644 org.glite.lb-utils.db/src/db.c delete mode 100755 org.glite.lb-utils.jobid/.cvsignore delete mode 100755 org.glite.lb-utils.jobid/LICENSE delete mode 100644 org.glite.lb-utils.jobid/Makefile delete mode 100644 org.glite.lb-utils.jobid/build.xml delete mode 100644 org.glite.lb-utils.jobid/interface/Exception.h delete mode 100644 org.glite.lb-utils.jobid/interface/JobId.h delete mode 100644 org.glite.lb-utils.jobid/interface/JobIdExceptions.h delete mode 100755 org.glite.lb-utils.jobid/interface/cjobid.h delete mode 100755 org.glite.lb-utils.jobid/interface/strmd5.h delete mode 100644 org.glite.lb-utils.jobid/project/build.number delete mode 100755 org.glite.lb-utils.jobid/project/build.properties delete mode 100644 org.glite.lb-utils.jobid/project/configure.properties.xml delete mode 100644 org.glite.lb-utils.jobid/project/properties.xml delete mode 100644 org.glite.lb-utils.jobid/project/tar_exclude delete mode 100755 org.glite.lb-utils.jobid/project/version.properties delete mode 100755 org.glite.lb-utils.jobid/src/cjobid.c delete mode 100755 org.glite.lb-utils.jobid/src/strmd5.c delete mode 100755 org.glite.lb-utils.server-bones/.cvsignore delete mode 100755 org.glite.lb-utils.server-bones/LICENSE delete mode 100644 org.glite.lb-utils.server-bones/build.xml delete mode 100644 org.glite.lb-utils.server-bones/project/build.number delete mode 100755 org.glite.lb-utils.server-bones/project/build.properties delete mode 100644 org.glite.lb-utils.server-bones/project/configure.properties.xml delete mode 100644 org.glite.lb-utils.server-bones/project/properties.xml delete mode 100755 org.glite.lb-utils.server-bones/project/version.properties delete mode 100755 org.glite.lb-utils.trio/.cvsignore delete mode 100755 org.glite.lb-utils.trio/LICENSE delete mode 100644 org.glite.lb-utils.trio/Makefile delete mode 100644 org.glite.lb-utils.trio/build.xml delete mode 100644 org.glite.lb-utils.trio/interface/escape.h delete mode 100644 org.glite.lb-utils.trio/interface/trio.h delete mode 100644 org.glite.lb-utils.trio/project/build.number delete mode 100755 org.glite.lb-utils.trio/project/build.properties delete mode 100644 org.glite.lb-utils.trio/project/configure.properties.xml delete mode 100644 org.glite.lb-utils.trio/project/properties.xml delete mode 100755 org.glite.lb-utils.trio/project/version.properties delete mode 100644 org.glite.lb-utils.trio/src/escape.c delete mode 100644 org.glite.lb-utils.trio/src/strio.c delete mode 100644 org.glite.lb-utils.trio/src/strio.h delete mode 100644 org.glite.lb-utils.trio/src/trio.c delete mode 100644 org.glite.lb-utils.trio/src/triop.h delete mode 100644 org.glite.lb-utils.trio/test/trio_test.cpp delete mode 100644 org.glite.lb-utils/.cvsignore delete mode 100755 org.glite.lb-utils/LICENSE delete mode 100644 org.glite.lb-utils/build.xml delete mode 100644 org.glite.lb-utils/project/build.number delete mode 100755 org.glite.lb-utils/project/build.properties delete mode 100644 org.glite.lb-utils/project/dependencies.properties delete mode 100644 org.glite.lb-utils/project/glite.lb-utils.csf.xml delete mode 100644 org.glite.lb-utils/project/properties.xml delete mode 100644 org.glite.lb-utils/project/taskdefs.xml delete mode 100755 org.glite.lb-utils/project/version.properties delete mode 100644 org.glite.lb.client-interface/.cvsignore delete mode 100644 org.glite.lb.client-interface/IMPORTANT-README delete mode 100644 org.glite.lb.client-interface/LICENSE delete mode 100644 org.glite.lb.client-interface/Makefile delete mode 100755 org.glite.lb.client-interface/build.xml delete mode 100644 org.glite.lb.client-interface/project/build.number delete mode 100644 org.glite.lb.client-interface/project/build.properties delete mode 100644 org.glite.lb.client-interface/project/configure.properties.xml delete mode 100755 org.glite.lb.client-interface/project/properties.xml delete mode 100644 org.glite.lb.client-interface/project/tar_exclude delete mode 100644 org.glite.lb.client-interface/project/version.properties delete mode 100644 org.glite.lb.proxy/.cvsignore delete mode 100644 org.glite.lb.proxy/LICENSE delete mode 100644 org.glite.lb.proxy/Makefile delete mode 100755 org.glite.lb.proxy/build.xml delete mode 100644 org.glite.lb.proxy/config/glite-lb-dbsetup-proxy.sql delete mode 100755 org.glite.lb.proxy/config/startup delete mode 100644 org.glite.lb.proxy/doc/README delete mode 100644 org.glite.lb.proxy/doc/README.deploy delete mode 100755 org.glite.lb.proxy/examples/test.sh delete mode 100644 org.glite.lb.proxy/examples/test1.sh delete mode 100644 org.glite.lb.proxy/examples/test2.sh delete mode 100755 org.glite.lb.proxy/examples/test3.sh delete mode 100644 org.glite.lb.proxy/project/build.number delete mode 100644 org.glite.lb.proxy/project/build.properties delete mode 100644 org.glite.lb.proxy/project/configure.properties.xml delete mode 100755 org.glite.lb.proxy/project/properties.xml delete mode 100644 org.glite.lb.proxy/project/tar_exclude delete mode 100644 org.glite.lb.proxy/project/version.properties delete mode 100755 org.glite.lb.proxy/src/fake_write2rgma.c delete mode 100644 org.glite.lb.proxy/src/lbproxy.c delete mode 100755 org.glite.lb.proxy/src/perftest_proxy.sh delete mode 100644 org.glite.lb.server-bones/.cvsignore delete mode 100644 org.glite.lb.server-bones/Makefile delete mode 100755 org.glite.lb.server-bones/build.xml delete mode 100644 org.glite.lb.server-bones/examples/cnt_example.c delete mode 100644 org.glite.lb.server-bones/examples/srv_example.c delete mode 100644 org.glite.lb.server-bones/interface/srvbones.h delete mode 100644 org.glite.lb.server-bones/project/build.number delete mode 100644 org.glite.lb.server-bones/project/build.properties delete mode 100644 org.glite.lb.server-bones/project/configure.properties.xml delete mode 100755 org.glite.lb.server-bones/project/properties.xml delete mode 100644 org.glite.lb.server-bones/project/tar_exclude delete mode 100644 org.glite.lb.server-bones/project/version.properties delete mode 100644 org.glite.lb.server-bones/src/srvbones.c delete mode 100644 org.glite.lbjp-utils.db/.cvsignore delete mode 100644 org.glite.lbjp-utils.db/LICENSE delete mode 100644 org.glite.lbjp-utils.db/Makefile delete mode 100644 org.glite.lbjp-utils.db/examples/db_expire.c delete mode 100644 org.glite.lbjp-utils.db/examples/db_test.c delete mode 100644 org.glite.lbjp-utils.db/interface/db.h delete mode 100644 org.glite.lbjp-utils.db/src/db.c delete mode 100644 org.glite.lbjp-utils.jobid/.cvsignore delete mode 100644 org.glite.lbjp-utils.jobid/LICENSE delete mode 100644 org.glite.lbjp-utils.jobid/Makefile delete mode 100644 org.glite.lbjp-utils.jobid/interface/Exception.h delete mode 100644 org.glite.lbjp-utils.jobid/interface/JobId.h delete mode 100644 org.glite.lbjp-utils.jobid/interface/JobIdExceptions.h delete mode 100644 org.glite.lbjp-utils.jobid/interface/cjobid.h delete mode 100644 org.glite.lbjp-utils.jobid/interface/strmd5.h delete mode 100644 org.glite.lbjp-utils.jobid/src/cjobid.c delete mode 100644 org.glite.lbjp-utils.jobid/src/strmd5.c delete mode 100644 org.glite.lbjp-utils.server-bones/.cvsignore delete mode 100644 org.glite.lbjp-utils.server-bones/Makefile delete mode 100644 org.glite.lbjp-utils.server-bones/examples/cnt_example.c delete mode 100644 org.glite.lbjp-utils.server-bones/examples/srv_example.c delete mode 100644 org.glite.lbjp-utils.server-bones/interface/srvbones.h delete mode 100644 org.glite.lbjp-utils.server-bones/src/srvbones.c delete mode 100644 org.glite.lbjp-utils.trio/.cvsignore delete mode 100644 org.glite.lbjp-utils.trio/LICENSE delete mode 100644 org.glite.lbjp-utils.trio/Makefile delete mode 100644 org.glite.lbjp-utils.trio/interface/escape.h delete mode 100644 org.glite.lbjp-utils.trio/interface/trio.h delete mode 100644 org.glite.lbjp-utils.trio/src/escape.c delete mode 100644 org.glite.lbjp-utils.trio/src/strio.c delete mode 100644 org.glite.lbjp-utils.trio/src/strio.h delete mode 100644 org.glite.lbjp-utils.trio/src/trio.c delete mode 100644 org.glite.lbjp-utils.trio/src/triop.h delete mode 100644 org.glite.lbjp-utils.trio/test/trio_test.cpp delete mode 100644 org.glite.myproxy-config/.cvsignore delete mode 100644 org.glite.myproxy-config/Makefile delete mode 100644 org.glite.myproxy-config/myproxy-config.spec delete mode 100644 org.glite.myproxy-config/myproxy-initd delete mode 100644 org.glite.px.emi-px/Makefile delete mode 100755 org.glite.px.emi-px/configure delete mode 100644 org.glite.px.emi-px/project/ChangeLog delete mode 100644 org.glite.px.emi-px/project/package.description delete mode 100644 org.glite.px.emi-px/project/package.summary delete mode 100644 org.glite.px.emi-px/project/version.properties delete mode 100644 org.glite.px.glite-PX/Makefile delete mode 100755 org.glite.px.glite-PX/configure delete mode 100644 org.glite.px.glite-PX/project/ChangeLog delete mode 100644 org.glite.px.glite-PX/project/package.description delete mode 100644 org.glite.px.glite-PX/project/package.summary delete mode 100644 org.glite.px.glite-PX/project/version.properties delete mode 100644 org.glite.px.myproxy-yaim/Makefile delete mode 100644 org.glite.px.myproxy-yaim/config/defaults/glite-px.pre delete mode 100755 org.glite.px.myproxy-yaim/config/functions/config_gip_px delete mode 100644 org.glite.px.myproxy-yaim/config/functions/config_info_service_px delete mode 100644 org.glite.px.myproxy-yaim/config/functions/config_proxy_server delete mode 100644 org.glite.px.myproxy-yaim/config/functions/emi/config_info_service_px delete mode 100644 org.glite.px.myproxy-yaim/config/man/myproxy-yaim.1 delete mode 100644 org.glite.px.myproxy-yaim/config/node-info.d/emi/glite-px delete mode 100644 org.glite.px.myproxy-yaim/config/node-info.d/glite-px delete mode 100644 org.glite.px.myproxy-yaim/config/node-info.d/glite-px_30 delete mode 100644 org.glite.px.myproxy-yaim/config/services/glite-px delete mode 100755 org.glite.px.myproxy-yaim/configure delete mode 100644 org.glite.px.myproxy-yaim/project/ChangeLog delete mode 100644 org.glite.px.myproxy-yaim/project/package.description delete mode 100644 org.glite.px.myproxy-yaim/project/package.summary delete mode 100644 org.glite.px.myproxy-yaim/project/version.properties delete mode 100644 org.glite.px.proxyrenewal/LICENSE delete mode 100644 org.glite.px.proxyrenewal/Makefile delete mode 100755 org.glite.px.proxyrenewal/config/startup delete mode 100755 org.glite.px.proxyrenewal/configure delete mode 100644 org.glite.px.proxyrenewal/examples/renew_core.c delete mode 100644 org.glite.px.proxyrenewal/interface/renewal.h delete mode 100644 org.glite.px.proxyrenewal/interface/renewal_core.h delete mode 100644 org.glite.px.proxyrenewal/project/.post delete mode 100644 org.glite.px.proxyrenewal/project/.postun delete mode 100644 org.glite.px.proxyrenewal/project/ChangeLog delete mode 100644 org.glite.px.proxyrenewal/project/package.description delete mode 100644 org.glite.px.proxyrenewal/project/package.summary delete mode 100644 org.glite.px.proxyrenewal/project/version.properties delete mode 100644 org.glite.px.proxyrenewal/src/api.c delete mode 100644 org.glite.px.proxyrenewal/src/client.c delete mode 100644 org.glite.px.proxyrenewal/src/commands.c delete mode 100644 org.glite.px.proxyrenewal/src/common.c delete mode 100644 org.glite.px.proxyrenewal/src/glite-proxy-renew.1 delete mode 100644 org.glite.px.proxyrenewal/src/glite-proxy-renewd.8 delete mode 100644 org.glite.px.proxyrenewal/src/renew.c delete mode 100644 org.glite.px.proxyrenewal/src/renewal_core.c delete mode 100644 org.glite.px.proxyrenewal/src/renewal_locl.h delete mode 100644 org.glite.px.proxyrenewal/src/renewd.c delete mode 100644 org.glite.px.proxyrenewal/src/renewd_locl.h delete mode 100644 org.glite.px.proxyrenewal/src/voms.c delete mode 100644 org.glite.px/project/version.properties delete mode 100644 org.glite.security.gsoap-plugin/LICENSE delete mode 100644 org.glite.security.gsoap-plugin/Makefile delete mode 100755 org.glite.security.gsoap-plugin/build.xml delete mode 100755 org.glite.security.gsoap-plugin/configure delete mode 100644 org.glite.security.gsoap-plugin/examples/calc.h.S delete mode 100644 org.glite.security.gsoap-plugin/examples/wscalc_clt_ex.c delete mode 100644 org.glite.security.gsoap-plugin/examples/wscalc_srv_ex.c delete mode 100644 org.glite.security.gsoap-plugin/examples/wscalc_srv_ex2.c delete mode 100644 org.glite.security.gsoap-plugin/interface/glite_gscompat.h delete mode 100644 org.glite.security.gsoap-plugin/interface/glite_gsplugin-int.h delete mode 100644 org.glite.security.gsoap-plugin/interface/glite_gsplugin.h delete mode 100644 org.glite.security.gsoap-plugin/project/ChangeLog delete mode 100644 org.glite.security.gsoap-plugin/project/build.number delete mode 100644 org.glite.security.gsoap-plugin/project/build.properties delete mode 100644 org.glite.security.gsoap-plugin/project/configure.properties.xml delete mode 100644 org.glite.security.gsoap-plugin/project/libtoolhack/gcc delete mode 100644 org.glite.security.gsoap-plugin/project/package.description delete mode 100644 org.glite.security.gsoap-plugin/project/package.summary delete mode 100755 org.glite.security.gsoap-plugin/project/properties.xml delete mode 100644 org.glite.security.gsoap-plugin/project/tar_exclude delete mode 100644 org.glite.security.gsoap-plugin/project/version.properties delete mode 100644 org.glite.security.gsoap-plugin/src/glite_gsplugin.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.h delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.c delete mode 100644 org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.h delete mode 100644 org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp delete mode 100644 org.glite.security.gss/LICENSE delete mode 100644 org.glite.security.gss/Makefile delete mode 100755 org.glite.security.gss/configure delete mode 100644 org.glite.security.gss/interface/glite_gss.h delete mode 100644 org.glite.security.gss/project/ChangeLog delete mode 100644 org.glite.security.gss/project/package.description delete mode 100644 org.glite.security.gss/project/package.summary delete mode 100644 org.glite.security.gss/project/version.properties delete mode 100644 org.glite.security.gss/src/glite_gss.c delete mode 100644 org.glite.security.gss/test/test_gss.cpp delete mode 100644 org.glite.security.proxyrenewal/.cvsignore delete mode 100644 org.glite.security.proxyrenewal/LICENSE delete mode 100644 org.glite.security.proxyrenewal/Makefile delete mode 100755 org.glite.security.proxyrenewal/build.xml delete mode 100755 org.glite.security.proxyrenewal/config/startup delete mode 100644 org.glite.security.proxyrenewal/examples/renew_core.c delete mode 100644 org.glite.security.proxyrenewal/interface/renewal.h delete mode 100644 org.glite.security.proxyrenewal/interface/renewal_core.h delete mode 100644 org.glite.security.proxyrenewal/project/build.number delete mode 100644 org.glite.security.proxyrenewal/project/build.properties delete mode 100644 org.glite.security.proxyrenewal/project/configure.properties.xml delete mode 100755 org.glite.security.proxyrenewal/project/properties.xml delete mode 100644 org.glite.security.proxyrenewal/project/tar_exclude delete mode 100755 org.glite.security.proxyrenewal/project/taskdefs.xml delete mode 100644 org.glite.security.proxyrenewal/project/version.properties delete mode 100644 org.glite.security.proxyrenewal/src/api.c delete mode 100644 org.glite.security.proxyrenewal/src/client.c delete mode 100644 org.glite.security.proxyrenewal/src/commands.c delete mode 100644 org.glite.security.proxyrenewal/src/common.c delete mode 100644 org.glite.security.proxyrenewal/src/renew.c delete mode 100644 org.glite.security.proxyrenewal/src/renewal_core.c delete mode 100644 org.glite.security.proxyrenewal/src/renewal_locl.h delete mode 100644 org.glite.security.proxyrenewal/src/renewd.c delete mode 100644 org.glite.security.proxyrenewal/src/renewd_locl.h delete mode 100644 org.glite.security.proxyrenewal/src/voms.c delete mode 100644 org.glite.testsuites.ctb/LB/LB-certconfig delete mode 100755 org.glite.testsuites.ctb/LB/LB-certtest.sh delete mode 100644 org.glite.testsuites.ctb/LB/Makefile delete mode 100644 org.glite.testsuites.ctb/LB/manual/Readme.txt delete mode 100644 org.glite.testsuites.ctb/LB/manual/Readme2.txt.old delete mode 100644 org.glite.testsuites.ctb/LB/tests/Makefile delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-common.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-l2.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-l2ILR.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-l2Stat.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-run-tests.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-acl-authz.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-binaries.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-changeacl.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-event-delivery.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-harvester.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-https.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-job-states.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-logevent.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-logger-local.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-logger-remote.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-notif-msg.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-proxy-delivery.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-purge.pl delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-sandbox-transfer.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-server-local.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-server-remote.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-statistics.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-switch-owner.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-threaded.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-wild.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/lb-test-ws.sh delete mode 100644 org.glite.testsuites.ctb/LB/tests/test-common.sh delete mode 100755 org.glite.testsuites.ctb/LB/tests/testSocket.c delete mode 100755 org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh delete mode 100755 org.glite.testsuites.ctb/gridsite/tests/gridsite-test-all.sh delete mode 100755 org.glite.testsuites.ctb/gridsite/tests/ping-local.sh delete mode 100755 org.glite.testsuites.ctb/gridsite/tests/ping-remote.sh delete mode 100644 org.glite.testsuites.ctb/gridsite/tests/test-common.sh delete mode 100644 org.glite.wms-utils.exception/.cvsignore delete mode 100755 org.glite.wms-utils.exception/LICENSE delete mode 100755 org.glite.wms-utils.exception/Makefile.am delete mode 100755 org.glite.wms-utils.exception/bootstrap delete mode 100755 org.glite.wms-utils.exception/build.xml delete mode 100755 org.glite.wms-utils.exception/configure.ac delete mode 100755 org.glite.wms-utils.exception/interface/Makefile.am delete mode 100644 org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h delete mode 100755 org.glite.wms-utils.exception/interface/glite/wmsutils/exception/exception_codes.h delete mode 100644 org.glite.wms-utils.exception/project/build.number delete mode 100755 org.glite.wms-utils.exception/project/build.properties delete mode 100644 org.glite.wms-utils.exception/project/configure.properties.xml delete mode 100755 org.glite.wms-utils.exception/project/properties.xml delete mode 100755 org.glite.wms-utils.exception/project/version.properties delete mode 100644 org.glite.wms-utils.exception/src/Exception.cpp delete mode 100755 org.glite.wms-utils.exception/src/Makefile.am delete mode 100755 org.glite.wms-utils.exception/test/Makefile.am delete mode 100644 org.glite.wms-utils.exception/test/exception_cu_main.cpp delete mode 100644 org.glite.wms-utils.exception/test/exception_cu_suite.cpp delete mode 100644 org.glite.wms-utils.exception/test/exception_cu_suite.h delete mode 100755 org.glite.wms-utils.jobid/.cvsignore delete mode 100755 org.glite.wms-utils.jobid/LICENSE delete mode 100755 org.glite.wms-utils.jobid/Makefile.am delete mode 100755 org.glite.wms-utils.jobid/bootstrap delete mode 100755 org.glite.wms-utils.jobid/build.xml delete mode 100755 org.glite.wms-utils.jobid/configure.ac delete mode 100755 org.glite.wms-utils.jobid/examples/Makefile.am delete mode 100755 org.glite.wms-utils.jobid/examples/testjobid.c delete mode 100755 org.glite.wms-utils.jobid/interface/Makefile.am delete mode 100755 org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h delete mode 100755 org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobIdExceptions.h delete mode 100755 org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/cjobid.h delete mode 100755 org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/manipulation.h delete mode 100644 org.glite.wms-utils.jobid/project/build.number delete mode 100755 org.glite.wms-utils.jobid/project/build.properties delete mode 100644 org.glite.wms-utils.jobid/project/configure.properties.xml delete mode 100755 org.glite.wms-utils.jobid/project/properties.xml delete mode 100755 org.glite.wms-utils.jobid/project/version.properties delete mode 100755 org.glite.wms-utils.jobid/src/Makefile.am delete mode 100755 org.glite.wms-utils.jobid/src/jobid/JobId.cpp delete mode 100755 org.glite.wms-utils.jobid/src/jobid/JobIdExceptions.cpp delete mode 100755 org.glite.wms-utils.jobid/src/jobid/Makefile.am delete mode 100755 org.glite.wms-utils.jobid/src/jobid/cjobid.c delete mode 100755 org.glite.wms-utils.jobid/src/jobid/manipulation.cpp delete mode 100755 org.glite.wms-utils.jobid/src/jobid/strmd5.c delete mode 100755 org.glite.wms-utils.jobid/src/jobid/strmd5.h delete mode 100755 org.glite.wms-utils.jobid/test/Makefile.am delete mode 100644 org.glite.wms-utils.jobid/test/jobid_cu_main.cpp delete mode 100644 org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp delete mode 100644 org.glite.wms-utils.jobid/test/jobid_cu_suite.h delete mode 100644 org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp delete mode 100644 org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp delete mode 100644 org.glite.wms-utils.jobid/test/manipulation_cu_suite.h delete mode 100644 org.glite.yaim.lb/.cvsignore delete mode 100755 org.glite.yaim.lb/LICENSE delete mode 100644 org.glite.yaim.lb/Makefile delete mode 100644 org.glite.yaim.lb/config/defaults/glite-lb.pre delete mode 100644 org.glite.yaim.lb/config/defaults/glite-lb_30.pre delete mode 100644 org.glite.yaim.lb/config/functions/config_gip_lb delete mode 100644 org.glite.yaim.lb/config/functions/config_gip_lb_30 delete mode 100644 org.glite.yaim.lb/config/functions/config_glite_lb delete mode 100644 org.glite.yaim.lb/config/functions/config_glite_lb_30 delete mode 100644 org.glite.yaim.lb/config/functions/config_info_service_lb delete mode 100644 org.glite.yaim.lb/config/functions/config_jobmon delete mode 100644 org.glite.yaim.lb/config/node-info.d/glite-lb delete mode 100644 org.glite.yaim.lb/config/node-info.d/glite-lb_30 delete mode 100644 org.glite.yaim.lb/glite-yaim-lb.spec delete mode 100644 org.glite.yaim.myproxy/.cvsignore delete mode 100644 org.glite.yaim.myproxy/Changelog delete mode 100755 org.glite.yaim.myproxy/LICENSE delete mode 100644 org.glite.yaim.myproxy/Makefile delete mode 100755 org.glite.yaim.myproxy/config/functions/config_gip_px delete mode 100644 org.glite.yaim.myproxy/config/functions/config_info_service_px delete mode 100644 org.glite.yaim.myproxy/config/functions/config_proxy_server delete mode 100644 org.glite.yaim.myproxy/config/man/yaim-myproxy.1 delete mode 100644 org.glite.yaim.myproxy/config/node-info.d/glite-px delete mode 100644 org.glite.yaim.myproxy/config/node-info.d/glite-px_30 delete mode 100644 org.glite.yaim.myproxy/config/services/glite-px delete mode 100644 org.glite.yaim.myproxy/glite-yaim-myproxy.spec delete mode 100644 org.gridsite.core/.cvsignore delete mode 100644 org.gridsite.core/CHANGES delete mode 100644 org.gridsite.core/INSTALL delete mode 100644 org.gridsite.core/LICENSE delete mode 100644 org.gridsite.core/README delete mode 100644 org.gridsite.core/VERSION delete mode 100644 org.gridsite.core/build.xml delete mode 100644 org.gridsite.core/doc/README.htcp-bin delete mode 100644 org.gridsite.core/doc/build-apache2.sh delete mode 100644 org.gridsite.core/doc/delegation-1.1.0.wsdl delete mode 100644 org.gridsite.core/doc/findproxyfile.1 delete mode 100644 org.gridsite.core/doc/fuse.spec delete mode 100644 org.gridsite.core/doc/gridsite-delegation.8 delete mode 100644 org.gridsite.core/doc/gsexec.8 delete mode 100644 org.gridsite.core/doc/gsoap-devel.spec delete mode 100644 org.gridsite.core/doc/htcp.1 delete mode 100644 org.gridsite.core/doc/htfind.1 delete mode 100644 org.gridsite.core/doc/htll.1 delete mode 100644 org.gridsite.core/doc/htls.1 delete mode 100644 org.gridsite.core/doc/htmkdir.1 delete mode 100644 org.gridsite.core/doc/htmv.1 delete mode 100644 org.gridsite.core/doc/htping.1 delete mode 100644 org.gridsite.core/doc/htproxydestroy.1 delete mode 100644 org.gridsite.core/doc/htproxyinfo.1 delete mode 100644 org.gridsite.core/doc/htproxyput.1 delete mode 100644 org.gridsite.core/doc/htproxyrenew.1 delete mode 100644 org.gridsite.core/doc/htproxytime.1 delete mode 100644 org.gridsite.core/doc/htproxyunixtime.1 delete mode 100644 org.gridsite.core/doc/htrm.1 delete mode 100644 org.gridsite.core/doc/httpd-fileserver.conf delete mode 100644 org.gridsite.core/doc/httpd-storage.conf delete mode 100644 org.gridsite.core/doc/httpd-webserver.conf delete mode 100644 org.gridsite.core/doc/index.html delete mode 100644 org.gridsite.core/doc/mod_gridsite.8 delete mode 100644 org.gridsite.core/doc/slashgrid.8 delete mode 100644 org.gridsite.core/doc/urlencode.1 delete mode 100644 org.gridsite.core/interface/gridsite-gacl.h delete mode 100644 org.gridsite.core/interface/gridsite.h delete mode 100644 org.gridsite.core/project/build.number delete mode 100644 org.gridsite.core/project/build.properties delete mode 100644 org.gridsite.core/project/compat-1.5.patch delete mode 100644 org.gridsite.core/project/configure.properties.xml delete mode 100644 org.gridsite.core/project/dependencies.properties delete mode 100644 org.gridsite.core/project/gridsite.core.csf.xml delete mode 100644 org.gridsite.core/project/properties.xml delete mode 100644 org.gridsite.core/project/taskdefs.xml delete mode 100644 org.gridsite.core/project/version.properties delete mode 100644 org.gridsite.core/src/Doxyfile delete mode 100644 org.gridsite.core/src/Makefile delete mode 100644 org.gridsite.core/src/delegation.h delete mode 100644 org.gridsite.core/src/doxygen.css delete mode 100644 org.gridsite.core/src/doxyheader.html delete mode 100644 org.gridsite.core/src/findproxyfile.c delete mode 100644 org.gridsite.core/src/gaclexample.c delete mode 100644 org.gridsite.core/src/gridsite-copy.c delete mode 100644 org.gridsite.core/src/gridsite-storage.c delete mode 100644 org.gridsite.core/src/grst-delegation.c delete mode 100644 org.gridsite.core/src/grst_admin.h delete mode 100644 org.gridsite.core/src/grst_admin_file.c delete mode 100644 org.gridsite.core/src/grst_admin_gacl.c delete mode 100644 org.gridsite.core/src/grst_admin_main.c delete mode 100644 org.gridsite.core/src/grst_asn1.c delete mode 100644 org.gridsite.core/src/grst_err.c delete mode 100644 org.gridsite.core/src/grst_gacl.c delete mode 100644 org.gridsite.core/src/grst_htcp.c delete mode 100644 org.gridsite.core/src/grst_http.c delete mode 100644 org.gridsite.core/src/grst_x509.c delete mode 100644 org.gridsite.core/src/grst_xacml.c delete mode 100644 org.gridsite.core/src/gsexec.c delete mode 100644 org.gridsite.core/src/gsexec.h delete mode 100644 org.gridsite.core/src/htcp.c delete mode 100644 org.gridsite.core/src/htproxyput.c delete mode 100755 org.gridsite.core/src/make-gridsite-spec delete mode 100644 org.gridsite.core/src/mod_gridsite.c delete mode 100644 org.gridsite.core/src/mod_gridsite_example.c delete mode 100644 org.gridsite.core/src/mod_ssl-private.h delete mode 100755 org.gridsite.core/src/roffit delete mode 100644 org.gridsite.core/src/showx509exts.c delete mode 100644 org.gridsite.core/src/slashgrid.c delete mode 100755 org.gridsite.core/src/slashgrid.init delete mode 100644 org.gridsite.core/src/urlencode.c delete mode 100644 org.gridsite.core/src/xacmlexample.c diff --git a/org.glite.deployment.jpis/build.xml b/org.glite.deployment.jpis/build.xml deleted file mode 100644 index c2bf066..0000000 --- a/org.glite.deployment.jpis/build.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpis/config/scripts/glite-jpis-config.py b/org.glite.deployment.jpis/config/scripts/glite-jpis-config.py deleted file mode 100755 index eb75155..0000000 --- a/org.glite.deployment.jpis/config/scripts/glite-jpis-config.py +++ /dev/null @@ -1,492 +0,0 @@ -#!/usr/bin/env python -################################################################################ -# -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://eu-egee.org/partners/ for details on the copyright holders. -# For license conditions see the license file or http://eu-egee.org/license.html -# -################################################################################ -# glite-jpis-config v. 1.0.0 -# -# Post-installation script for configuring the gLite Job Provenance Servers -# Robert Harakaly < mmulac@cern.ch > -# -# Version info: $Id$ -# -# Usage: python glite-jpis-config [-c|-v|-h|--help] -# -c, --checkconf print configuration -# -v, --version print version -# -h,--help print usage info -# --configure configure the service -# --start start the service -# --stop stop the service -# --status show service status -# -# Return codes: 0 - Ok -# 1 - Configuration failed -# -################################################################################ - -import os,string,pwd -import sys, posix, getopt,time - -sys.path.append(".") -from gLiteInstallerLib import gLib -from gLiteInstallerLib import ConfigParams -import mysql as MySQL - -# Set global variables here -global params # all config values from the XML file - -class glite_jpis: - - def __init__(self): - self.mysql = MySQL.Mysql() - self.verbose = 0 - self.version = "1.0.0" - self.name = "glite-jpis" - self.friendly_name = "gLite Job Provenance Index Server" - - #------------------------------------------------------------------------------- - # Banner - #------------------------------------------------------------------------------- - - def banner(self): - - print "\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - print "Configuring the %s" % self.friendly_name - print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" - - #------------------------------------------------------------------------------- - # Copyright - #------------------------------------------------------------------------------- - - def copyright(self): - - print '\nCopyright (c) Members of the EGEE Collaboration. 2004' - print 'See http://eu-egee.org/partners/ for details on the copyright holders' - print 'For license conditions see the license file or http://eu-egee.org/license.html' - - #------------------------------------------------------------------------------- - # Version - #------------------------------------------------------------------------------- - - def showVersion(self): - - print '\n%s-config v. %s\n' % (self.name,self.version) - - #------------------------------------------------------------------------------- - # Usage - #------------------------------------------------------------------------------- - - def usage(self,msg = ""): - - if msg: - print "\n%s" % (msg) - - self.copyright() - self.showVersion() - - print """Usage: \n -Edit the configuration file %s.cfg.xml in -%s/etc.config/templates\n -save it as %s/etc/config/%s.cfg.xml -and run the script as follows\n -python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \ - os.environ['GLITE_LOCATION'], self.name, self.name) - - print ' -c, --checkconf print the service configuration' - print ' -v, --version print the version of the configuration script' - print ' -h, --help print this usage information' - print ' --configure configure the service' - print ' --start start the service' - print ' --stop stop the service' - print ' --status check service status' - print '\n' - - #------------------------------------------------------------------------------- - # All the configuration code goes here - #------------------------------------------------------------------------------- - - def start(self): - - self.mysql.start() - time.sleep(5) - - if not os.path.exists('/tmp/mysql.sock'): - os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock') - - #------------------------------------------------------------------- - # Start Index Server - #------------------------------------------------------------------- - - pid = glib.getPID('indexd') - if pid != 0: - print 'The gLite JP Index Server service is already running. Restarting...' - os.system('%s/etc/init.d/glite-jp-indexd stop' % os.environ['GLITE_LOCATION']) - else: - print 'Starting the gLite JP Index Server service...' - - os.system('%s/etc/init.d/glite-jp-indexd start' % os.environ['GLITE_LOCATION']) - - pid = glib.getPID('indexd') - - if (pid != 0): - print "The gLite JP Index Server service has been started ", - glib.printOkMessage() - else: - glib.printErrorMessage("Could not start the gLite JP Index Server service") - glib.printErrorMessage("Please verify and re-run the script "), - glib.printFailedMessage() - return 1 - - return 0 - - def stop(self): - - error_level = 0 - - #------------------------------------------------------------------- - # Stop Index Server - #------------------------------------------------------------------- - - pid = glib.getPID('indexd') - if (pid != 0): - os.system('%s/etc/init.d/glite-jp-indexd stop' % os.environ['GLITE_LOCATION']) - - pid = glib.getPID('indexd') - if (pid != 0): - print 'Could not stop the JP Index Server service ', - glib.printFailedMessage() - error_level = 1 - else: - print 'JP Index Server service has been stopped ', - glib.printOkMessage() - - #------------------------------------------------------------------- - # MySQL - #------------------------------------------------------------------- - - self.mysql.stop() - - return error_level - - def status(self): - - error_level = 0 - - retval = os.system('%s/etc/init.d/glite-jp-indexd status' % os.environ['GLITE_LOCATION']) - if retval != 0: - error_level = 1 - - return error_level - - def configure(self): - - #-------------------------------------------------------- - # Installs the Security Utilities - #-------------------------------------------------------- - - if os.system("python %s/glite-security-utils-config.py --subservice" % glib.getScriptPath()): - print "\nConfiguring gLite Security Utilities ", - glib.printFailedMessage() - else: - print "\nConfiguring gLite Security Utilities ", - glib.printOkMessage() - - # Create the GLITE_USER if it doesn't exists - print "\nCreating/Verifying the GLITE_USER account %s" % os.environ['GLITE_USER'] - (uid,gid) = glib.get_user_info(os.environ['GLITE_USER']) - glib.check_dir(os.environ['GLITE_LOCATION_VAR'],0755, uid, gid) - jpis_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path'] - glib.check_dir(jpis_cert_path ,0755, uid, gid) - glib.printOkMessage() - - # Create all directories needed - glib.check_dir(os.environ['GLITE_CERT_DIR']) - print "\nVerify CA certificates directory ", - glib.printOkMessage() - - # Copy certificates - print "\nCopy host certificates to GLITE_USER home directory as service certificates", - os.system("cp %s %s %s/" % (params['host.certificate.file'], params['host.key.file'], jpis_cert_path)) - os.chown("%s/hostcert.pem" % jpis_cert_path, uid,gid) - os.chmod("%s/hostcert.pem" % jpis_cert_path, 0644) - os.chown("%s/hostkey.pem" % jpis_cert_path, uid,gid) - os.chmod("%s/hostkey.pem" % jpis_cert_path, 0400) - glib.printOkMessage() - - #-------------------------------------------------------- - # Configure MySQL - #-------------------------------------------------------- - - # Set mysql parameters - #self.mysql.setConfiguration('client','max_allowed_packet',params['mysql.max_allowed_packet']) - self.mysql.setConfiguration('mysqld','max_allowed_packet',params['mysql.max_allowed_packet']) - - # start MySQL - self.mysql.stop() - time.sleep(5) - self.mysql.start() - - if not os.path.exists('/tmp/mysql.sock'): - os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock') - - # ------------------------------------------------------------ - # Check password of MySQL - # ------------------------------------------------------------ - - self.mysql_root_password = params['mysql.root.password'] - if not params.has_key('set.mysql.root.password'): - params['set.mysql.root.password'] = 'false' - setempty = params['set.mysql.root.password'] - if self.mysql.checkMySQLConfiguration(self.mysql_root_password,setempty): - return 1 - - # Create the MySQL database - print "\nCreate/Verify the %s database" % params['jpis.database.name'] - - # Check if database exists - if self.mysql.existsDB(params['jpis.database.name'],self.mysql_root_password) != 0: - # Create database - print ('\n==> Creating MySQL %s database\n' % params['jpis.database.name']) - - if os.path.exists('/bin/rm /tmp/mysql_ct'): - os.remove('/tmp/mysql_ct') - - file = open('/tmp/mysql_ct', 'w') - - self.mysql.add_user(params['jpis.database.name'],params['jpis.database.username'],"",self.mysql_root_password) - text = ['USE %s;\n' % params['jpis.database.name'], - '\. %s/etc/glite-jp-index-dbsetup.sql\n' % os.environ['GLITE_LOCATION']] - - file.writelines(text) - file.close() - os.system('/usr/bin/mysql -p%s < /tmp/mysql_ct' % self.mysql_root_password) - os.system('/bin/rm /tmp/mysql_ct') - - #Starting and stopping the database before the index creation - self.mysql.stop() - time.sleep(5) - self.mysql.start() - - else: - print "\n==> MySQL database %s already exist\n" % params['jpis.database.name'] - - self.mysql.stop() - - return 0 - -#------------------------------------------------------------------------------- -# Set all environment variables -#------------------------------------------------------------------------------- - -def loadDefaults(params): - - params['GLITE_LOCATION'] = "/opt/glite" - params['mysql.root.password'] = "" - params['mysql.max_allowed_packet'] = "17" - params['jpis.serviceName'] = 'JP IS Server service at %s' % glib.fq_hostname - params['jpis.serviceType'] = 'org.glite.jp.index' - params['jpis.statusScript'] = '%s/etc/init.d/glite-jp-indexd status' % params['GLITE_LOCATION'] - params['jpis.endpoint'] = 'not available' - -def set_env(): - - # gLite - glib.export('GLITE_LOCATION'); - glib.export('GLITE_LOCATION_VAR'); - if not os.path.exists(os.environ['GLITE_LOCATION_VAR']): - os.mkdir(os.environ['GLITE_LOCATION_VAR'],0755) - glib.export('GLITE_LOCATION_LOG'); - if not os.path.exists(os.environ['GLITE_LOCATION_LOG']): - os.mkdir(os.environ['GLITE_LOCATION_LOG'],0755) - glib.export('GLITE_LOCATION_TMP'); - if not os.path.exists(os.environ['GLITE_LOCATION_TMP']): - os.mkdir(os.environ['GLITE_LOCATION_TMP'],0755) - - if not params.has_key('glite.user.group'): - params['glite.user.group'] = '' - (uid,gid) = glib.add_user(params['glite.user.name'],params['glite.user.group']) - glib.export('GLITE_USER',params['glite.user.name']) - jpis_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path'] - glib.export('GLITE_HOST_CERT',"%s/hostcert.pem" % jpis_cert_path) - glib.export('GLITE_HOST_KEY',"%s/hostkey.pem" % jpis_cert_path) - glib.export('GLITE_CERT_DIR',params['ca.certificates.dir']) - - glib.export('GLOBUS_LOCATION',params['GLOBUS_LOCATION']) - glib.export('GPT_LOCATION',params['GPT_LOCATION']) - - glib.export('JAVA_HOME') - - # bin and lib paths - glib.addEnvPath("PATH","/usr/bin/:%s/bin:%s/bin:%s/externals/bin:%s/bin" \ - % (os.environ['JAVA_HOME'],os.environ['GLOBUS_LOCATION'],os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])) - glib.addEnvPath("LD_LIBRARY_PATH","/usr/lib:%s/lib:%s/externals/lib:%s/lib" % (os.environ['GLOBUS_LOCATION'], os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])) - - # Perl - glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION'])) - - # JP IS configuration - glib.export('GLITE_JPIS_PS',params['jpis.ps']) - glib.export('GLITE_JPIS_DEBUG',params['jpis.debug']) - glib.export('GLITE_JPIS_QT',params['jpis.qt']) - glib.export('GLITE_JPIS_AUTH',params['jpis.auth']) - glib.export('GLITE_JPIS_DB',"%s/@localhost:%s" % (params['jpis.database.username'], params['jpis.database.name']) ) - glib.export('GLITE_JPIS_PORT',params['jpis.port']) - glib.export('GLITE_JPIS_PIDFILE',params['jpis.pid.file']) - glib.export('GLITE_JPIS_LOGFILE',params['jpis.log.file']) - - # Set environment - glib.setUserEnv() - -#------------------------------------------------------------------------------- -# Main program begins here -#------------------------------------------------------------------------------- - -if __name__ == '__main__': - - # The script must be run as root - if not os.geteuid()==0: - print '"\nThis script must be run as root\n' - sys.exit(1) - - # Get an instance of the ConfigParams class - params = ConfigParams() - - # Get an instance of the library class - glib = gLib() - - # Load parameters - loadDefaults(params) - try: - opts, args = glib.getopt(sys.argv[1:], '', ['siteconfig=']) - for o, a in opts: - if o == "--siteconfig": - params['site.config.url'] = a - break - except getopt.GetoptError: - pass - if glib.loadConfiguration("%s/../glite-jpis.cfg.xml" % glib.getScriptPath(),params): - print "An error occurred while configuring the service" - sys.exit(1) - - verbose = 0 - if params.has_key('glite.installer.verbose'): - if params['glite.installer.verbose'] == "true": - verbose = 1 - glib.verbose = verbose - - # Set up the environment - set_env() - - - # Instantiate the service classes - service = glite_jpis() - service.verbose = verbose - - # Command line opts if any - try: - opts, args = glib.getopt(sys.argv[1:], 'chv', ['checkconf', 'help', 'version','configure','stop','start','status','siteconfig=']) - except getopt.GetoptError: - service.usage(msg = "Unknown options(s)") - sys.exit(1) - - if len(opts) == 0: - service.usage() - sys.exit(0) - - # Check cli options - for o, a in opts: - if o in ("-h", "--help"): - service.usage() - sys.exit(0) - if o in ("-v", "--version"): - service.showVersion() - sys.exit(0) - if o in ("-c", "--checkconf"): - service.copyright() - service.showVersion() - glib.print_params(params) - sys.exit(0) - - if o == "--configure": - - - # Check certificates - if params.has_key('glite.installer.checkcerts'): - if params['glite.installer.checkcerts'] == "true": - if glib.check_certs(params) != 0: - print "An error occurred while configuring the %s service" \ - % service.friendly_name - sys.exit(1) - - # Print configuration parameters - if verbose: - glib.print_params(params) - - service.copyright() - service.showVersion() - service.banner() - - # Stop all services - glib.printInfoMessage("\n\nStopping all running JP IS services...") - service.stop() - - # Configure the service - return_result = service.configure() - - if return_result == 0: - - # Stop all services - glib.printInfoMessage("\n\nStopping all running JP IS services...") - service.stop() - - print "\n\nThe %s configuration was successfully completed\n" % service.friendly_name - print "You can now start the service using the --start option of this script\n\n" - glib.registerService() - - sys.exit(0) - - elif return_result == 2: - - # Stop all services - glib.printInfoMessage("\n\nStopping all running JP IS services...") - service.stop() - - print "\n\nThe %s configuration was completed,\n" % service.friendly_name - print "but warnings were issued. Please revise them and re-run the script\n" - print "or configure JP IS manually\n" - - sys.exit(2) - - else: - print "\n\nAn unrecoverable error occurred while configuring the %s" \ - % service.friendly_name - - sys.exit(1) - - if o in ("start", "--start"): - # Start the service - if service.start() == 0: - print "\n\nThe %s was successfully started " % service.friendly_name, - glib.printOkMessage() - sys.exit(0) - else: - print "\n\nAn error occurred while starting the %s " % service.friendly_name, - glib.printFailedMessage() - sys.exit(1) - - if o in ("stop", "--stop"): - # Stop the service - if service.stop() == 0: - print "\n\nThe %s was successfully stopped " % service.friendly_name, - glib.printOkMessage() - sys.exit(0) - else: - print "\n\nAn unrecoverable error occurred while stopping the %s " % service.friendly_name, - glib.printFailedMessage() - sys.exit(1) - if o == "--status": - sys.exit(service.status()) - diff --git a/org.glite.deployment.jpis/config/templates/glite-jpis.cfg.xml b/org.glite.deployment.jpis/config/templates/glite-jpis.cfg.xml deleted file mode 100644 index cd56a80..0000000 --- a/org.glite.deployment.jpis/config/templates/glite-jpis.cfg.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpis/project/build.number b/org.glite.deployment.jpis/project/build.number deleted file mode 100644 index 58569c4..0000000 --- a/org.glite.deployment.jpis/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Wed Apr 13 09:36:57 CEST 2005 -module.build=232 diff --git a/org.glite.deployment.jpis/project/build.properties b/org.glite.deployment.jpis/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.deployment.jpis/project/glite-jp.sdf.xml.template b/org.glite.deployment.jpis/project/glite-jp.sdf.xml.template deleted file mode 100644 index d27cdec..0000000 --- a/org.glite.deployment.jpis/project/glite-jp.sdf.xml.template +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpis/project/glite-jpis.sdf.xml.template b/org.glite.deployment.jpis/project/glite-jpis.sdf.xml.template deleted file mode 100644 index d27cdec..0000000 --- a/org.glite.deployment.jpis/project/glite-jpis.sdf.xml.template +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpis/project/lxscript-rpm.xsl b/org.glite.deployment.jpis/project/lxscript-rpm.xsl deleted file mode 100644 index 7b6c6e3..0000000 --- a/org.glite.deployment.jpis/project/lxscript-rpm.xsl +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - -#!/bin/sh - -# Copyright (c) Members of the EGEE Collaboration. 2004 -# See http://eu-egee.org/partners/ for details on the copyright holders -# For license conditions see the license file or http://eu-egee.org/license.html - -# glite-jpis_installer v. -# -# The glite-jpis_installer installs the gLite Job Provenance Index Server -# -# Usage: glite-jpis_installer [-u|-v|--help] -# -u uninstall -# -v print version -# --help print script usage info -# Return codes: 0 - Ok -# 1 - if a file could not be downloaded - -############################################################################### - -#Parse the RPMLIST to strip out the RPMS that are already installed -function parseRPMList() -{ - newRPMLIST="" - localRPMLIST=`rpm -qa` - for i in $RPMLIST - do - g=`echo $i | sed -e 's/\.i386\.rpm//g'` - g=`echo $g | sed -e 's/\.noarch\.rpm//g'` - if [ -z "`echo $localRPMLIST | grep $g`" ]; then - newRPMLIST="${newRPMLIST} $i" - else - echo "$i is already installed. It will be skipped." - fi - done - - RPMLIST=$newRPMLIST -} - -#Parse the SCRIPTLIST to execute all scripts -function parseScriptList() -{ - for i in $SCRIPTLIST - do - if [ "$INSTALL" = "true" ]; then - $i - else - $i -u - fi - done -} - -#Downloads and install the module RPMS -function install() -{ - - INSTALL=true - version - echo - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, downloading the gLite Job Provenance Index Server... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - - mkdir -p glite-jpis - cd glite-jpis - - # Download global dependencies - - - true - - - - - - # Download scripts from repository - - - true - - - - - # Download dependencies RPMS from repository - - - true - - - - # Download RPMS from repository - - - true - - - - - - # Download and install subservices - parseScriptList - - - # Install all RPMS - echo - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, installing the gLite Job Provenance Index Server... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - parseRPMList - if [ ! -z "$RPMLIST" ]; then - rpm -Uvh $RPMLIST - rpm_return=$? - else - echo All required RPMS are already installed - rpm_return=0 - fi - if [ "$rpm_return" == "0" ]; then - echo - echo Done! - echo - echo Before using the gLite JP, please create or update the configuration - echo files /opt/glite/etc/config/glite-jpis.cfg.xml - echo and /opt/glite/etc/config/glite-global.cfg.xml - echo and run the configuration script - echo /opt/glite/etc/config/scripts/glite-jpis-config.py. - echo A template is provided in - echo /opt/glite/etc/config/templates/glite-jpis.cfg.xml - echo Alternatively site configuration files can be used - else - echo - echo An error occurred while installing the JP RPMS. - echo Most likely one or more of the RPMS to be installed require - echo additional dependencies or are older than already installed packages. - echo Please refer to the rpm error message above for more details. - fi - echo - echo For more information refer to the gLite Installation and User Guides - echo or to the gLite web site \(http:\/\/www.glite.org\) - echo Please report problems and comments to the gLite Team at - echo glite-bugs@cern.ch - - cd .. -} - -############################################################################### -function uninstall() -{ - version - - # Global dependencies - - - false - - - - - - # dependencies RPMS from repository - - - false - - - - # RPMS from repository - - - false - - - - - - # Uninstall all RPMS - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, uninstalling the gLite Job Provenance Index Server... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - rpm -ev $RPMLIST - if [ "$?" == "0" ]; then - echo - echo Done! - else - echo - echo An error occurred while removing the JP RPMS. - echo Most likely one or more of the RPMS to be removed have - echo dependent packages. - echo Please refer to the rpm error message above for more details. - fi -} - -############################################################################### -function usage() -{ - echo - echo Copyright \(c\) Members of the EGEE Collaboration. 2004 - echo See http://eu-egee.org/partners/ for details on the copyright holders - echo For license conditions see the license file or http://eu-egee.org/license.html - echo - echo glite-jpis_installer v. - echo - echo The glite-jpis_installer installs the gLite Job Provenance Index Server - echo - echo Usage: glite-jpis_installer \[-u\|-v\|--help\] - echo -u uninstall - echo -v print version - echo --help print script usage info - echo - echo Return codes: - echo 0 - Ok - echo 1 - if a file could not be downloaded - echo -} - -############################################################################### -function version -{ - echo - echo Copyright \(c\) Members of the EGEE Collaboration. 2004 - echo See http://eu-egee.org/partners/ for details on the copyright holders - echo For license conditions see the license file or http://eu-egee.org/license.html - echo - echo glite-jpis_installer v. - echo -} - - -RPMLIST= - -############################################################################### -# Main - -while getopts uvh opt -do - case $opt in - 'u') uninstall - exit 0 - ;; - 'v') version - exit 0 - ;; - 'h') usage - exit 0 - ;; - esac -done - -install - -exit 0 - - - - - _installer.sh - - -wget -N -nv -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -chmod u+x -SCRIPTLIST="$SCRIPTLIST ./" - - -SCRIPTLISTUn="$SCRIPTLISTUn ./ -u " - - - - - - - - --..rpm - -- - - -wget -N -nv -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -RPMLIST="$RPMLIST " - - -RPMLIST="$RPMLIST " - - - - - - - --..rpm - -- - - -wget -N -nv /RPMS/ -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -RPMLIST="$RPMLIST " - - -RPMLIST="$RPMLIST " - - - - - diff --git a/org.glite.deployment.jpis/project/lxscript-tgz.xsl b/org.glite.deployment.jpis/project/lxscript-tgz.xsl deleted file mode 100644 index 8b1e0c0..0000000 --- a/org.glite.deployment.jpis/project/lxscript-tgz.xsl +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - -#!/bin/sh -# -# glite-jpis_tgz_installer -# usage: glite-jpis_tgz_installer [-u] -# -u uninstall -# -# glite-jpis_tgz_installer installs the gLite Deployment Unit from biniary tarballs -# - -PREFIX=/opt/glite - -############################################################################### -# Download global dependencies - - - -############################################################################### - - -############################################################################### -# Download dependencies RPMS from repository - - - -############################################################################### -# Download RPMS from repository - - - -############################################################################### - - - - - - --..rpm -wget - - - - -_bin.tar.gz -wget i386/tgz/ -tar -xzf $PREFIX - - - diff --git a/org.glite.deployment.jpis/project/properties.xml b/org.glite.deployment.jpis/project/properties.xml deleted file mode 100644 index 072dd67..0000000 --- a/org.glite.deployment.jpis/project/properties.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpis/project/quattor-template.xsl b/org.glite.deployment.jpis/project/quattor-template.xsl deleted file mode 100644 index d960582..0000000 --- a/org.glite.deployment.jpis/project/quattor-template.xsl +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - -template pro_software_glite_jpis; - -# -# Copyright (c) Members of the EGEE Collaboration. 2004 -# See http://eu-egee.org/partners/ for details on the copyright holders -# For license conditions see the license file or http://eu-egee.org/license.html -# -# glite-jpis Quattor template v. -# - -## CAs - -include pro_software_glite_CA; - - - -# Global dependencies - - - - - - -# dependencies - - - - -# RPMS - - - - - -include pro_software_; - - - - - - - -"/software/packages"=pkg_repl("","-",""); - - - -"/software/packages"=pkg_repl("","-",""); - - - diff --git a/org.glite.deployment.jpis/project/version.properties b/org.glite.deployment.jpis/project/version.properties deleted file mode 100644 index 809be8c..0000000 --- a/org.glite.deployment.jpis/project/version.properties +++ /dev/null @@ -1,4 +0,0 @@ - -module.version = 2.2.0 -module.age = 2 - diff --git a/org.glite.deployment.jpps/build.xml b/org.glite.deployment.jpps/build.xml deleted file mode 100644 index c2bf066..0000000 --- a/org.glite.deployment.jpps/build.xml +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpps/config/scripts/glite-jpps-config.py b/org.glite.deployment.jpps/config/scripts/glite-jpps-config.py deleted file mode 100755 index 3612d6b..0000000 --- a/org.glite.deployment.jpps/config/scripts/glite-jpps-config.py +++ /dev/null @@ -1,500 +0,0 @@ -#!/usr/bin/env python -################################################################################ -# -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://eu-egee.org/partners/ for details on the copyright holders. -# For license conditions see the license file or http://eu-egee.org/license.html -# -################################################################################ -# glite-jpps-config v. 1.0.0 -# -# Post-installation script for configuring the gLite Job Provenance Servers -# Robert Harakaly < mmulac@cern.ch > -# -# Version info: $Id$ -# -# Usage: python glite-jpps-config [-c|-v|-h|--help] -# -c, --checkconf print configuration -# -v, --version print version -# -h,--help print usage info -# --configure configure the service -# --start start the service -# --stop stop the service -# --status show service status -# -# Return codes: 0 - Ok -# 1 - Configuration failed -# -################################################################################ - -import os,string,pwd -import sys, posix, getopt,time - -sys.path.append(".") -from gLiteInstallerLib import gLib -from gLiteInstallerLib import ConfigParams -import mysql as MySQL - -# Set global variables here -global params # all config values from the XML file - -class glite_jpps: - - def __init__(self): - self.mysql = MySQL.Mysql() - self.verbose = 0 - self.version = "1.0.0" - self.name = "glite-jpps" - self.friendly_name = "gLite Job Provenance Primary Storage" - - #------------------------------------------------------------------------------- - # Banner - #------------------------------------------------------------------------------- - - def banner(self): - - print "\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - print "Configuring the %s" % self.friendly_name - print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" - - #------------------------------------------------------------------------------- - # Copyright - #------------------------------------------------------------------------------- - - def copyright(self): - - print '\nCopyright (c) Members of the EGEE Collaboration. 2004' - print 'See http://eu-egee.org/partners/ for details on the copyright holders' - print 'For license conditions see the license file or http://eu-egee.org/license.html' - - #------------------------------------------------------------------------------- - # Version - #------------------------------------------------------------------------------- - - def showVersion(self): - - print '\n%s-config v. %s\n' % (self.name,self.version) - - #------------------------------------------------------------------------------- - # Usage - #------------------------------------------------------------------------------- - - def usage(self,msg = ""): - - if msg: - print "\n%s" % (msg) - - self.copyright() - self.showVersion() - - print """Usage: \n -Edit the configuration file %s.cfg.xml in -%s/etc.config/templates\n -save it as %s/etc/config/%s.cfg.xml -and run the script as follows\n -python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \ - os.environ['GLITE_LOCATION'], self.name, self.name) - - print ' -c, --checkconf print the service configuration' - print ' -v, --version print the version of the configuration script' - print ' -h, --help print this usage information' - print ' --configure configure the service' - print ' --start start the service' - print ' --stop stop the service' - print ' --status check service status' - print '\n' - - #------------------------------------------------------------------------------- - # All the configuration code goes here - #------------------------------------------------------------------------------- - - def start(self): - - self.mysql.start() - time.sleep(5) - - if not os.path.exists('/tmp/mysql.sock'): - os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock') - - #------------------------------------------------------------------- - # Start Primary Storage - #------------------------------------------------------------------- - - pid = glib.getPID('primarystoraged') - if pid != 0: - print 'The gLite JP Primary Storage service is already running. Restarting...' - os.system('%s/etc/init.d/glite-jp-primary stop' % os.environ['GLITE_LOCATION']) - else: - print 'Starting the gLite JP Primary Storage service...' - - os.system('%s/etc/init.d/glite-jp-primary start' % os.environ['GLITE_LOCATION']) - - pid = glib.getPID('primarystoraged') - - if (pid != 0): - print "The gLite JP Primary Storage service has been started ", - glib.printOkMessage() - else: - glib.printErrorMessage("Could not start the gLite JP Primary Storage service") - glib.printErrorMessage("Please verify and re-run the script "), - glib.printFailedMessage() - return 1 - - return 0 - - def stop(self): - - error_level = 0 - - #------------------------------------------------------------------- - # Stop Primary Storage - #------------------------------------------------------------------- - - pid = glib.getPID('primarystoraged') - if (pid != 0): - os.system('%s/etc/init.d/glite-jp-primary stop' % os.environ['GLITE_LOCATION']) - - pid = glib.getPID('primarystoraged') - if (pid != 0): - print 'Could not stop the JP Primary Storage service ', - glib.printFailedMessage() - error_level = 1 - else: - print 'JP Primary Storage service has been stopped ', - glib.printOkMessage() - - #------------------------------------------------------------------- - # MySQL - #------------------------------------------------------------------- - - self.mysql.stop() - - return error_level - - def status(self): - - error_level = 0 - - retval = os.system('%s/etc/init.d/glite-jp-primary status' % os.environ['GLITE_LOCATION']) - if retval != 0: - error_level = 1 - - return error_level - - def configure(self): - - #-------------------------------------------------------- - # Installs the Security Utilities - #-------------------------------------------------------- - - if os.system("python %s/glite-security-utils-config.py --subservice" % glib.getScriptPath()): - print "\nConfiguring gLite Security Utilities ", - glib.printFailedMessage() - else: - print "\nConfiguring gLite Security Utilities ", - glib.printOkMessage() - - # Create the GLITE_USER if it doesn't exists - print "\nCreating/Verifying the GLITE_USER account %s" % os.environ['GLITE_USER'] - (uid,gid) = glib.get_user_info(os.environ['GLITE_USER']) - glib.check_dir(os.environ['GLITE_LOCATION_VAR'],0755, uid, gid) - jpps_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path'] - glib.check_dir(jpps_cert_path ,0755, uid, gid) - glib.printOkMessage() - - # Create all directories needed - glib.check_dir(os.environ['GLITE_CERT_DIR']) - print "\nVerify CA certificates directory ", - glib.printOkMessage() - - # Copy certificates - print "\nCopy host certificates to GLITE_USER home directory as service certificates", - os.system("cp %s %s %s/" % (params['host.certificate.file'], params['host.key.file'], jpps_cert_path)) - os.chown("%s/hostcert.pem" % jpps_cert_path, uid,gid) - os.chmod("%s/hostcert.pem" % jpps_cert_path, 0644) - os.chown("%s/hostkey.pem" % jpps_cert_path, uid,gid) - os.chmod("%s/hostkey.pem" % jpps_cert_path, 0400) - glib.printOkMessage() - - #-------------------------------------------------------- - # Configure MySQL - #-------------------------------------------------------- - - # Set mysql parameters - #self.mysql.setConfiguration('client','max_allowed_packet',params['mysql.max_allowed_packet']) - self.mysql.setConfiguration('mysqld','max_allowed_packet',params['mysql.max_allowed_packet']) - - # start MySQL - self.mysql.stop() - time.sleep(5) - self.mysql.start() - - if not os.path.exists('/tmp/mysql.sock'): - os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock') - - # ------------------------------------------------------------ - # Check password of MySQL - # ------------------------------------------------------------ - - self.mysql_root_password = params['mysql.root.password'] - if not params.has_key('set.mysql.root.password'): - params['set.mysql.root.password'] = 'false' - setempty = params['set.mysql.root.password'] - if self.mysql.checkMySQLConfiguration(self.mysql_root_password,setempty): - return 1 - - # Create the MySQL database - print "\nCreate/Verify the %s database" % params['jpps.database.name'] - - # Check if database exists - if self.mysql.existsDB(params['jpps.database.name'],self.mysql_root_password) != 0: - # Create database - print ('\n==> Creating MySQL %s database\n' % params['jpps.database.name']) - - if os.path.exists('/bin/rm /tmp/mysql_ct'): - os.remove('/tmp/mysql_ct') - - file = open('/tmp/mysql_ct', 'w') - - self.mysql.add_user(params['jpps.database.name'],params['jpps.database.username'],"",self.mysql_root_password) - text = ['USE %s;\n' % params['jpps.database.name'], - '\. %s/etc/glite-jp-primary-dbsetup.sql\n' % os.environ['GLITE_LOCATION']] - - file.writelines(text) - file.close() - os.system('/usr/bin/mysql -p%s < /tmp/mysql_ct' % self.mysql_root_password) - os.system('/bin/rm /tmp/mysql_ct') - - #Starting and stopping the database before the index creation - self.mysql.stop() - time.sleep(5) - self.mysql.start() - - else: - print "\n==> MySQL database %s already exist\n" % params['jpps.database.name'] - - self.mysql.stop() - - return 0 - -#------------------------------------------------------------------------------- -# Set all environment variables -#------------------------------------------------------------------------------- - -def loadDefaults(params): - - params['GLITE_LOCATION'] = "/opt/glite" - params['mysql.root.password'] = "" - params['mysql.max_allowed_packet'] = "17" - params['jpps.serviceName'] = 'JP PS Server service at %s' % glib.fq_hostname - params['jpps.serviceType'] = 'org.glite.jp.primary' - params['jpps.statusScript'] = '%s/etc/init.d/glite-jp-primary status' % params['GLITE_LOCATION'] - params['jpps.endpoint'] = 'not available' - -def set_env(): - - # gLite - glib.export('GLITE_LOCATION'); - glib.export('GLITE_LOCATION_VAR'); - if not os.path.exists(os.environ['GLITE_LOCATION_VAR']): - os.mkdir(os.environ['GLITE_LOCATION_VAR'],0755) - glib.export('GLITE_LOCATION_LOG'); - if not os.path.exists(os.environ['GLITE_LOCATION_LOG']): - os.mkdir(os.environ['GLITE_LOCATION_LOG'],0755) - glib.export('GLITE_LOCATION_TMP'); - if not os.path.exists(os.environ['GLITE_LOCATION_TMP']): - os.mkdir(os.environ['GLITE_LOCATION_TMP'],0755) - - if not params.has_key('glite.user.group'): - params['glite.user.group'] = '' - (uid,gid) = glib.add_user(params['glite.user.name'],params['glite.user.group']) - glib.export('GLITE_USER',params['glite.user.name']) - jpps_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path'] - glib.export('GLITE_HOST_CERT',"%s/hostcert.pem" % jpps_cert_path) - glib.export('GLITE_HOST_KEY',"%s/hostkey.pem" % jpps_cert_path) - glib.export('GLITE_CERT_DIR',params['ca.certificates.dir']) - - glib.export('GLOBUS_LOCATION',params['GLOBUS_LOCATION']) - glib.export('GPT_LOCATION',params['GPT_LOCATION']) - - glib.export('JAVA_HOME') - - # bin and lib paths - glib.addEnvPath("PATH","/usr/bin/:%s/bin:%s/bin:%s/externals/bin:%s/bin" \ - % (os.environ['JAVA_HOME'],os.environ['GLOBUS_LOCATION'],os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])) - glib.addEnvPath("LD_LIBRARY_PATH","/usr/lib:%s/lib:%s/externals/lib:%s/lib" % (os.environ['GLOBUS_LOCATION'], os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])) - - # Perl - glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION'])) - - # JP PS configuration - glib.export('GLITE_JP_PRIMARY_PEERS',params['jpps.peers']) - glib.export('GLITE_JP_PRIMARY_FTP_PORT',params['jpps.ftp.port']) - glib.export('GLITE_JP_PRIMARY_INTERNAL',params['jpps.internal']) - if not os.path.exists(os.environ['GLITE_JP_PRIMARY_INTERNAL']): - os.mkdir(os.environ['GLITE_JP_PRIMARY_INTERNAL'],0755) - import socket - glib.export('GLITE_JP_PRIMARY_EXTERNAL',"gsiftp://%s:%s%s" % (socket.getfqdn(socket.gethostname()), params['jpps.ftp.port'], params['jpps.internal']) ) - if not os.path.exists(params['jpps.internal']): - os.mkdir(params['jpps.internal'],0755) - #glite_setenv.sh does not like variables with spaces, - #and su don't like variables with " - #glib.export('GLITE_JP_DEBUG',params['jpps.debug']) - os.environ['GLITE_JP_DEBUG']='%s' % params['jpps.debug'] - glib.export('GLITE_JP_PRIMARY_PORT',params['jpps.port']) - glib.export('GLITE_JP_PRIMARY_DBCS',"%s/@localhost:%s" % (params['jpps.database.username'], params['jpps.database.name']) ) - glib.export('GLITE_JP_PRIMARY_PIDFILE',params['jpps.pid.file']) - - # Set environment - glib.setUserEnv() - -#------------------------------------------------------------------------------- -# Main program begins here -#------------------------------------------------------------------------------- - -if __name__ == '__main__': - - # The script must be run as root - if not os.geteuid()==0: - print '"\nThis script must be run as root\n' - sys.exit(1) - - # Get an instance of the ConfigParams class - params = ConfigParams() - - # Get an instance of the library class - glib = gLib() - - # Load parameters - loadDefaults(params) - try: - opts, args = glib.getopt(sys.argv[1:], '', ['siteconfig=']) - for o, a in opts: - if o == "--siteconfig": - params['site.config.url'] = a - break - except getopt.GetoptError: - pass - if glib.loadConfiguration("%s/../glite-jpps.cfg.xml" % glib.getScriptPath(),params): - print "An error occurred while configuring the service" - sys.exit(1) - - verbose = 0 - if params.has_key('glite.installer.verbose'): - if params['glite.installer.verbose'] == "true": - verbose = 1 - glib.verbose = verbose - - # Set up the environment - set_env() - - - # Instantiate the service classes - service = glite_jpps() - service.verbose = verbose - - # Command line opts if any - try: - opts, args = glib.getopt(sys.argv[1:], 'chv', ['checkconf', 'help', 'version','configure','stop','start','status','siteconfig=']) - except getopt.GetoptError: - service.usage(msg = "Unknown options(s)") - sys.exit(1) - - if len(opts) == 0: - service.usage() - sys.exit(0) - - # Check cli options - for o, a in opts: - if o in ("-h", "--help"): - service.usage() - sys.exit(0) - if o in ("-v", "--version"): - service.showVersion() - sys.exit(0) - if o in ("-c", "--checkconf"): - service.copyright() - service.showVersion() - glib.print_params(params) - sys.exit(0) - - if o == "--configure": - - - # Check certificates - if params.has_key('glite.installer.checkcerts'): - if params['glite.installer.checkcerts'] == "true": - if glib.check_certs(params) != 0: - print "An error occurred while configuring the %s service" \ - % service.friendly_name - sys.exit(1) - - # Print configuration parameters - if verbose: - glib.print_params(params) - - service.copyright() - service.showVersion() - service.banner() - - # Stop all services - glib.printInfoMessage("\n\nStopping all running JP PS services...") - service.stop() - - # Configure the service - return_result = service.configure() - - if return_result == 0: - - # Stop all services - glib.printInfoMessage("\n\nStopping all running JP PS services...") - service.stop() - - print "\n\nThe %s configuration was successfully completed\n" % service.friendly_name - print "You can now start the service using the --start option of this script\n\n" - glib.registerService() - - sys.exit(0) - - elif return_result == 2: - - # Stop all services - glib.printInfoMessage("\n\nStopping all running JP PS services...") - service.stop() - - print "\n\nThe %s configuration was completed,\n" % service.friendly_name - print "but warnings were issued. Please revise them and re-run the script\n" - print "or configure JP PS manually\n" - - sys.exit(2) - - else: - print "\n\nAn unrecoverable error occurred while configuring the %s" \ - % service.friendly_name - - sys.exit(1) - - if o in ("start", "--start"): - # Start the service - if service.start() == 0: - print "\n\nThe %s was successfully started " % service.friendly_name, - glib.printOkMessage() - sys.exit(0) - else: - print "\n\nAn error occurred while starting the %s " % service.friendly_name, - glib.printFailedMessage() - sys.exit(1) - - if o in ("stop", "--stop"): - # Stop the service - if service.stop() == 0: - print "\n\nThe %s was successfully stopped " % service.friendly_name, - glib.printOkMessage() - sys.exit(0) - else: - print "\n\nAn unrecoverable error occurred while stopping the %s " % service.friendly_name, - glib.printFailedMessage() - sys.exit(1) - if o == "--status": - sys.exit(service.status()) - diff --git a/org.glite.deployment.jpps/config/templates/glite-jpps.cfg.xml b/org.glite.deployment.jpps/config/templates/glite-jpps.cfg.xml deleted file mode 100644 index ef13a02..0000000 --- a/org.glite.deployment.jpps/config/templates/glite-jpps.cfg.xml +++ /dev/null @@ -1,93 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpps/project/build.number b/org.glite.deployment.jpps/project/build.number deleted file mode 100644 index 58569c4..0000000 --- a/org.glite.deployment.jpps/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Wed Apr 13 09:36:57 CEST 2005 -module.build=232 diff --git a/org.glite.deployment.jpps/project/build.properties b/org.glite.deployment.jpps/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.deployment.jpps/project/glite-jpps.sdf.xml.template b/org.glite.deployment.jpps/project/glite-jpps.sdf.xml.template deleted file mode 100644 index ec2b692..0000000 --- a/org.glite.deployment.jpps/project/glite-jpps.sdf.xml.template +++ /dev/null @@ -1,127 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpps/project/lxscript-rpm.xsl b/org.glite.deployment.jpps/project/lxscript-rpm.xsl deleted file mode 100644 index c9bec9a..0000000 --- a/org.glite.deployment.jpps/project/lxscript-rpm.xsl +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - -#!/bin/sh - -# Copyright (c) Members of the EGEE Collaboration. 2004 -# See http://eu-egee.org/partners/ for details on the copyright holders -# For license conditions see the license file or http://eu-egee.org/license.html - -# glite-jpps_installer v. -# -# The glite-jpps_installer installs the gLite Job Provenance Primary Storage -# -# Usage: glite-jpps_installer [-u|-v|--help] -# -u uninstall -# -v print version -# --help print script usage info -# Return codes: 0 - Ok -# 1 - if a file could not be downloaded - -############################################################################### - -#Parse the RPMLIST to strip out the RPMS that are already installed -function parseRPMList() -{ - newRPMLIST="" - localRPMLIST=`rpm -qa` - for i in $RPMLIST - do - g=`echo $i | sed -e 's/\.i386\.rpm//g'` - g=`echo $g | sed -e 's/\.noarch\.rpm//g'` - if [ -z "`echo $localRPMLIST | grep $g`" ]; then - newRPMLIST="${newRPMLIST} $i" - else - echo "$i is already installed. It will be skipped." - fi - done - - RPMLIST=$newRPMLIST -} - -#Parse the SCRIPTLIST to execute all scripts -function parseScriptList() -{ - for i in $SCRIPTLIST - do - if [ "$INSTALL" = "true" ]; then - $i - else - $i -u - fi - done -} - -#Downloads and install the module RPMS -function install() -{ - - INSTALL=true - version - echo - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, downloading the gLite Job Provenance Primary Storage... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - - mkdir -p glite-jpps - cd glite-jpps - - # Download global dependencies - - - true - - - - - - # Download scripts from repository - - - true - - - - - # Download dependencies RPMS from repository - - - true - - - - # Download RPMS from repository - - - true - - - - - - # Download and install subservices - parseScriptList - - - # Install all RPMS - echo - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, installing the gLite Job Provenance Primary Storage... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - parseRPMList - if [ ! -z "$RPMLIST" ]; then - rpm -Uvh $RPMLIST - rpm_return=$? - else - echo All required RPMS are already installed - rpm_return=0 - fi - if [ "$rpm_return" == "0" ]; then - echo - echo Done! - echo - echo Before using the gLite JP PS, please create or update the configuration - echo files /opt/glite/etc/config/glite-jpps.cfg.xml - echo and /opt/glite/etc/config/glite-global.cfg.xml - echo and run the configuration script - echo /opt/glite/etc/config/scripts/glite-jpps-config.py. - echo A template is provided in - echo /opt/glite/etc/config/templates/glite-jpps.cfg.xml - echo Alternatively site configuration files can be used - else - echo - echo An error occurred while installing the JP PS RPMS. - echo Most likely one or more of the RPMS to be installed require - echo additional dependencies or are older than already installed packages. - echo Please refer to the rpm error message above for more details. - fi - echo - echo For more information refer to the gLite Installation and User Guides - echo or to the gLite web site \(http:\/\/www.glite.org\) - echo Please report problems and comments to the gLite Team at - echo glite-bugs@cern.ch - - cd .. -} - -############################################################################### -function uninstall() -{ - version - - # Global dependencies - - - false - - - - - - # dependencies RPMS from repository - - - false - - - - # RPMS from repository - - - false - - - - - - # Uninstall all RPMS - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, uninstalling the gLite Job Provenance Primary Storage... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - rpm -ev $RPMLIST - if [ "$?" == "0" ]; then - echo - echo Done! - else - echo - echo An error occurred while removing the JP PS RPMS. - echo Most likely one or more of the RPMS to be removed have - echo dependent packages. - echo Please refer to the rpm error message above for more details. - fi -} - -############################################################################### -function usage() -{ - echo - echo Copyright \(c\) Members of the EGEE Collaboration. 2004 - echo See http://eu-egee.org/partners/ for details on the copyright holders - echo For license conditions see the license file or http://eu-egee.org/license.html - echo - echo glite-jpps_installer v. - echo - echo The glite-jpps_installer installs the gLite Job Provenance Primary Storage - echo - echo Usage: glite-jpps_installer \[-u\|-v\|--help\] - echo -u uninstall - echo -v print version - echo --help print script usage info - echo - echo Return codes: - echo 0 - Ok - echo 1 - if a file could not be downloaded - echo -} - -############################################################################### -function version -{ - echo - echo Copyright \(c\) Members of the EGEE Collaboration. 2004 - echo See http://eu-egee.org/partners/ for details on the copyright holders - echo For license conditions see the license file or http://eu-egee.org/license.html - echo - echo glite-jpps_installer v. - echo -} - - -RPMLIST= - -############################################################################### -# Main - -while getopts uvh opt -do - case $opt in - 'u') uninstall - exit 0 - ;; - 'v') version - exit 0 - ;; - 'h') usage - exit 0 - ;; - esac -done - -install - -exit 0 - - - - - _installer.sh - - -wget -N -nv -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -chmod u+x -SCRIPTLIST="$SCRIPTLIST ./" - - -SCRIPTLISTUn="$SCRIPTLISTUn ./ -u " - - - - - - - - --..rpm - -- - - -wget -N -nv -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -RPMLIST="$RPMLIST " - - -RPMLIST="$RPMLIST " - - - - - - - --..rpm - -- - - -wget -N -nv /RPMS/ -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -RPMLIST="$RPMLIST " - - -RPMLIST="$RPMLIST " - - - - - diff --git a/org.glite.deployment.jpps/project/lxscript-tgz.xsl b/org.glite.deployment.jpps/project/lxscript-tgz.xsl deleted file mode 100644 index 4589cf6..0000000 --- a/org.glite.deployment.jpps/project/lxscript-tgz.xsl +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - -#!/bin/sh -# -# glite-jpps_tgz_installer -# usage: glite-jpps_tgz_installer [-u] -# -u uninstall -# -# glite-jpps_tgz_installer installs the gLite Deployment Unit from biniary tarballs -# - -PREFIX=/opt/glite - -############################################################################### -# Download global dependencies - - - -############################################################################### - - -############################################################################### -# Download dependencies RPMS from repository - - - -############################################################################### -# Download RPMS from repository - - - -############################################################################### - - - - - - --..rpm -wget - - - - -_bin.tar.gz -wget i386/tgz/ -tar -xzf $PREFIX - - - diff --git a/org.glite.deployment.jpps/project/properties.xml b/org.glite.deployment.jpps/project/properties.xml deleted file mode 100644 index 41d9f99..0000000 --- a/org.glite.deployment.jpps/project/properties.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.jpps/project/quattor-template.xsl b/org.glite.deployment.jpps/project/quattor-template.xsl deleted file mode 100644 index d4dc67b..0000000 --- a/org.glite.deployment.jpps/project/quattor-template.xsl +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - -template pro_software_glite_jpps; - -# -# Copyright (c) Members of the EGEE Collaboration. 2004 -# See http://eu-egee.org/partners/ for details on the copyright holders -# For license conditions see the license file or http://eu-egee.org/license.html -# -# glite-jpps Quattor template v. -# - -## CAs - -include pro_software_glite_CA; - - - -# Global dependencies - - - - - - -# dependencies - - - - -# RPMS - - - - - -include pro_software_; - - - - - - - -"/software/packages"=pkg_repl("","-",""); - - - -"/software/packages"=pkg_repl("","-",""); - - - diff --git a/org.glite.deployment.jpps/project/version.properties b/org.glite.deployment.jpps/project/version.properties deleted file mode 100644 index 809be8c..0000000 --- a/org.glite.deployment.jpps/project/version.properties +++ /dev/null @@ -1,4 +0,0 @@ - -module.version = 2.2.0 -module.age = 2 - diff --git a/org.glite.deployment.lb/.cvsignore b/org.glite.deployment.lb/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.deployment.lb/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.deployment.lb/CHANGELOG b/org.glite.deployment.lb/CHANGELOG deleted file mode 100644 index 882b0d8..0000000 --- a/org.glite.deployment.lb/CHANGELOG +++ /dev/null @@ -1,40 +0,0 @@ -DATE: 13-03-2006 16:20 -[flammer] Increased version to 2.3.0 after branching. - -DATE: 13-03-2006 16:15 -[flammer] Merge of HEAD with branch 2.1.0 -[flammer] Increased version to 2.2.0 - -DATE: 04-12-2005 21:15 -[dimeglio] Added configuration parameter for setting mysql max_allowed_packet - -DATE: 23-11-2005 23:50 -[dimeglio] Use ConfigParams class -[dimeglio] Removed servietool instabce config params, put instance creation in script - -DATE: 08-07-2005 15:20 -[dimeglio] Merged from branch 1.2.2 - -DATE: 25-05-2005 20:00 -[dimeglio] Merged from branch 1.2.2 - -DATE: 21-03-2005 17:21 -[dimeglio] Implemented status method - -DATE: 21-03-2005 00:32 -[dimeglio] Added PERL5LIB env var - -DATE: 17-03-2005 17:33 -[gdiez] Stopping and starting the database before the index creation (just after the database is created and the user granted) - -DATE: 09-03-2005 23:05 -[dimeglio] Moved creation of indices inside database creation (if database - exists indices are not recreated) - -DATE: 02-03-2005 11:05 -[dimeglio] Started CHANGELOG -[dimeglio] Fixed formatting, improved display of message using glib.printXxxMessage functions -[dimeglio] Fixed some problems when starting/stopping services -[dimeglio] GLITE_USER parameter not exposed anymore in config file, use same user parameters - as WMS to allow installation on same node -[dimeglio] Increased module version number to 1.2.0 \ No newline at end of file diff --git a/org.glite.deployment.lb/LICENSE b/org.glite.deployment.lb/LICENSE deleted file mode 100644 index 259a91f..0000000 --- a/org.glite.deployment.lb/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.deployment.lb/build.xml b/org.glite.deployment.lb/build.xml deleted file mode 100644 index 874c661..0000000 --- a/org.glite.deployment.lb/build.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.lb/config/scripts/glite-lb-config.py b/org.glite.deployment.lb/config/scripts/glite-lb-config.py deleted file mode 100644 index c0158ea..0000000 --- a/org.glite.deployment.lb/config/scripts/glite-lb-config.py +++ /dev/null @@ -1,574 +0,0 @@ -#!/usr/bin/env python -################################################################################ -# -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://eu-egee.org/partners/ for details on the copyright holders. -# For license conditions see the license file or http://eu-egee.org/license.html -# -################################################################################ -# glite-lb-config v. 2.3.0 -# -# Post-installation script for configuring the gLite Logging and Bookkeping Server -# Robert Harakaly < robert.harakaly@cern.ch > -# Diana Bosio -# Leanne Guy -# -# Version info: $Id$ -# -# Usage: python glite-lb-config [-c|-v|-h|--help] -# -c, --checkconf print configuration -# -v, --version print version -# -h,--help print usage info -# --configure configure the service -# --start start the service -# --stop stop the service -# --status show service status -# -# Return codes: 0 - Ok -# 1 - Configuration failed -# -################################################################################ - -import os,string,pwd -import sys, posix, getopt,time - -sys.path.append(".") -from gLiteInstallerLib import gLib -from gLiteInstallerLib import ConfigParams -from gliteRgmaServicetool import gliteRgmaServicetoolInstance -from gliteRgmaServicetool import gliteRgmaServicetool -import mysql as MySQL - -# Set global variables here -global params # all config values from the XML file -global rgmaServicetool - -class glite_lb: - - def __init__(self): - self.mysql = MySQL.Mysql() - self.verbose = 0 - self.version = "2.3.0" - self.name = "glite-lb" - self.friendly_name = "gLite Logging and Bookkeeping" - - #------------------------------------------------------------------------------- - # Banner - #------------------------------------------------------------------------------- - - def banner(self): - - print "\nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" - print "Configuring the %s" % self.friendly_name - print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n" - - #------------------------------------------------------------------------------- - # Copyright - #------------------------------------------------------------------------------- - - def copyright(self): - - print '\nCopyright (c) Members of the EGEE Collaboration. 2004' - print 'See http://eu-egee.org/partners/ for details on the copyright holders' - print 'For license conditions see the license file or http://eu-egee.org/license.html' - - #------------------------------------------------------------------------------- - # Version - #------------------------------------------------------------------------------- - - def showVersion(self): - - print '\n%s-config v. %s\n' % (self.name,self.version) - - #------------------------------------------------------------------------------- - # Usage - #------------------------------------------------------------------------------- - - def usage(self,msg = ""): - - if msg: - print "\n%s" % (msg) - - self.copyright() - self.showVersion() - - print """Usage: \n -Edit the configuration file %s.cfg.xml in -%s/etc.config/templates\n -save it as %s/etc/config/%s.cfg.xml -and run the script as follows\n -python %s-config [OPTION...]""" % (self.name, os.environ['GLITE_LOCATION'], \ - os.environ['GLITE_LOCATION'], self.name, self.name) - - print ' -c, --checkconf print the service configuration' - print ' -v, --version print the version of the configuration script' - print ' -h, --help print this usage information' - print ' --configure configure the service' - print ' --start start the service' - print ' --stop stop the service' - print ' --status check service status' - print '\n' - - #------------------------------------------------------------------------------- - # All the configuration code goes here - #------------------------------------------------------------------------------- - - def start(self): - - self.mysql.start() - time.sleep(5) - - if not os.path.exists('/tmp/mysql.sock'): - os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock') - - pid = glib.getPID('bkserverd') - if pid != 0: - print 'The gLite LB Server service is already running. Restarting...' - os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION']) - else: - print 'Starting the gLite LB Server service...' - - os.system('%s/etc/init.d/glite-lb-bkserverd start' % os.environ['GLITE_LOCATION']) - - pid = glib.getPID('bkserverd') - - if (pid != 0): - print "The gLite LB Server service has been started ", - glib.printOkMessage() - else: - glib.printErrorMessage("Could not start the gLite LB Server service") - glib.printErrorMessage("Please verify and re-run the script "), - glib.printFailedMessage() - return 1 - - #------------------------------------------------------------------- - # Start Servicetool - #------------------------------------------------------------------- - - if params['rgma.servicetool.activate'] == "true": - - errorcode = rgmaServicetool.start() - if (errorcode != 0): - return 1 - - return 0 - - def stop(self): - - error_level = 0 - - pid = glib.getPID('bkserverd') - if (pid != 0): - os.system('%s/etc/init.d/glite-lb-bkserverd stop' % os.environ['GLITE_LOCATION']) - - pid = glib.getPID('bkserverd') - if (pid != 0): - print 'Could not stop the LB Server service ', - glib.printFailedMessage() - error_level = 1 - else: - print 'The LB Server service has been stopped ', - glib.printOkMessage() - - #------------------------------------------------------------------- - # MySQL - #------------------------------------------------------------------- - - self.mysql.stop() - - #------------------------------------------------------------------- - # Servicetool - #------------------------------------------------------------------- - - if params['rgma.servicetool.activate'] == "true": - - if rgmaServicetool.stop(): - error_level = 1 - - return error_level - - def status(self): - - error_level = 0 - - retval = os.system('%s/etc/init.d/glite-lb-bkserverd status' % os.environ['GLITE_LOCATION']) - if retval != 0: - error_level = 1 - - #------------------------------------------------------------------- - # Servicetool - #------------------------------------------------------------------- - - if params['rgma.servicetool.activate'] == "true": - - if rgmaServicetool.status() != 0: - error_level = 1 - - return error_level - - def configure(self): - - #-------------------------------------------------------- - # Installs the Security Utilities - #-------------------------------------------------------- - - if os.system("python %s/glite-security-utils-config.py --subservice" % glib.getScriptPath()): - print "\nConfiguring gLite Security Utilities ", - glib.printFailedMessage() - else: - print "\nConfiguring gLite Security Utilities ", - glib.printOkMessage() - - # Create the GLITE_USER if it doesn't exists - print "\nCreating/Verifying the GLITE_USER account %s" % os.environ['GLITE_USER'] - (uid,gid) = glib.get_user_info(os.environ['GLITE_USER']) - glib.check_dir(os.environ['GLITE_LOCATION_VAR'],0755, uid, gid) - lb_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path'] - glib.check_dir(lb_cert_path ,0755, uid, gid) - glib.printOkMessage() - - # Create all directories needed - glib.check_dir(os.environ['GLITE_CERT_DIR']) - print "\nVerify CA certificates directory ", - glib.printOkMessage() - - # Copy certificates - print "\nCopy host certificates to GLITE_USER home directory as service certificates", - os.system("cp %s %s %s/" % (params['host.certificate.file'], params['host.key.file'], lb_cert_path)) - os.chown("%s/hostcert.pem" % lb_cert_path, uid,gid) - os.chmod("%s/hostcert.pem" % lb_cert_path, 0644) - os.chown("%s/hostkey.pem" % lb_cert_path, uid,gid) - os.chmod("%s/hostkey.pem" % lb_cert_path, 0400) - glib.printOkMessage() - - #-------------------------------------------------------- - # Configure MySQL - #-------------------------------------------------------- - - # Set mysql parameters - #self.mysql.setConfiguration('mysql','loose-max_allowed_packet',params['mysql.max_allowed_packet']) - self.mysql.setConfiguration('mysqld','max_allowed_packet',params['mysql.max_allowed_packet']) - - # start MySQL - self.mysql.stop() - time.sleep(5) - self.mysql.start() - - if not os.path.exists('/tmp/mysql.sock'): - os.symlink('/var/lib/mysql/mysql.sock', '/tmp/mysql.sock') - - # ------------------------------------------------------------ - # Check password of MySQL - # ------------------------------------------------------------ - - self.mysql_root_password = params['mysql.root.password'] - if not params.has_key('set.mysql.root.password'): - params['set.mysql.root.password'] = 'false' - setempty = params['set.mysql.root.password'] - if self.mysql.checkMySQLConfiguration(self.mysql_root_password,setempty): - return 1 - - # Create the MySQL database - print "\nCreate/Verify the %s database" % params['lb.database.name'] - - # Check if database exists - if self.mysql.existsDB(params['lb.database.name'],self.mysql_root_password) != 0: - # Create database - print ('\n==> Creating MySQL %s database\n' % params['lb.database.name']) - - if os.path.exists('/bin/rm /tmp/mysql_ct'): - os.remove('/tmp/mysql_ct') - - file = open('/tmp/mysql_ct', 'w') - - self.mysql.add_user(params['lb.database.name'],params['lb.database.username'],"",self.mysql_root_password) - text = ['USE %s;\n' % params['lb.database.name'], - '\. %s/etc/glite-lb-dbsetup.sql\n' % os.environ['GLITE_LOCATION']] - - file.writelines(text) - file.close() - os.system('/usr/bin/mysql -p%s < /tmp/mysql_ct' % self.mysql_root_password) - os.system('/bin/rm /tmp/mysql_ct') - - #Starting and stopping the database before the index creation - self.mysql.stop() - time.sleep(5) - self.mysql.start() - - #Creating the indexes - print 'Creating the index configuration file %s/etc/glite-lb-index.conf ' % os.environ['GLITE_LOCATION'], - path = "%s/etc/glite-lb-index.conf" % os.environ['GLITE_LOCATION'] - pathBak = "%s/etc/glite-lb-index.conf.bak" % os.environ['GLITE_LOCATION'] - - if os.path.exists(pathBak): - os.remove(pathBak) - if os.path.exists(path): - os.rename(path,pathBak) - file = open(path, 'w') - file.write("[\n") - file.write(" JobIndices = {\n") - for index in params['lb.index.list']: - file.write(" [ type = \"system\"; name = \"%s\" ],\n" % index) - file.write(" }\n") - file.write("]\n") - file.close() - glib.printOkMessage() - - print "Running glite-lb-bkindex ", - if os.system('%s/bin/glite-lb-bkindex -r %s/etc/glite-lb-index.conf' % (os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])): - glib.printFailedMessage() - return 1 - else: - glib.printOkMessage() - - else: - print "\n==> MySQL database %s already exist\n" % params['lb.database.name'] - - self.mysql.stop() - - #------------------------------------------------------------------- - # RGMA servicetool: configure servicetool - #------------------------------------------------------------------- - - if params['rgma.servicetool.activate'] == "true": - - # Instantiate the rgma-servicetool class - rgmaServicetool = gliteRgmaServicetool() - rgmaServicetool.verbose = self.verbose - - # Create Local Logger instance - serviceId = "%s_%s" % (glib.fq_hostname, params['lbserver.serviceType']) - servicetoolInstance = gliteRgmaServicetoolInstance(glib, serviceId) - - # set params - servicetoolInstance.setServiceName(params['lbserver.serviceName']) - servicetoolInstance.setServiceType(params['lbserver.serviceType']) - servicetoolInstance.setServiceVersion(self.version) - servicetoolInstance.setStatusScript(params['lbserver.statusScript']) - servicetoolInstance.setEndpoint(params['lbserver.endpoint']) - - # add instance to the gLite configuration - if servicetoolInstance.add() == 1: - return 1 - - # Configure servicetool - if rgmaServicetool.configure(glib): - # error in configuring servicetool - return 1 - - return 0 - -#------------------------------------------------------------------------------- -# Set all environment variables -#------------------------------------------------------------------------------- - -def loadDefaults(params): - - params['GLITE_LOCATION'] = "/opt/glite" - params['mysql.root.password'] = "" - params['lb.database.name'] = "lbserver20" - params['lb.database.username'] = "lbserver" - params['mysql.max_allowed_packet'] = "17" - - params['lbserver.serviceName'] = 'LB Server service at %s' % glib.fq_hostname - params['lbserver.serviceType'] = 'org.glite.lb.server' - params['lbserver.statusScript'] = '%s/etc/init.d/glite-lb-bkserverd status' % params['GLITE_LOCATION'] - params['lbserver.endpoint'] = 'not available' - -def set_env(): - - # gLite - glib.export('GLITE_LOCATION'); - glib.export('GLITE_LOCATION_VAR'); - if not os.path.exists(os.environ['GLITE_LOCATION_VAR']): - os.mkdir(os.environ['GLITE_LOCATION_VAR'],0755) - glib.export('GLITE_LOCATION_LOG'); - if not os.path.exists(os.environ['GLITE_LOCATION_LOG']): - os.mkdir(os.environ['GLITE_LOCATION_LOG'],0755) - glib.export('GLITE_LOCATION_TMP'); - if not os.path.exists(os.environ['GLITE_LOCATION_TMP']): - os.mkdir(os.environ['GLITE_LOCATION_TMP'],0755) - - if not params.has_key('glite.user.group'): - params['glite.user.group'] = '' - (uid,gid) = glib.add_user(params['glite.user.name'],params['glite.user.group']) - glib.export('GLITE_USER',params['glite.user.name']) - lb_cert_path = pwd.getpwnam(os.environ['GLITE_USER'])[5] + "/" + params['user.certificate.path'] - glib.export('GLITE_HOST_CERT',"%s/hostcert.pem" % lb_cert_path) - glib.export('GLITE_HOST_KEY',"%s/hostkey.pem" % lb_cert_path) - glib.export('GLITE_CERT_DIR',params['ca.certificates.dir']) - - glib.export('GLOBUS_LOCATION',params['GLOBUS_LOCATION']) - glib.export('GPT_LOCATION',params['GPT_LOCATION']) - - glib.export('JAVA_HOME') - - # bin and lib paths - glib.addEnvPath("PATH","/usr/bin/:%s/bin:%s/bin:%s/externals/bin:%s/bin" \ - % (os.environ['JAVA_HOME'],os.environ['GLOBUS_LOCATION'],os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])) - glib.addEnvPath("LD_LIBRARY_PATH","/usr/lib:%s/lib:%s/externals/lib:%s/lib" % (os.environ['GLOBUS_LOCATION'], os.environ['GLITE_LOCATION'],os.environ['GLITE_LOCATION'])) - - # Perl - glib.addEnvPath("PERL5LIB", "%s/lib/perl:%s/lib/perl5" % (os.environ['GPT_LOCATION'],os.environ['GLITE_LOCATION'])) - - # Set environment - glib.setUserEnv() - -#------------------------------------------------------------------------------- -# Main program begins here -#------------------------------------------------------------------------------- - -if __name__ == '__main__': - - # The script must be run as root - if not os.geteuid()==0: - print '"\nThis script must be run as root\n' - sys.exit(1) - - # Get an instance of the ConfigParams class - params = ConfigParams() - - # Get an instance of the library class - glib = gLib() - - # Load parameters - loadDefaults(params) - try: - opts, args = glib.getopt(sys.argv[1:], '', ['siteconfig=']) - for o, a in opts: - if o == "--siteconfig": - params['site.config.url'] = a - break - except getopt.GetoptError: - pass - if glib.loadConfiguration(["%s/../glite-lb.cfg.xml" % glib.getScriptPath(), \ - "%s/../glite-rgma-servicetool.cfg.xml" % glib.getScriptPath()],params): - print "An error occurred while configuring the service" - sys.exit(1) - - verbose = 0 - if params.has_key('glite.installer.verbose'): - if params['glite.installer.verbose'] == "true": - verbose = 1 - glib.verbose = verbose - - # Set up the environment - set_env() - - # Instantiate the service classes - service = glite_lb() - service.verbose = verbose - # Instantiate the rgma servicetool class - rgmaServicetool = gliteRgmaServicetool() - rgmaServicetool.verbose = verbose - - # Command line opts if any - try: - opts, args = glib.getopt(sys.argv[1:], 'chv', ['checkconf', 'help', 'version','configure','stop','start','status','siteconfig=']) - except getopt.GetoptError: - service.usage(msg = "Unknown options(s)") - sys.exit(1) - - if len(opts) == 0: - service.usage() - sys.exit(0) - - # Check cli options - for o, a in opts: - - if o in ("-h", "--help"): - service.usage() - sys.exit(0) - - if o in ("-v", "--version"): - service.showVersion() - sys.exit(0) - - if o in ("-c", "--checkconf"): - service.copyright() - service.showVersion() - glib.print_params(params) - print - rgmaServicetool.showServices() - sys.exit(0) - - if o == "--configure": - - # Check certificates - if params.has_key('glite.installer.checkcerts'): - if params['glite.installer.checkcerts'] == "true": - if glib.check_certs(params) != 0: - print "An error occurred while configuring the %s service" \ - % service.friendly_name - sys.exit(1) - - # Print configuration parameters - if verbose: - glib.print_params(params) - - service.copyright() - service.showVersion() - service.banner() - - # Stop all services - glib.printInfoMessage("\n\nStopping all running LB services...") - service.stop() - - # Configure the service - return_result = service.configure() - - if return_result == 0: - - # Stop all services - glib.printInfoMessage("\n\nStopping all running LB services...") - service.stop() - - print "\n\nThe %s configuration was successfully completed\n" % service.friendly_name - print "You can now start the service using the --start option of this script\n\n" - glib.registerService() - - sys.exit(0) - - elif return_result == 2: - - # Stop all services - glib.printInfoMessage("\n\nStopping all running LB services...") - service.stop() - - print "\n\nThe %s configuration was completed,\n" % service.friendly_name - print "but warnings were issued. Please revise them and re-run the script\n" - print "or configure LB manually\n" - - sys.exit(2) - - else: - print "\n\nAn unrecoverable error occurred while configuring the %s" \ - % service.friendly_name - - sys.exit(1) - - if o in ("start", "--start"): - # Start the service - if service.start() == 0: - print "\n\nThe %s was successfully started " % service.friendly_name, - glib.printOkMessage() - sys.exit(0) - else: - print "\n\nAn error occurred while starting the %s " % service.friendly_name, - glib.printFailedMessage() - sys.exit(1) - - if o in ("stop", "--stop"): - # Stop the service - if service.stop() == 0: - print "\n\nThe %s was successfully stopped " % service.friendly_name, - glib.printOkMessage() - sys.exit(0) - else: - print "\n\nAn unrecoverable error occurred while stopping the %s " % service.friendly_name, - glib.printFailedMessage() - sys.exit(1) - - if o == "--status": - sys.exit(service.status()) - diff --git a/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml b/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml deleted file mode 100644 index 4e11e33..0000000 --- a/org.glite.deployment.lb/config/templates/glite-lb.cfg.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - owner - location - destination - - - - - - diff --git a/org.glite.deployment.lb/doc/release_notes/release_notes.doc b/org.glite.deployment.lb/doc/release_notes/release_notes.doc deleted file mode 100644 index 2ad2d4d1bf359419707777ee266496f87aa65f73..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 192512 zcmeF42S8KT_s4HSAb=psaF0}R3$k3e5Cu_jfuk-kK!7OA1XQfMR;_hZ+uGI+t=c;3 zsC(2=M_v83?rrO;t1hh8E&RXdy}aZ-NDwLdSDWaEymjX}_uO;uyYFTHzLICZSzhiO z%k^o_Y*==V1G5tyx52hvW;jrSu?%d}Zgx&i4joOy&Oo38IAs021~qW~+pTP5KL-V4 z4_vqKqJ?Dff#7>~Vyrle=^xYo()df``IF+m4vJE&wyTVdy}>xjhw^8uky400uGl6$ z%E@st9<{VBTriK@*k6_3r*H8#9Sy3%pA&z(^M|;Fe;D7M_^t9zJ=?AZ;Ds^ z$z8ufd4+3ee>WsM7U4?aVAN{SXxA)bEK8JmqD!amiH_#?z4K30%z zp*)u2qj*oEK1ct-m=8?Yf@+Mdqllp&K?O;`!Zk-OFjfKQgz}7qzBpk&=niUw zwgEx!#{R(A+c>}c9Akl^I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deleted file mode 100644 index 01ee3f4..0000000 --- a/org.glite.deployment.lb/doc/release_notes/release_notes.html +++ /dev/null @@ -1,2712 +0,0 @@ - - - - - -gLite LB Server Release Notes - - - - - - -
- -

gLite Logging & Bookkeeping Server

- -

1. Release Description

- -

This release contains the gLite Logging & Bookkeeping -Server module v. 2.1.1. The following sections provide additional information about -the release content, the module dependencies, the know bugs and issues and a -list of bugs closed since the previous release. For information about -installing and using the gLite Logging & Bookkeeping Server, please refer -to the gLite Installation and User Guides.

- -

2. Changes in this release

- -

2.1. Changes in functionality

- -

There are no functional changes in this -release.

- -

2.2. Changes in Configuration

- -

The following new parameters have been -added to the glite-lb.cfg.xml file:

- -

 

- - - - - - - - - - - - - - - - - - - - - - -
-

Parameter name

-
-

Default value

-
-

Description

-
-

rgma.servicetool.activate

-
-

true

-
-

Turn on/off servicetool for the node.

-

[Example: true ] [Type: 'boolean']

-
-

set.mysql.root.password

-
-

false

-
-

If this parameter is true, then the root - password of the mysql database is set to the value specified in - mysql.root.password if it not yet set. This parameter has       no effect if - the database root password is already set. It can be used to ease automated installation - and configuration of the service, if mysql is not managed in some other way.

-

[Example: false][Type: boolean]

-
-

mysql.max_allowed_packet

-
-

17

-
-

This parameter allows to set the - max_allowed_packet parameter in the mysql configuration file /etc/my.cnf. The - default recommended value for the LB server is 17MB.

-

[Example: 17][Type: Integer][Unit: MB]

-
- -

 

- -

The R-GMA Service Publisher (aka R-GMA -servicetool) parameters are now automatically handled by the configuration -script and do not need to be explicitly set anymore in the configuration file. -The parameters can be set in the configuration file to override the default -values.

- -

 

- -

3. Release contents

- -

3.1. Glite sub-deployment modules

- -

The gLite Logging and Bookkeeping module requires the -following sub-modules:

- -

 

- -

-          -gLite Security Utilities

- -

-          -gLite R-GMA Servicetool

- -

 

- -

The sub-modules are automatically installed with the LB -module. For more information about these sub-modules please refer to the -specific release notes and installation instructions.

- -

3.2. Glite RPMS

- -

The gLite Logging & Bookkeeping Server v. 2.1.1 is -composed of the following gLite components:

- -

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Component name

-
-

Description

-
-

Version

-
-

File

-
-

glite-config

-
-

gLite configuration scripts

-
-

1.6.22

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/noarch/RPMS/glite-config-1.6.22-1.noarch.rpm

-
-

glite-jp-common

-
-

 

-
-

1.1.0

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-jp-common-1.1.0-1.i386.rpm

-
-

glite-jp-primary

-
-

 

-
-

1.1.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-jp-primary-1.1.1-1.i386.rpm

-
-

glite-jp-server-common

-
-

 

-
-

1.0.0

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-jp-server-common-1.0.0-1.i386.rpm

-
-

glite-jp-ws-interface

-
-

 

-
-

1.1.0

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-jp-ws-interface-1.1.0-0.i386.rpm

-
-

glite-lb-client-interface

-
-

L&B client library header files

-
-

2.1.0

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-client-interface-2.1.0-1.i386.rpm

-
-

glite-lb-config

-
-

gLite LB Configuration files

-
-

2.1.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-config-2.1.1-1.i386.rpm

-
-

glite-lb-common

-
-

L&B common subroutines library

-
-

3.0.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-common-3.0.1-1.i386.rpm

-
-

glite-lb-logger

-
-

L&B local logger

-
-

1.2.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-logger-1.2.1-1.i386.rpm

-
-

glite-lb-server

-
-

L&B bookkeeping server

-
-

1.3.3

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-server-1.3.3-1.i386.rpm

-
-

glite-lb-server-bones

-
-

L&B server bones

-
-

2.1.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-server-bones-2.1.1-1.i386.rpm

-
-

glite-lb-ws-interface

-
-

 

-
-

2.1.0

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-lb-ws-interface-2.1.0-1.i386.rpm

-
-

glite-rgma-servicetool-config

-
-

gLite R-GMA servicetool installation

-
-

5.2.2

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/noarch/RPMS/glite-rgma-servicetool-config-5.2.2-1.noarch.rpm

-
-

glite-security-gsoap-plugin

-
-

gSOAP plugin and gss libraries

-
-

1.2.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-security-gsoap-plugin-1.2.1-0.i386.rpm

-
-

glite-security-utils-config

-
-

gLite Security Utilities configuration files

-
-

1.2.1

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/noarch/RPMS/glite-security-utils-config-1.2.1-1.noarch.rpm

-
-

glite-security-voms-api-c

-
-

 

-
-

1.6.10

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-security-voms-api-c-1.6.10-0.i386.rpm

-
-

glite-wms-utils-exception

-
-

 

-
-

1.0.3

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-wms-utils-exception-1.0.3-1.i386.rpm

-
-

glite-wms-utils-jobid

-
-

 

-
-

1.0.2

-
-

http://glite.web.cern.ch/glite/packages/R1.5/R20051130/bin/rhel30/i386/RPMS/glite-wms-utils-jobid-1.0.2-1.i386.rpm

-
- -

4. Dependencies

- -

The gLite Logging & Bookkeeping Server v. 2.1.1 module -has the following dependencies:

- -

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Component name

-
-

Description

-
-

Version

-
-

RPM file name

-
-

c-ares

-
-

A library that performs asynchronous DNS operations

-
-

1.3.0

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/c-ares-1.3.0-1.slc3.i386.rpm

-
-

gpt

-
-

The Grid Packaging Toolkit (GPT)

-
-

VDT1.2.2rh9

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gpt-VDT1.2.2rh9-1.i386.rpm

-
-

gridsite

-
-

GridSite

-
-

1.1.15

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/gridsite-1.1.15-1.i386.rpm

-
-

j2re

-
-

Java JRE

-
-

1.4.2

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/j2re-1_4_2_08-linux-i586.rpm

-
-

myproxy

-
-

Credential repository for the Grid.

-
-

1.14

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/myproxy-1.14-EGEE.i386.rpm

-
-

MySQL-client

-
-

MySQL - Client

-
-

4.1.11

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-client-4.1.11-0.i386.rpm

-
-

MySQL-server

-
-

MySQL

-
-

4.1.11

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/MySQL-server-4.1.11-0.i386.rpm

-
-

perl-Expect.pm

-
-

Expect.pm module for perl (./id/A/AU/AUSCHUTZ)

-
-

1.01

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/perl-Expect.pm-1.01-9.i386.rpm

-
-

vdt_globus_essentials

-
-

Virtual Data Toolkit

-
-

VDT1.2.2rh9

-
-

http://glite.web.cern.ch/glite/packages/externals/bin/rhel30/RPMS/vdt_globus_essentials-VDT1.2.2rh9-1.i386.rpm

-
- -

 

- -

5. Known bugs and issues

- -

This -release has the following bugs and issues. Bug numbers refer to the gLite Bug -Tracking system database hosted on the CERN Savannah system at Hhttps://savannah.cern.ch/bugs/?group=jra1mdwH .

- -

 

- -
    -
  • There is an infinite loop during - the initialization of the LB_Events data structure
  • -
  • No removal procedure is provided - with this release apart from the removal of the RPMS. Any account, group - or other resource created during the module configuration must be manually - cleaned.
  • -
- -

 

- -

Known open bugs:

- -

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Bug number

-
-

Description

-
-

 

-
-

 #7324

-
-

lb-bkserver is running with no - pid

-
-

 

-
-

 #9701

-
-

erroneous rpath in several - shared objects

-
-

 

-
-

 #9777

-
-

unable to get logging-info -2 - info for 1000 jobs

-
-

 

-
-

 #10781

-
-

Missing the timestamps of - 'Scheduled' and 'Running' status

-
-

 

-
-

 #11535

-
-

Job submission extremely slow

-
-

 

-
-

 #13418

-
-

problem in computing status (of - resubmitted jobs)

-
-

 

-
-

 #13492

-
-

Job State Information Log File

-
-

 

-
-

 #13832

-
-

Default mysql configuration - imposes unnecessary limits on LB server

-
-

 

-
-

 #13879

-
-

Some data do not propagate from - lbproxy to bkserver...

-
-

 

-
-

 #13929

-
-

The glite-lb-bkserverd has - wrong default for var directory

-
-

 

-
-

 #13951

-
-

lb proxy sends garbage response - on error

-
-

 

-
-

 #13988

-
-

Failed to start - glite-lb-locallogger on glite 1.4.1

-
-

 

-
-

 #14247

-
-

No events are found querying LB - for events satisfying jobid and source instance

-
-

 

-
-

 #14339

-
-

Wrong computing state when - proxy expires

-
-

 

-
- -

 

- -

Bugs fixed in this or previous releases, but not yet officially -tested:

- -

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Bug number

-
-

Description

-
-

 

-
-

 #7307

-
-

lb config script does _not_ fail - if mysql root password is set

-
-

 

-
-

 #7305

-
-

lb.database.username paramenter in - config file

-
-

 

-
-

 #7300

-
-

update of the lb instructions at - the end of the installer script

-
-

 

-
-

 #7053

-
-

LB configuration fails if the - mysql root pwd is set

-
-

 

-
-

 #13928

-
-

org.glite.lb.server depends on - full VOMS package instead of individual APIs packages

-
-

 

-
-

 #13048

-
-

interlogger does not handle errors - from bookkeeping server

-
-

 

-
-

 #12648

-
-

The memory usage of one LB process - keeps growing

-
-

 

-
-

 #11387

-
-

LBProxy SIGSEGV

-
-

 

-
-

 #11050

-
-

Too heavy locallogger retry - strategy

-
-

 

-
-

 #9183

-
-

Broken connections in LB contect - connection pool

-
-

 

-
-

 #9135

-
-

The interlogd has problem sending - event to the LB server

-
-

 

-
-

 #8630

-
-

EDG_WL_* variables in LB library

-
-

 

-
-

 #7910

-
-

Duplicate apostroph in MySQL calls

-
-

 

-
-

 #11509

-
-

glite-lb-config.py overwrites - HOSTNAME_org.glite.wms.workloadmanager.service with the wrong WMS version

-
-

 

-
-

 #10686

-
-

MySQL library fails on hostnames - containing dashes

-
-

 

-
- -

 

- -

6. Bugs closed since last release

- -

This -release fixes the following bugs and issues. Bug numbers refer to the gLite Bug -Tracking system database hosted on the CERN Savannah system at Hhttps://savannah.cern.ch/bugs/?group=jra1mdwH  

- -

 

- - - - - - - - - - - - - - - - - - - - - - - - - - - -
-

Bug number

-
-

Description

-
-

 

-
-

 #6722

-
-

glite-job-status -all doesn't - work

-
-

 

-
-

 #7237

-
-

Intermittent errors with job - submission

-
-

 

-
-

 #9148

-
-

Job stays 'Submitted' forever

-
-

 

-
-

 #10730

-
-

Error on glite-job-submit

-
-

 

-
- -

 

- -
- - - - diff --git a/org.glite.deployment.lb/doc/release_notes/release_notes.pdf b/org.glite.deployment.lb/doc/release_notes/release_notes.pdf deleted file mode 100644 index c512e91ddfd865b103c95e44d4642062ba7b9b67..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 157326 zcmdSB1yogE_b7UhEHmJ; zyZ4Rp-aCxVUVE;bJ=fZ6Z8A9_5n4t%7G$!;rM@9#1V&B<4nhV(8v}D59(plN4pw$T zMn-l{ZF(s)YoNZpnH$iEkda=PkdcFviGyB>kdc+0nTd^FhLD9`mXMK?k%?XjRDlyz zhnE)_Xl(>)2$}G2KV$?Kd!X^po|xE?5g2~{7}*H#Q-s#PU`$M`%>RTjfQR(Ya;$8e z|AMhIGX4|B3>wzIU~G&`|AKL{gNOkB{W%sEW_Ff;!PtKT^FQgr$iT+% zPnt3^vM~LVri`pCEdRuVk&Wr!_%bmt|D~Lxy}p?x&>k59B#nw7;RA^nGb_EEJ<$1H z${1Ma)f9lnijG!<;Cl25Ha3o+A`BpG2o>nXt&MF6nK(hi13w69@)&WlF>^8+b1<<0 z*;$Pk3_y8CtQ<^0HZ~y8kktUl%VT8B3}j_z2O1k0071+(&}U_0F=Pg^Gcz#jGZ`5e z^J;^{8o|L)-`?>-iW!g*$jF3cMUWBxA><$(0P**yB1r+QO&m=L85uYj=tayd9f9`r zB9{7&Kp~)^jS-Mu5R}8p3DzbC7G|&>F)*>yD-yD@a`5sxINAgCtw2gM8LVU>rD%fX zDYkQ2?PN#QWo`85Q)}mK;n8E!O^oM*>0oxs=3wY}LWR zJw-33+RQ7MpcyGEl)u-Ja+6>&8&uSAMhf>fC~8+&)@*-!)4;p8<2rc63Jo9!Silwm zT5P=8uc2*TH9^Sg5ttm|eEGJ<9*&wZVeRkrDlV)o@#_(7Qr-olKSj5fy4m*QphZhH z-F5pBQp88zJop4p0Z_s0=XU1)6G&yDRJ!$+d||^2#b4}_c_^6k+K21Ybx*8G`+~|x zlFQON&Y!xTC=bdna3zku=u;o(p^_E~3Yj=Ugs3@2J&I@h#!)QoW>8bjm~E&-3*Ue~ z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org.glite.deployment.lb/project/.cvsignore deleted file mode 100644 index caf4eaa..0000000 --- a/org.glite.deployment.lb/project/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -glite-lb.sdf.xml diff --git a/org.glite.deployment.lb/project/build.number b/org.glite.deployment.lb/project/build.number deleted file mode 100644 index 306b97f..0000000 --- a/org.glite.deployment.lb/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Mon Mar 13 07:52:27 CET 2006 -module.build=0326 diff --git a/org.glite.deployment.lb/project/build.properties b/org.glite.deployment.lb/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.deployment.lb/project/glite-lb.sdf.xml.template b/org.glite.deployment.lb/project/glite-lb.sdf.xml.template deleted file mode 100644 index 48d94a7..0000000 --- a/org.glite.deployment.lb/project/glite-lb.sdf.xml.template +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.lb/project/lxscript-rpm.xsl b/org.glite.deployment.lb/project/lxscript-rpm.xsl deleted file mode 100644 index c661ad7..0000000 --- a/org.glite.deployment.lb/project/lxscript-rpm.xsl +++ /dev/null @@ -1,336 +0,0 @@ - - - - - - - - - - - - - -#!/bin/sh - -# Copyright (c) Members of the EGEE Collaboration. 2004 -# See http://eu-egee.org/partners/ for details on the copyright holders -# For license conditions see the license file or http://eu-egee.org/license.html - -# glite-lb_installer v. -# -# The glite-lb_installer installs the gLite Logging and Bookkeeping Server -# -# Usage: glite-lb_installer [-u|-v|--help] -# -u uninstall -# -v print version -# --help print script usage info -# Return codes: 0 - Ok -# 1 - if a file could not be downloaded - -############################################################################### - -#Parse the RPMLIST to strip out the RPMS that are already installed -function parseRPMList() -{ - newRPMLIST="" - localRPMLIST=`rpm -qa` - for i in $RPMLIST - do - g=`echo $i | sed -e 's/\.i386\.rpm//g'` - g=`echo $g | sed -e 's/\.noarch\.rpm//g'` - if [ -z "`echo $localRPMLIST | grep $g`" ]; then - newRPMLIST="${newRPMLIST} $i" - else - echo "$i is already installed. It will be skipped." - fi - done - - RPMLIST=$newRPMLIST -} - -#Parse the SCRIPTLIST to execute all scripts -function parseScriptList() -{ - for i in $SCRIPTLIST - do - if [ "$INSTALL" = "true" ]; then - $i - else - $i -u - fi - done -} - -#Downloads and install the module RPMS -function install() -{ - - INSTALL=true - version - echo - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, downloading the gLite Logging and Bookkeeping Server... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - - mkdir -p glite-lb - cd glite-lb - - # Download global dependencies - - - true - - - - - - # Download scripts from repository - - - true - - - - - # Download dependencies RPMS from repository - - - true - - - - # Download RPMS from repository - - - true - - - - - - # Download and install subservices - parseScriptList - - - # Install all RPMS - echo - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, installing the gLite Logging and Bookkeeping Server... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - parseRPMList - if [ ! -z "$RPMLIST" ]; then - rpm -Uvh $RPMLIST - rpm_return=$? - else - echo All required RPMS are already installed - rpm_return=0 - fi - if [ "$rpm_return" == "0" ]; then - echo - echo Done! - echo - echo Before using the gLite LB, please create or update the configuration - echo files /opt/glite/etc/config/glite-lb.cfg.xml - echo and /opt/glite/etc/config/glite-global.cfg.xml - echo and run the configuration script - echo /opt/glite/etc/config/scripts/glite-lb-config.py. - echo A template is provided in - echo /opt/glite/etc/config/templates/glite-lb.cfg.xml - echo Alternatively site configuration files can be used - else - echo - echo An error occurred while installing the LB RPMS. - echo Most likely one or more of the RPMS to be installed require - echo additional dependencies or are older than already installed packages. - echo Please refer to the rpm error message above for more details. - fi - echo - echo For more information refer to the gLite Installation and User Guides - echo or to the gLite web site \(http:\/\/www.glite.org\) - echo Please report problems and comments to the gLite Team at - echo glite-bugs@cern.ch - - cd .. -} - -############################################################################### -function uninstall() -{ - version - - # Global dependencies - - - false - - - - - - # dependencies RPMS from repository - - - false - - - - # RPMS from repository - - - false - - - - - - # Uninstall all RPMS - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo x Please wait, uninstalling the gLite Logging and Bookkeeping Server... x - echo xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx - echo - rpm -ev $RPMLIST - if [ "$?" == "0" ]; then - echo - echo Done! - else - echo - echo An error occurred while removing the LB RPMS. - echo Most likely one or more of the RPMS to be removed have - echo dependent packages. - echo Please refer to the rpm error message above for more details. - fi -} - -############################################################################### -function usage() -{ - echo - echo Copyright \(c\) Members of the EGEE Collaboration. 2004 - echo See http://eu-egee.org/partners/ for details on the copyright holders - echo For license conditions see the license file or http://eu-egee.org/license.html - echo - echo glite-lb_installer v. - echo - echo The glite-lb_installer installs the gLite Logging and Bookkeeping Server - echo - echo Usage: glite-lb_installer \[-u\|-v\|--help\] - echo -u uninstall - echo -v print version - echo --help print script usage info - echo - echo Return codes: - echo 0 - Ok - echo 1 - if a file could not be downloaded - echo -} - -############################################################################### -function version -{ - echo - echo Copyright \(c\) Members of the EGEE Collaboration. 2004 - echo See http://eu-egee.org/partners/ for details on the copyright holders - echo For license conditions see the license file or http://eu-egee.org/license.html - echo - echo glite-lb_installer v. - echo -} - - -RPMLIST= - -############################################################################### -# Main - -while getopts uvh opt -do - case $opt in - 'u') uninstall - exit 0 - ;; - 'v') version - exit 0 - ;; - 'h') usage - exit 0 - ;; - esac -done - -install - -exit 0 - - - - - _installer.sh - - -wget -N -nv -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -chmod u+x -SCRIPTLIST="$SCRIPTLIST ./" - - -SCRIPTLISTUn="$SCRIPTLISTUn ./ -u " - - - - - - - - --..rpm - -- - - -wget -N -nv -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -RPMLIST="$RPMLIST " - - -RPMLIST="$RPMLIST " - - - - - - - --..rpm - -- - - -wget -N -nv /RPMS/ -if [ ! -f "" ] -then - echo - echo ERROR: could not be downloaded! - exit 1 -fi -RPMLIST="$RPMLIST " - - -RPMLIST="$RPMLIST " - - - - - diff --git a/org.glite.deployment.lb/project/lxscript-tgz.xsl b/org.glite.deployment.lb/project/lxscript-tgz.xsl deleted file mode 100644 index 5b55e40..0000000 --- a/org.glite.deployment.lb/project/lxscript-tgz.xsl +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - -#!/bin/sh -# -# glite-lb_tgz_installer -# usage: glite-lb_tgz_installer [-u] -# -u uninstall -# -# glite-lb_tgz_installer installs the gLite Deployment Unit from biniary tarballs -# - -PREFIX=/opt/glite - -############################################################################### -# Download global dependencies - - - -############################################################################### - - -############################################################################### -# Download dependencies RPMS from repository - - - -############################################################################### -# Download RPMS from repository - - - -############################################################################### - - - - - - --..rpm -wget - - - - -_bin.tar.gz -wget i386/tgz/ -tar -xzf $PREFIX - - - diff --git a/org.glite.deployment.lb/project/properties.xml b/org.glite.deployment.lb/project/properties.xml deleted file mode 100644 index ef87369..0000000 --- a/org.glite.deployment.lb/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.deployment.lb/project/quattor-template.xsl b/org.glite.deployment.lb/project/quattor-template.xsl deleted file mode 100644 index 74f841d..0000000 --- a/org.glite.deployment.lb/project/quattor-template.xsl +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - -template pro_software_glite_lb; - -# -# Copyright (c) Members of the EGEE Collaboration. 2004 -# See http://eu-egee.org/partners/ for details on the copyright holders -# For license conditions see the license file or http://eu-egee.org/license.html -# -# glite-lb Quattor template v. -# - -## CAs - -include pro_software_glite_CA; - - - -# Global dependencies - - - - - - -# dependencies - - - - -# RPMS - - - - - -include pro_software_; - - - - - - - -"/software/packages"=pkg_repl("","-",""); - - - -"/software/packages"=pkg_repl("","-",""); - - - diff --git a/org.glite.deployment.lb/project/version.properties b/org.glite.deployment.lb/project/version.properties deleted file mode 100644 index bb1d337..0000000 --- a/org.glite.deployment.lb/project/version.properties +++ /dev/null @@ -1,4 +0,0 @@ - -module.version = 2.3.0 -module.age = 0 - \ No newline at end of file diff --git a/org.glite.jp.client/.cvsignore b/org.glite.jp.client/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.jp.client/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.jp.client/Makefile b/org.glite.jp.client/Makefile deleted file mode 100644 index 4ae5e84..0000000 --- a/org.glite.jp.client/Makefile +++ /dev/null @@ -1,188 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -jpprefix=jp -package=glite-jp-client -version=0.0.0 -PREFIX=/opt/glite - -glite_location=/opt/glite -globus_prefix=/opt/globus -nothrflavour=gcc32 -thrflavour=gcc32pthr -gsoap_prefix=/software/gsoap-2.6 - -CC=gcc - --include Makefile.inc - -STAGETO=include/${globalprefix}/${jpprefix} - -VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/project$:${top_srcdir}/interface:${stagedir}/interface:${top_srcdir}/build - -ifdef JP_PERF - JP_PERF_CFLAGS:=-DJP_PERF=1 -endif - -GLOBUS_LIBS:=-L${globus_prefix}/lib \ - -lglobus_ftp_client_${nothrflavour} \ - -lglobus_ftp_control_${nothrflavour} - -GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour} - -DEBUG:=-g -O0 -DDEBUG - -CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${libtar}/include ${JP_PERF_CFLAGS} -W -Wall -Wno-unused-parameter -D_GNU_SOURCE -LDFLAGS:=-L${stagedir}/lib -L${libtar}/lib - -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -LTCOMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} -INSTALL:=libtool --mode=install install - -LIBTAR:=-L${libtar}/lib -ltar - -STAGE_HDRS:=jpcl_ctx_int.h -HDRS:=jp_client.h jpimporter.h - -EXAMPLES:=jpps_upload_files mill_feed - -LIBOBJS:=jpcl_ctx.o jpimp_lib.o -LIBTHROBJS:=${LIBOBJS:.o=.thr.o} -LIBLOBJS:=${LIBOBJS:.o=.lo} - -LIB:=libglite_jp_importer_${nothrflavour}.la -THRLIB:=libglite_jp_importer_${thrflavour}.la - -daemon:=glite-jp-importer - -wsprefix:=jpps_ - -SRCS:=jpimporter.c ${wsprefix}ClientLib.c ${wsprefix}C.c -OBJS:=${SRCS:.c=.o} - -gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi } -dotless_gsoap_ver:=${shell echo ${gsoap_default_version} | tr -d . } -ifeq ($(shell test -f ${stagedir}/lib/libglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}_c.la && echo ok),ok) - langflavour:=_c -endif -GSOAPLIB:=-lglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}${langflavour} -# static linking may be useful for LB/JP compatibility from different glite -# releases if we want to have the same prefix -ifdef GSOAP_STATIC -GSOAPLIB+=$(GSOAP_LIB) -static -endif - -LBMAILDIRLIB:=-lglite_lbu_maildir - -offset=0 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - - -default all: compile - -compile: ${daemon} ${LIB} ${EXAMPLES} - -examples: ${EXAMPLES} - -${LIB}: ${LIBOBJS} - ${LINK} ${version_info} -o $@ ${LIBLOBJS} -rpath ${glite_location}/lib ${LBMAILDIRLIB} ${LIBTAR} - -${daemon}: ${OBJS} - ${LINK} -o $@ ${OBJS} ${LBMAILDIRLIB} ${GSOAPLIB} ${GLOBUS_LIBS} - -${EXAMPLES}: ${LIB} - -jpps_upload_files: %: %.o - ${LINK} -o $@ $< ${LIB} ${LBMAILDIRLIB} - -mill_feed: %: %.o - ${LINK} -o $@ $< ${LBMAILDIRLIB} -lglite_jobid - - - -JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat - cp ${stagedir}/interface/JobProvenanceTypes.wsdl . - ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< - rm -f JobProvenanceTypes.wsdl - -${wsprefix}Client.c ${wsprefix}ClientLib.c \ -${wsprefix}C.c ${wsprefix}H.h: JobProvenancePS.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${wsprefix} JobProvenancePS.xh - -env_C.c env_Server.c: - touch env.xh - cp ${jpproject}/JobProvenanceTypes.wsdl . - ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o env.xh JobProvenanceTypes.wsdl - rm -f JobProvenanceTypes.wsdl - ${gsoap_bin_prefix}/soapcpp2 -w -c -p env_ env.xh - -${OBJS}: ${wsprefix}H.h soap_version.h - -soap_version.h: - ${gsoap_bin_prefix}/soapcpp2 /dev/null - perl -ne '$$. == 2 && /.*([0-9]+)\.([0-9]+)\.([0-9]+)([a-z]).*/ && printf "#define GSOAP_VERSION %d%02d%02d\n#define GSOAP_VERSION_LETTER '\''$$4'\''\n",$$1,$$2,$$3' soapH.h >$@ - -rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp - - - - -check: - -echo nothing yet - -doc: - -stage: compile - ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - -mkdir -p ${PREFIX}/${STAGETO} - -mkdir -p ${PREFIX}/bin - -mkdir -p ${PREFIX}/lib - -mkdir -p ${PREFIX}/examples - -mkdir -p ${PREFIX}/etc/init.d - ${INSTALL} -m 755 ${daemon} ${PREFIX}/bin - ${INSTALL} -m 644 ${LIB} ${PREFIX}/lib - ${INSTALL} -m 644 jpps_upload_files ${PREFIX}/examples/glite-jp-primary-upload_files - ${INSTALL} -m 755 mill_feed ${PREFIX}/examples/glite-jp-mill_feed - cd ${top_srcdir}/examples && ${INSTALL} -m 755 glite-jp-importer.sh ${PREFIX}/examples/ - ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-importer - cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${PREFIX}/${STAGETO} - if [ x${DOSTAGE} = xyes ]; then \ - cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${STAGE_HDRS} ${PREFIX}/${STAGETO} ; \ - fi - - -clean: - -# we have no real config.h but have to force gSoap not to use -# linux ftime with broken (aka obsolete) DST information -stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c - test -f config.h || touch config.h - @echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless' - ${CC} -o $@ -c -DWITH_NONAMESPACES -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c - - -%.lo: %.c - ${LTCOMPILE} -o $@ -c $< - -%.o: %.c - ${LTCOMPILE} -o $@ -c $< diff --git a/org.glite.jp.client/build.xml b/org.glite.jp.client/build.xml deleted file mode 100755 index 8a40155..0000000 --- a/org.glite.jp.client/build.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.client/config/startup b/org.glite.jp.client/config/startup deleted file mode 100755 index 036fbd8..0000000 --- a/org.glite.jp.client/config/startup +++ /dev/null @@ -1,115 +0,0 @@ -#! /bin/sh - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf - -[ -f $GLITE_LOCATION/etc/lb.conf ] && . $GLITE_LOCATION/etc/lb.conf -[ -f $GLITE_LOCATION_VAR/etc/lb.conf ] && . $GLITE_LOCATION_VAR/etc/lb.conf - -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -[ -n "$GLITE_JP_IMPORTER_PIDFILE" ] && pidfile=$GLITE_JP_IMPORTER_PIDFILE || - pidfile=$GLITE_LOCATION_VAR/glite-jp-importer.pid - -unset creds port - -start() -{ - if test -z "$GLITE_USER" ;then - echo 'Error: GLITE_USER is not set' - echo FAILED - return 1 - fi - - [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] && - creds="-c $GLITE_HOST_CERT -k $GLITE_HOST_KEY" - - if test -z "$creds"; then - if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then - echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER" - creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem" - fi - fi - - [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2 - - [ -z "$GLITE_LB_EXPORT_JPREG_MAILDIR" ] && GLITE_LB_EXPORT_JPREG_MAILDIR=$GLITE_LOCATION_VAR/jpreg - jpreg_maildir="--reg-mdir $GLITE_LB_EXPORT_JPREG_MAILDIR " - [ -d "$GLITE_LB_EXPORT_JPREG_MAILDIR" ] || mkdir -p "$GLITE_LB_EXPORT_JPREG_MAILDIR" && chown $GLITE_USER:$GLITE_GROUP -R "$GLITE_LB_EXPORT_JPREG_MAILDIR" - [ -z "$GLITE_LB_EXPORT_JPDUMP_MAILDIR" ] && GLITE_LB_EXPORT_JPDUMP_MAILDIR=$GLITE_LOCATION_VAR/jpdump - jpdump_maildir="--dump-mdir $GLITE_LB_EXPORT_JPDUMP_MAILDIR " - [ -d "$GLITE_LB_EXPORT_JPDUMP_MAILDIR" ] || mkdir -p "$GLITE_LB_EXPORT_JPDUMP_MAILDIR" && chown $GLITE_USER:$GLITE_GROUP "$GLITE_LB_EXPORT_JPDUMP_MAILDIR" - [ -n "$GLITE_LB_EXPORT_JPPS" ] && jpps="--jpps $GLITE_LB_EXPORT_JPPS " - - [ -n "$GLITE_LB_EXPORT_SANDBOX_MAILDIR" ] && sandbox_maildir="--sandbox-mdir $GLITE_LB_EXPORT_SANDBOX_MAILDIR " - - if [ -n "$GLITE_LB_EXPORT_JOBSDIR_KEEP" ]; then - keep_jobs="--store ${GLITE_LB_EXPORT_JOBSDIR_KEEP} " - [ -d $GLITE_LB_EXPORT_JOBSDIR_KEEP ] || mkdir -p $GLITE_LB_EXPORT_JOBSDIR_KEEP - fi - - echo -n Starting glite-jp-importer ... - -# XXX: HEAD -# -i $pidfile $jpreg_maildir $jpdump_maildir $jpps $sandbox_maildir $creds" \ - - su - $GLITE_USER -c "$GLITE_LOCATION/bin/glite-jp-importer \ - -i $pidfile $jpreg_maildir $jpdump_maildir $jpps $sandbox_maildir $keep_jobs \ - $creds $GLITE_JP_IMPORTER_ARGS" \ - && echo " done" || echo " FAILED" -} - -stop() -{ - if [ -f $pidfile ]; then - pid=`cat $pidfile` - kill $pid - echo -n Stopping glite-jp-importer \($pid\) ... - try=0 - while ps p $pid >/dev/null 2>&1; do - sleep 1; - try=`expr $try + 1` - if [ $try = 20 ]; then - echo " giving up after $try retries" - return 1 - fi - done - echo " done" - rm -f $pidfile - else - echo $pidfile does not exist - glite-jp-importer not running? >&2 - return 1 - fi -} - -status() -{ - retval=0 - - if [ -f $pidfile ]; then - pid=`cat $pidfile` - if ps p $pid >/dev/null 2>&1; then - echo glite-jp-importer running as $pid - else - echo glite-jp-importer not running - retval=1 - fi - else - echo glite-jp-importer not running - retval=1 - fi - - return $retval -} - -case x$1 in - xstart) start;; - xstop) stop;; - xrestart) stop; start;; - xstatus) status;; - x*) echo usage: $0 start,stop,restart,status >&2 - exit 1;; -esac diff --git a/org.glite.jp.client/configure b/org.glite.jp.client/configure deleted file mode 100755 index 0bf1a3f..0000000 --- a/org.glite.jp.client/configure +++ /dev/null @@ -1,701 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp.client/doc/README.jpimporter b/org.glite.jp.client/doc/README.jpimporter deleted file mode 100644 index 3e8bb2d..0000000 --- a/org.glite.jp.client/doc/README.jpimporter +++ /dev/null @@ -1,115 +0,0 @@ -jpimporter is a daemon which take care of all job registration from particular -LB server, forwarding them to the JP primary service and also file uploads, which -means sending LB dumps, sendbox files etc. to ftp server dedicated by JP PS. - -The daemon runs two proceses, one for registrations and another for file uploads. -Both processes reads the local directory which has a given structure and are -handled by glite-lb-maildir library calls. - - - -Namely for the registrations, LB server creates the message describing job, its -owner and JP primary server address and stores it into given maildir location -(i.e. /tmp/lb_server_jpreg/). The jpimporter daemon which is running on the same -host is periodicaly scanning this directory and whenever new messages appears, -attempts to register this described job to JP PS. - -For the file upload is the jpimporter behavior almost the same except the -message has different structure and a file to deliver must be placed in the -filesystem. - -For LB dumps, there is another utility, which parses common LB dump files -(created when purging the LB server), creates one file per every job and stores -message describing the location, destination etc. to local directory. This -message directory should be obviously monitored by the jpimporter again. - -lb_dump_exporter utility usage: lt-lb_dump_exporter [option] - -h, --help Shows this screen. - -d, --dump Dump file location. - File generated by the glite-lb-purge - -s, --store New dump files storage. - Directory, where to store all dump files - -j, --jpps Target JPPS. - jpps where should the file be uploaded - -m, --lbmaildir LB maildir path. - Directory, where should be stored the message - describing the file upload (read by jpimporter) - -jpimporter daemon usage: glite-jp-importer [option] - -h, --help displays this screen - -k, --key private key file - -c, --cert certificate file - -C, --CAdir trusted certificates directory - -g, --debug don't run as daemon, additional diagnostics - -p, --jpps JP primary service server - this JPPS server is used by default, when user/lb/... - does not specifies one - -r, --reg-mdir path to the 'LB maildir' subtree for registrations - This directory is scanned for the job registration - messages. - -d, --dump-mdir path to the 'LB maildir' subtree for LB dumps - This directory is scanned for the file upload msgs. - -s, --sandbox-mdir path to the 'LB maildir' subtree for input/output sandboxes - -i, --pidfile file to store master pid - -t, --poll maildir polling interval (in seconds) - Specifies the time interval for which the process - JobRegistration/FileUpload sleeps after the unsuccessful - scan (find no new messages) -Examples: - -So, for the job registration and dump upload from the LB server, you should run the -LB server like this: -./glite_lb_bkserverd -c -k -S /var/tmp/purge -D /var/tmp/dump -J /tmp/lb_server_jpreg - -(Whenever the job is registered to the LB server, the message for jpimporter -is stored in the /tmp/lb_server_jpreg directory.) - -Then you should run the jpimporter daemon on the same host: -./glite-jp-importer -c -k -p jpps.server.address:8900 -r /tmp/lb_server_jpreg -d /tmp/lb_server_jpdump - -(Every job registration anounced in /tmp/lb_server_jpreg directory will be sent -to the JP PS at the address jpps.server.address:8900.) - -According the dump files - on the same host should be periodicaly ran the -glite-lb-purge utility. (Usually started by cron) Let say, that it stores the -LB dump file /var/tmp/purge/dump_file. - -Then you should run (most likely in the same cron job) -./lb_dump_exporter -d /var/tmp/purge/dump_file -s /var/tmp/dumps_per_job -j jpps.server.address:8900 -m /tmp/lb_server_jpdump - -(Then there is created a set of LB dump file - one per job - and according to them -lb_dump_exporter will also notify the glite-jp-importer) - - - - -For the sandbox files, you should use the JP client API to create messages for -jpimporter. The function glite_jpimporter_upload_files() do the job. It takes -one ore more files and create one tarball. Then everything works like with -LB dumps. - -There is an example utility in org.glite.jp.client/examples/jpps_upload_files.c -(staged as glite-jp-primary-upload_files). - -The glite_jpimporter_upload_files funftion prototype: - -int glite_jpimporter_upload_files( - /* JP client context. - * stores the error code/description - * user can set default JP PS address there and - * LB directory for jpimporter announcements - */ - glite_jpcl_context_t ctx, - - /* JobId - */ - const char *jobid, - /* File list. Stored in the array of string. - * Last item has to be NULL - */ - const char **files, - /* Location of the user proxy file - */ - const char *proxy); - - diff --git a/org.glite.jp.client/examples/glite-jp-importer.sh b/org.glite.jp.client/examples/glite-jp-importer.sh deleted file mode 100644 index 8b525da..0000000 --- a/org.glite.jp.client/examples/glite-jp-importer.sh +++ /dev/null @@ -1,83 +0,0 @@ -#! /bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# all-in-one example script for purging LB and importing the dumps to JP -# -# uses helper purging script glite-lb-export.sh from glite.lb.client -# - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf - -[ -f $GLITE_LOCATION/etc/jp.conf ] && . $GLITE_LOCATION/etc/jp.conf -[ -f $GLITE_LOCATION_VAR/etc/jp.conf ] && . $GLITE_LOCATION_VAR/etc/jp.conf - -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -# get default values for purge and export -PREFIX=${GLITE_LOCATION:-`dirname $0`/..} -GLITE_LB_EXPORT_ENABLED="false" GLITE_LB_PURGE_ENABLED="false" . $PREFIX/bin/glite-lb-export.sh - -# job provenance server -if [ -z "$GLITE_LB_EXPORT_JPPS" ]; then - echo "Please specify the Job Provanance Primary Storage server." - exit 1 -fi -# certificates -if [ -z "$X509_USER_CERT" -o -z "$X509_USER_KEY" ]; then - echo "Please set X509_USER_CERT and X509_USER_KEY." - exit 1 -fi -# LB maildir for job registration -if [ -z "$GLITE_LB_EXPORT_JPREG_MAILDIR" ]; then - GLITE_LB_EXPORT_JPREG_MAILDIR=$GLITE_LOCATION_VAR/jpreg - echo "GLITE_LB_EXPORT_JPREG_MAILDIR not specified (-J arguent of the bkserver), used $GLITE_LB_EXPORT_JPREG_MAILDIR" -fi -if [ -n "$GLITE_LB_EXPORT_SANDBOX_MAILDIR" ]; then - sandbox_maildir="--sandbox-mdir $GLITE_LB_EXPORT_SANDBOX_MAILDIR " -fi -# pidfile -[ -n "$GLITE_JP_IMPORTER_PIDFILE" ] && pidfile="-i $GLITE_JP_IMPORTER_PIDFILE " - -CERT_ARGS="-c $X509_USER_CERT -k $X509_USER_KEY" -LOGDIR=$GLITE_LOCATION_VAR -GLITE_LB_EXPORT_PURGE_ARGS=${GLITE_LB_EXPORT_PURGE_ARGS:---cleared 2d --aborted 2w --cancelled 2w --other 2m} - -if [ -n "$GLITE_LB_EXPORT_JOBSDIR_KEEP" ]; then - keep_jobs="--store ${GLITE_LB_EXPORT_JOBSDIR_KEEP} " - [ -d $GLITE_LB_EXPORT_JOBSDIR_KEEP ] || mkdir -p $GLITE_LB_EXPORT_JOBSDIR_KEEP -fi - -[ -d $LOGDIR ] || mkdir -p $LOGDIR - -echo "Using cert args $CERT_ARGS" - -$PREFIX/bin/glite-jp-importer --reg-mdir $GLITE_LB_EXPORT_JPREG_MAILDIR --dump-mdir $GLITE_LB_EXPORT_JPDUMP_MAILDIR $CERT_ARGS ${sandbox_maildir}-g --jpps $GLITE_LB_EXPORT_JPPS $pidfile$keep_jobs$GLITE_JP_IMPORTER_ARGS > $LOGDIR/jp-importer.log 2>&1 & - -JP_PID=$! -trap "kill $JP_PID; exit 0" SIGINT - -while [ 1 ]; do - GLITE_LB_EXPORT_ENABLED="true" GLITE_LB_PURGE_ENABLED="true" $PREFIX/bin/glite-lb-export.sh - - sleep 30 -done diff --git a/org.glite.jp.client/examples/jpps_upload_files.c b/org.glite.jp.client/examples/jpps_upload_files.c deleted file mode 100644 index e4f4294..0000000 --- a/org.glite.jp.client/examples/jpps_upload_files.c +++ /dev/null @@ -1,99 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include "jp_client.h" -#include "jpimporter.h" - -static char *myname; - -void usage(void) -{ - fprintf(stderr, - "Usage: %s [-h][-p user_proxy][-j jobid] file [file ...]\n" - " -h show this help\n" - " -p path to the proxy filename\n" - " -j jobid string\n" - " -m location of the lb maildir structure\n" - " -s JP PS server address and port\n" - , myname); -} - -int main(int argc, char **argv) -{ - glite_jpcl_context_t ctx; - char **files, - *jobid = NULL, - *proxy = NULL, - *lbmd = NULL, - *jpps = NULL; - int i, j; - - - myname = strrchr(argv[0],'/'); - if ( myname ) myname++; else myname = argv[0]; - - if ( argc < 2 ) { usage(); return 1; } - for ( i = 1; i < argc; i++ ) { - if ( argv[i][0] != '-' ) break; - if ( argv[i][1] == 'j' ) jobid = argv[++i]; - else if ( argv[i][1] == 'p' ) proxy = argv[++i]; - else if ( argv[i][1] == 'm' ) lbmd = argv[++i]; - else if ( argv[i][1] == 's' ) jpps = argv[++i]; - else if ( argv[i][1] == 'h' || argv[i][1] == '?' ) {usage();return 0;} - else {usage();return 1;} - } - - if ( i >= argc ) { usage(); return 1; } - - if ( !proxy && !(proxy = getenv("X509_USER_PROXY")) ) { - perror("-p or X509_USER_PROXY must be set!\n"); - return 1; - } - - if ( !(files = calloc(argc-i+1, sizeof(*files))) ) { - perror("calloc()"); - return 1; - } - j = 0; - while ( i < argc ) files[j++] = argv[i++]; - - if ( glite_jpcl_InitContext(&ctx) ) { - perror("glite_jpcl_InitContext()"); - return 1; - } - - if ( lbmd ) glite_jpcl_SetParam(ctx, GLITE_JPCL_PARAM_LBMAILDIR, lbmd); - if ( jpps ) glite_jpcl_SetParam(ctx, GLITE_JPCL_PARAM_JPPS, jpps); - - if ( glite_jpimporter_upload_files(ctx, jobid, (const char **)files, proxy) ) { - char *errt, *errd; - - glite_jpcl_Error(ctx, &errt, &errd); - printf("Error calling glite_jpimporter_upload_files()\n\t%s: %s\n", - errt, errd); - glite_jpcl_FreeContext(ctx); - return 1; - } - - glite_jpcl_FreeContext(ctx); - return 0; -} diff --git a/org.glite.jp.client/examples/mill_feed.c b/org.glite.jp.client/examples/mill_feed.c deleted file mode 100644 index 3a415f3..0000000 --- a/org.glite.jp.client/examples/mill_feed.c +++ /dev/null @@ -1,334 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "jp_client.h" -#include "jpimporter.h" -#include "glite/lbu/maildir.h" -#include "glite/jobid/cjobid.h" - - -#define USER "Job Generator Buddy" -#define BKSERVER "funny.zcu.cz" -#define BKPORT 9000 -#ifndef EDG_DUMP_STORAGE -#define EDG_DUMP_STORAGE "/tmp/dump" -#endif -#ifndef EDG_PURGE_STORAGE -#define EDG_PURGE_STORAGE "/tmp/purge" -#endif - - -char *jpreg_dir; -char *dump_dir; -char *user; -int do_exit = 0; -int perf_regs, perf_dumps; -char perf_ts[100]; -char *dump; char **dump_index; size_t dump_tokens; -int speed = 0; -double duration = 0.0; - -static struct option opts[] = { - { "help", 0, NULL, 'h'}, - { "reg-mdir", 1, NULL, 'R'}, - { "dump-mdir", 1, NULL, 'D'}, - { "break", 1, NULL, 'b'}, - { "dump", 1, NULL, 'd'}, -// { "sandbox-mdir",1, NULL, 's'}, - { NULL, 0, NULL, 0} -}; -static const char *get_opt_string = "hR:D:b:d:"; - -static int register_init(); -static int register_add(const char *jobid, char **new_jobid); -static void get_time(char *s, size_t maxs, double *t); -static int dump_init(const char *start_jobid, const char *filenmae); -static int dump_add(const char *filename, const char *jobid); -static void dump_done(); - - -static void handler(int sig) { - do_exit = sig; - signal(sig, SIG_DFL); -} - - -static void usage(const char *program) { - fprintf(stderr, "Usage: %s [OPTIONS]\n" - "\t-R,--reg-mdir\n" - "\t-D,--dump-mdir\n" -// "\t-s,--sandbox-mdir\n" - "\t-b,--break speed (jobs/day)\n" - "\t-d,--dump dump file\n" - , program); -} - - -int main(int argc, char *argv[]) { - char start_jobid[256], stop_jobid[256], *fn; - double ts, ts2, last, now; - int ret, opt; - FILE *f; - char *jobid, *dumpfile = NULL; - - while ((opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF) - switch (opt) { - case 'h': usage(argv[0]); return 0; - case 'R': jpreg_dir = strdup(optarg); break; - case 'D': dump_dir = strdup(optarg); break; - case 'b': speed = atoi(optarg); if (speed) duration = 24.0*3600.0*1000000.0/speed; break; - case 'd': dumpfile = optarg; break; - default: printf("opt: %c\n", opt); usage(argv[0]); return 1; - } - - get_time(perf_ts, sizeof(perf_ts), &ts); - snprintf(start_jobid, sizeof(start_jobid), PERF_JOBID_START_PREFIX "%s", perf_ts); - snprintf(stop_jobid, sizeof(stop_jobid), PERF_JOBID_STOP_PREFIX "%s", perf_ts); - - if ((ret = register_init()) != 0) return ret; - if ((ret = dump_init(start_jobid, dumpfile)) != 0) return ret; - if ((ret = register_add(start_jobid, NULL)) != 0) return ret; - if (signal(SIGINT, handler) == SIG_ERR) { - ret = errno; - fprintf(stderr, "%s: can't set signal handler: %s\n", __FUNCTION__, strerror(errno)); - return ret; - } - if (speed) printf("speed: %d jobs/day (delay %lf)\n", speed, duration / 1000000.0); - else printf("speed: unlimited\n"); - printf("dump: %s\n", dumpfile ? dumpfile : "(none)"); - printf("reg-mdir: %s\n", jpreg_dir); - printf("dump-mdir: %s\n", dump_dir); - printf("start: %lf\n", ts); - printf("%s\n", start_jobid); - last = ts; - while (!do_exit) { - struct timeval tv; - - if ((ret = register_add(NULL, &jobid)) != 0) return ret; -// printf("%s\n", jobid); - if (dumpfile) { - if ((ret = dump_add(dumpfile, jobid)) != 0) return ret; -// printf(" dumped %s\n", dumpfile); - } - free(jobid); - gettimeofday(&tv, NULL); - now = tv.tv_sec + (double)tv.tv_usec / 1000000.0; - if (now < last + duration) usleep(last + duration - now); - last = now; - } - if ((ret = register_add(stop_jobid, NULL)) != 0) return ret; - asprintf(&fn, PERF_STOP_FILE_FORMAT, perf_ts); - if ((f = fopen(fn, "wt")) == NULL) { - ret = errno; - free(fn); - fprintf(stderr, "Can' create file '%s': %s\n", fn, strerror(errno)); - return ret; - } - free(fn); - fprintf(f, "reg-imp\t%d\n", perf_regs); - fprintf(f, "dump-imp\t%d\n", perf_dumps); - fclose(f); - dump_done(); - - get_time(NULL, -1, &ts2); - printf("stop: %lf\n", ts2); - printf("regs: %d (%lf jobs/day)\n", perf_regs, 86400.0 * perf_regs / (ts2-ts)); - printf("dumps: %d (%lf jobs/day)\n", perf_dumps, 86400.0 * perf_dumps / (ts2-ts)); - printf("%s\n", stop_jobid); - - return 0; -} - - -static void get_time(char *s, size_t maxs, double *t) { - struct timeval tv; - struct tm tm; - - gettimeofday(&tv, NULL); - if (t) *t = tv.tv_sec + (double)tv.tv_usec / 1000000.0; - gmtime_r(&tv.tv_sec, &tm); - if (s && maxs > 0) strftime(s, maxs, "%FT%TZ", &tm); -} - - -static int register_init() { - char *env; - - if (!jpreg_dir) { - env = getenv("GLITE_LB_EXPORT_JPREG_MAILDIR"); - if (env) jpreg_dir = strdup(env); - else jpreg_dir = strdup(GLITE_REG_IMPORTER_MDIR); - } - - - // TODO: better from certificate - env = getenv("GLITE_USER"); - if (!env) env = USER; - user = strdup(env); - - if (glite_lbu_MaildirInit(jpreg_dir) != 0) { - fprintf(stderr, "maildir init on %s failed\n", jpreg_dir); - return EIO; - } - - perf_regs = 0; - return 0; -} - - -static int register_add(const char *jobid, char **new_jobid) { - glite_jobid_t j; - char *tmpjobid, *msg; - - if (!jobid) { - if (glite_jobid_create(BKSERVER, BKPORT, &j) != 0 || (tmpjobid = glite_jobid_unparse(j)) == NULL) { - fprintf(stderr, "Can't create jobid\n"); - return EIO; - } - glite_jobid_free(j); - } else tmpjobid = strdup(jobid); - asprintf(&msg, "%s\n%s", tmpjobid, user); - if (new_jobid) *new_jobid = tmpjobid; - else free(tmpjobid); - if (glite_lbu_MaildirStoreMsg(jpreg_dir, BKSERVER, msg) != 0) { - fprintf(stderr, "Can't store message: %s\n", lbm_errdesc); - return EIO; - } - free(msg); - - perf_regs++; - return 0; -} - - -static int dump_init(const char *start_jobid, const char *filename) { - char *env, *ptr, *delim; - FILE *f; - long ssize; - size_t i, dump_maxtokens, size; - int ret; - - unlink(PERF_START_FILE); - - dump = NULL; - dump_index = NULL; - dump_tokens = 0; - if (filename) { - if ((f = fopen(filename, "rt")) == NULL) { - fprintf(stderr, "Can't open '%s': %s\n", filename, strerror(errno)); - return EIO; - } - if (fseek(f, 0, SEEK_END) == -1 || (ssize = ftell(f)) == -1 || fseek(f, 0, SEEK_SET) == -1) { - fprintf(stderr, "Can't get position in '%s': %s\n", filename, strerror(errno)); - return EIO; - } - dump = malloc(size = ssize); - if (fread(dump, size, 1, f) != 1) { - ret = errno; - fprintf(stderr, "Error reading %ld bytes from file: %s\n", ssize, strerror(errno)); - return ret; - } - fclose(f); - - dump_maxtokens = 1024; - dump_index = malloc(sizeof(char *) * dump_maxtokens); - i = 0; - ptr = dump; - do { - if (dump_tokens >= dump_maxtokens) { - dump_maxtokens *= 2; - dump_index = realloc(dump_index, sizeof(char *) * dump_maxtokens); - } - delim = strstr(ptr, "DG.JOBID=\""); - if (delim != ptr) { - dump_index[dump_tokens++] = ptr; - if (delim) { - delim[10] = '\0'; - ptr = delim + 11; - } else ptr = NULL; - } - if (ptr) ptr = strchr(ptr, '\"'); - } while (ptr && ptr[0]); - } -//for (i = 0; i < dump_tokens; i++) printf("####%s\n", dump_index[i]); - - if (!dump_dir) { - // wrong purging to GLITE_LB_EXPORT_DUMPDIR on older versions - env = getenv("GLITE_LB_EXPORT_PURGEDIR"); - if (env) dump_dir = strdup(env); - else dump_dir = strdup(EDG_DUMP_STORAGE); - } - mkdir(dump_dir, 0755); - perf_dumps = 0; - - if ((f = fopen(PERF_START_FILE, "wt")) == NULL) { - fprintf(stderr, "Can't create file '" PERF_START_FILE "': %s\n", strerror(errno)); - return EIO; - } - if (start_jobid) fprintf(f, "%s\n", start_jobid); - fclose(f); - - return 0; -} - - -static int dump_add(const char *filename, const char *jobid) { - char *fn; - int ret; - size_t i; - FILE *f; - - ret = 0; - asprintf(&fn, "%s/mill-test-%s-%06d", dump_dir, perf_ts, perf_dumps); - if ((f = fopen(fn , "wt")) == NULL) { - ret = errno; - fprintf(stderr, "Can't create file '%s': %s\n", fn, strerror(errno)); - goto err; - } - for (i = 0; i < dump_tokens; i++) { - if (fputs(dump_index[i], f) == EOF || (i + 1 < dump_tokens && (fputs(jobid, f) == EOF))) { - ret = errno; - fprintf(stderr, "Can't write to '%s': %s\n", fn, strerror(errno)); - goto err_close; - } - } - - perf_dumps++; -err_close: - fclose(f); -err: - free(fn); - return ret; -} - - -static void dump_done() { - free(dump_index); - free(dump); - dump_tokens = 0; -} diff --git a/org.glite.jp.client/interface/jp_client.h b/org.glite.jp.client/interface/jp_client.h deleted file mode 100644 index c6a4bf7..0000000 --- a/org.glite.jp.client/interface/jp_client.h +++ /dev/null @@ -1,48 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef __GLITE_JP_CLIENT__ -#define __GLITE_JP_CLIENT__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _glite_jpcl_context_t *glite_jpcl_context_t; - -typedef enum _glite_jpcl_ctx_param_t { - GLITE_JPCL_PARAM_JPPS, - GLITE_JPCL_PARAM_LBMAILDIR -} glite_jpcl_ctx_param_t; - -extern int glite_jpcl_InitContext(glite_jpcl_context_t *); -extern void glite_jpcl_FreeContext(glite_jpcl_context_t); - -extern int glite_jpcl_SetParam( - glite_jpcl_context_t ctx, - int param, ... ); - -extern int glite_jpcl_Error( - glite_jpcl_context_t ctx, - char **errt, - char **errd); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.jp.client/interface/jpcl_ctx_int.h b/org.glite.jp.client/interface/jpcl_ctx_int.h deleted file mode 100644 index d22f29b..0000000 --- a/org.glite.jp.client/interface/jpcl_ctx_int.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef __GLITE_JPCLIENT_CONTEXT_INT -#define __GLITE_JPCLIENT_CONTEXT_INT - -#ifdef __cplusplus -extern "C" { -#endif - -struct _glite_jpcl_context_t { - int errCode; - char *errDesc; - - char *jpps; - char *lbmd_dir; -}; - -extern int glite_jpcl_SetError(glite_jpcl_context_t, int, const char *); -extern int glite_jpcl_ResetError(glite_jpcl_context_t); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.jp.client/interface/jpimporter.h b/org.glite.jp.client/interface/jpimporter.h deleted file mode 100644 index 3948ff0..0000000 --- a/org.glite.jp.client/interface/jpimporter.h +++ /dev/null @@ -1,52 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef __GLITE_JPIMPORTER__ -#define __GLITE_JPIMPORTER__ - -#ifndef GLITE_REG_IMPORTER_MDIR -#define GLITE_REG_IMPORTER_MDIR "/var/glite/jpreg" -#endif - -#ifndef GLITE_DUMP_IMPORTER_MDIR -#define GLITE_DUMP_IMPORTER_MDIR "/var/glite/jpdump" -#endif - -#ifndef GLITE_SANDBOX_IMPORTER_MDIR -#define GLITE_SANDBOX_IMPORTER_MDIR "/var/glite/jpsandbox" -#endif - -#define PERF_JOBID_START_PREFIX "https://start.megajob/START-" -#define PERF_JOBID_STOP_PREFIX "https://stop.megajob/STOP-" -#define PERF_START_FILE "/tmp/jp_megajob_start" -#define PERF_STOP_FILE_FORMAT "/tmp/jp_megajob_%s" - -#ifdef __cplusplus -extern "C" { -#endif - -extern int glite_jpimporter_upload_files( - glite_jpcl_context_t ctx, - const char *jobid, - const char **files, - const char *proxy); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.jp.client/project/ChangeLog b/org.glite.jp.client/project/ChangeLog deleted file mode 100644 index ecdcffd..0000000 --- a/org.glite.jp.client/project/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -1.3.0-1 -- Initial Release - -1.3.0-2 -- configure updated - diff --git a/org.glite.jp.client/project/build.number b/org.glite.jp.client/project/build.number deleted file mode 100644 index 39605c5..0000000 --- a/org.glite.jp.client/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Thu Dec 15 09:23:26 CET 2005 -module.build=0 diff --git a/org.glite.jp.client/project/build.properties b/org.glite.jp.client/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.jp.client/project/configure.properties.xml b/org.glite.jp.client/project/configure.properties.xml deleted file mode 100644 index b475ce3..0000000 --- a/org.glite.jp.client/project/configure.properties.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -expat_prefix=${with.expat.prefix} -gsoap_prefix=${with.gsoap.prefix} -gsoap_version=${ext.gsoap.version} -mysql_prefix=${with.mysql.prefix} -mysql_version=${ext.mysql.version} -libtar=${with.libtar.prefix} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -cppunit=${with.cppunit.prefix} -jpproject=${subsystem.project.dir} -project=${component.project.dir} - - - diff --git a/org.glite.jp.client/project/properties.xml b/org.glite.jp.client/project/properties.xml deleted file mode 100755 index e2a32d0..0000000 --- a/org.glite.jp.client/project/properties.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.client/project/tar_exclude b/org.glite.jp.client/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.jp.client/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.jp.client/project/version.properties b/org.glite.jp.client/project/version.properties deleted file mode 100644 index c23c2eb..0000000 --- a/org.glite.jp.client/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# $Header$ -module.version=1.3.0 -module.age=2 diff --git a/org.glite.jp.client/src/jpcl_ctx.c b/org.glite.jp.client/src/jpcl_ctx.c deleted file mode 100644 index ecac72a..0000000 --- a/org.glite.jp.client/src/jpcl_ctx.c +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include "jp_client.h" -#include "jpcl_ctx_int.h" -#include "jpimporter.h" - - -int glite_jpcl_InitContext(glite_jpcl_context_t *ctx) -{ - glite_jpcl_context_t out = (glite_jpcl_context_t) malloc(sizeof(*out)); - if (!out) return ENOMEM; - memset(out, 0, sizeof(*out)); - assert(out->errDesc == NULL); - - *ctx = out; - return 0; -} - -void glite_jpcl_FreeContext(glite_jpcl_context_t ctx) -{ - free(ctx->jpps); - free(ctx->lbmd_dir); -} - -int glite_jpcl_SetParam(glite_jpcl_context_t ctx, int param, ...) -{ - va_list ap; - - va_start(ap, param); - switch ( param ) { - case GLITE_JPCL_PARAM_JPPS: - if ( ctx->jpps ) free(ctx->jpps); - ctx->jpps = va_arg(ap, char *); - ctx->jpps = strdup(ctx->jpps); - break; - case GLITE_JPCL_PARAM_LBMAILDIR: - if ( ctx->lbmd_dir ) free(ctx->lbmd_dir); - ctx->lbmd_dir = strdup(va_arg(ap, char *)); - break; - default: - return glite_jpcl_SetError(ctx, EINVAL, "unknown parameter"); - } - - return 0; -} - -int glite_jpcl_Error( glite_jpcl_context_t ctx, char **errt, char **errd) -{ - if ( errt ) *errt = strdup(strerror(ctx->errCode)); - if ( errd ) *errd = (ctx->errDesc)? strdup(ctx->errDesc): NULL; - return ctx->errCode; -} - -int glite_jpcl_SetError(glite_jpcl_context_t ctx, int code, const char *desc) -{ - glite_jpcl_ResetError(ctx); - if ( code ) { - ctx->errCode = code; - if ( desc ) ctx->errDesc = (char *) strdup(desc); - } - - return ctx->errCode; -} - -int glite_jpcl_ResetError(glite_jpcl_context_t ctx) -{ - if ( ctx->errDesc ) free(ctx->errDesc); - ctx->errDesc = NULL; - ctx->errCode = 0; - - return ctx->errCode; -} diff --git a/org.glite.jp.client/src/jpimp_lib.c b/org.glite.jp.client/src/jpimp_lib.c deleted file mode 100644 index d4986b7..0000000 --- a/org.glite.jp.client/src/jpimp_lib.c +++ /dev/null @@ -1,134 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -#define COMPILE_WITH_LIBTAR -#ifdef COMPILE_WITH_LIBTAR -# include -#endif - -#include "glite/lbu/maildir.h" - -#include "jp_client.h" -#include "jpimporter.h" -#include "jpcl_ctx_int.h" - -#define TEMP_FILE_PREFIX "/tmp/jpimporter" - -int glite_jpimporter_upload_files( - glite_jpcl_context_t ctx, - const char *jobid, - const char **files, - const char *proxy) -{ -#ifdef COMPILE_WITH_LIBTAR - TAR *t = NULL; -#endif - char *msg = NULL, - *errs = NULL; - char archive[PATH_MAX]; - int fd = -1, - rv = 0, - i; - - - assert((files != NULL) && (files[0] != NULL)); - assert(jobid != NULL); - /* TODO: get the user proxy if it is not specified and find its location */ - assert(proxy != NULL); - - if ( glite_lbu_MaildirInit(ctx->lbmd_dir) ) { - asprintf(&errs, "glite_lbu_MaildirInit(): %s", lbm_errdesc); - glite_jpcl_SetError(ctx, errno, errs); - free(errs); - return -1; - } - - i = 0; - do { - if ( ++i > 10 ) { - glite_jpcl_SetError(ctx, ECANCELED, "Can't create temporary tar file"); - return -1; - } - snprintf(archive, PATH_MAX, "%s_%d_%ld.tar", - TEMP_FILE_PREFIX, getpid(), time(NULL)); - if ( (fd = open(archive, O_CREAT|O_EXCL|O_WRONLY, 00600)) < 0 ) { - if ( errno == EEXIST ) { sleep(2); continue; } - asprintf(&errs, "Can't create tar file %s", archive); - glite_jpcl_SetError(ctx, ECANCELED, errs); - free(errs); - return -1; - } - } while ( fd < 0 ); - -#ifdef COMPILE_WITH_LIBTAR - if ( tar_fdopen(&t, fd, archive, NULL, O_WRONLY, 0, TAR_GNU) < 0 ) { - asprintf(&errs, "Can't create tar archive %s", archive); - glite_jpcl_SetError(ctx, errno, errs); - rv = -1; - goto cleanup; - } - - for ( i = 0; files[i]; i++ ) { - char *s = (char *)files[i]; - if ( tar_append_file(t, s, (s[0]=='/')? s+1: s) < 0 ) { - asprintf(&errs, "Can't append file into tar archive %s", archive); - glite_jpcl_SetError(ctx, errno, errs); - rv = -1; - goto cleanup; - } - } -#endif - - if ( ctx->jpps ) - asprintf(&msg, "jobid\t%s\nfile\t%s\nproxy\t%s\njpps\t%s\n", - jobid, archive, proxy, ctx->jpps); - else - asprintf(&msg, "jobid\t%s\nfile\t%s\nproxy\t%s\n", - jobid, archive, proxy); - - if ( glite_lbu_MaildirStoreMsg(ctx->lbmd_dir, "localhost", msg) ) { - asprintf(&errs, "glite_lbu_MaildirStoreMsg(): %s", lbm_errdesc); - glite_jpcl_SetError(ctx, errno, errs); - rv = -1; - goto cleanup; - } - - -cleanup: -#ifdef COMPILE_WITH_LIBTAR - if ( t ) tar_close(t); - else close(fd); -#else - close(fd); -#endif - if ( rv ) unlink(archive); - free(errs); - free(msg); - - return rv; -} diff --git a/org.glite.jp.client/src/jpimporter.c b/org.glite.jp.client/src/jpimporter.c deleted file mode 100644 index 961abe7..0000000 --- a/org.glite.jp.client/src/jpimporter.c +++ /dev/null @@ -1,1070 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glite/lbu/maildir.h" - -#include "jpps_H.h" -#include "jpps_.nsmap" - -#include "jptype_map.h" -#include "glite/security/glite_gsplugin.h" -#include "glite/security/glite_gscompat.h" -#include "glite/jp/known_attr.h" - -#include "globus_ftp_client.h" -#include "jp_client.h" -#include "jpimporter.h" - -#if GSOAP_VERSION <= 20602 -#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob -#endif - - -typedef struct { - char *key; - char *val; -} msg_pattern_t; - -#ifndef dprintf -#define dprintf(FMT, ARGS...) { if (debug) printf(FMT, ##ARGS); } -#endif - -#define check_soap_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), name, 1) - -#ifndef GLITE_JPIMPORTER_PIDFILE -#define GLITE_JPIMPORTER_PIDFILE "/var/run/glite-jpimporter.pid" -#endif - -#ifndef GLITE_JPPS -#define GLITE_JPPS "http://localhost:8901" -#endif - -#define MAX_REG_CONNS 500 -#define JPPS_NO_RESPONSE_TIMEOUT 120 -#define JPREG_REPEAT_TIMEOUT 300 -#define JPREG_GIVUP_TIMEOUT 3000 -#define JP_REPEAT_TIMEOUT 360 -#define JP_GIVUP_TIMEOUT 3600 -#define PID_POOL_SIZE 20 -#define DEFAULT_DUMP_SLAVES_NUMBER 1 - - -static int debug = 0; -static int die = 0; -static int child_died = 0; -static int poll = 2; -static char *name; -static char *jpps = GLITE_JPPS; -static char reg_mdir[PATH_MAX] = GLITE_REG_IMPORTER_MDIR; -static char dump_mdir[PATH_MAX] = GLITE_DUMP_IMPORTER_MDIR; -static char sandbox_mdir[PATH_MAX] = GLITE_SANDBOX_IMPORTER_MDIR; -static char *store = NULL; -static struct soap *soap; - -static time_t cert_mtime = 0; -static char *server_cert = NULL, - *server_key = NULL, - *cadir = NULL; -static edg_wll_GssCred mycred = NULL; -#ifdef JP_PERF -typedef struct { - char *id, *name; - long int count, limit; - double start, end; -} perf_t; - -int sink = 0; -perf_t perf = {name:NULL,}; -#endif -static int gftp_initialized = 0; -static globus_ftp_client_handle_t hnd; - - -static struct option opts[] = { - { "help", 0, NULL, 'h'}, - { "cert", 1, NULL, 'c'}, - { "key", 1, NULL, 'k'}, - { "CAdir", 1, NULL, 'C'}, - { "debug", 0, NULL, 'g'}, - { "jpps", 1, NULL, 'p'}, - { "reg-mdir", 1, NULL, 'r'}, - { "dump-mdir", 1, NULL, 'd'}, - { "dump-slaves", 1, NULL, 'D'}, - { "sandbox-mdir",1, NULL, 's'}, - { "pidfile", 1, NULL, 'i'}, - { "poll", 1, NULL, 't'}, - { "store", 1, NULL, 'S'}, - { "store", 1, NULL, 'S'}, -#ifdef JP_PERF - { "perf-sink", 1, NULL, 'K'}, -#endif - { NULL, 0, NULL, 0} -}; - -static const char *get_opt_string = "hgp:r:d:D:s:i:t:c:k:C:" -#ifdef JP_PERF - "K:" -#endif -; - -#include "glite/jp/ws_fault.c" - -#ifdef JP_PERF -static void stats_init(perf_t *perf, const char *name); -static void stats_set_jobid(perf_t *perf, const char *jobid); -static void stats_get_limit(perf_t *perf, const char *name); -static void stats_done(perf_t *perf); -#endif - -static void usage(char *me) -{ - fprintf(stderr,"usage: %s [option]\n" - "\t-h, --help displays this screen\n" - "\t-k, --key private key file\n" - "\t-c, --cert certificate file\n" - "\t-C, --CAdir trusted certificates directory\n" - "\t-g, --debug don't run as daemon, additional diagnostics\n" - "\t-p, --jpps JP primary service server\n" - "\t-r, --reg-mdir path to the 'LB maildir' subtree for registrations\n" - "\t-d, --dump-mdir path to the 'LB maildir' subtree for LB dumps\n" - "\t-D, --dump-slaves number of slaves processing LB dumps\n" - "\t-s, --sandbox-mdir path to the 'LB maildir' subtree for input/output sandboxes\n" - "\t-i, --pidfile file to store master pid\n" - "\t-t, --poll maildir polling interval (in seconds)\n" - "\t-S, --store keep uploaded jobs in this directory\n" -#ifdef JP_PERF - "\t-K, --perf-sink 1=stats, 2=without WS calls, 3=stats+without WS\n" -#endif - , me); -} - -static void catchsig(int sig) -{ - die = sig; -} - -static void catch_chld(int sig __attribute__((unused))) -{ - child_died = 1; -} - - -static int slave(int (*)(void), const char *); -static int reg_importer(void); -static int dump_importer(void); -static int sandbox_importer(void); -static int parse_msg(char *, msg_pattern_t []); -static int gftp_put_file(const char *, int); -static int refresh_connection(struct soap *soap); - - -int main(int argc, char *argv[]) -{ - edg_wll_GssStatus gss_code; - struct sigaction sa; - sigset_t sset; - FILE *fpid; - pid_t reg_pid, sandbox_pid; - pid_t dump_pids[PID_POOL_SIZE]; - int dump_slaves = DEFAULT_DUMP_SLAVES_NUMBER, i; - int opt; - char *name, - pidfile[PATH_MAX] = GLITE_JPIMPORTER_PIDFILE; - glite_gsplugin_Context plugin_ctx; - - name = strrchr(argv[0],'/'); - if (name) name++; else name = argv[0]; - - if ( geteuid() ) - snprintf(pidfile, sizeof pidfile, "%s/glite_jpimporter.pid", getenv("HOME")); - - while ( (opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF ) - switch ( opt ) { - case 'g': debug = 1; break; - case 'h': usage(name); return 0; - case 'c': server_cert = optarg; break; - case 'k': server_key = optarg; break; - case 'C': cadir = optarg; break; - case 'p': jpps = optarg; break; - case 't': poll = atoi(optarg); break; - case 'S': store = optarg; break; - case 'r': strcpy(reg_mdir, optarg); break; - case 'd': strcpy(dump_mdir, optarg); break; - case 'D': dump_slaves = atoi(optarg); break; - case 's': strcpy(sandbox_mdir, optarg); break; - case 'i': strcpy(pidfile, optarg); break; -#ifdef JP_PERF - case 'K': sink = atoi(optarg); break; -#endif - case '?': usage(name); return 1; - } - if ( optind < argc ) { usage(name); return 1; } - - if (dump_slaves > PID_POOL_SIZE) { - fprintf(stderr,"Maximum number of dump slaves is %d\n", PID_POOL_SIZE); - return(1); - } - - memset(&dump_pids,0,sizeof(dump_pids)); - - setlinebuf(stdout); - setlinebuf(stderr); - - fpid = fopen(pidfile,"r"); - if ( fpid ) { - int opid = -1; - - if ( fscanf(fpid,"%d",&opid) == 1 ) { - if ( !kill(opid,0) ) { - fprintf(stderr,"%s: another instance running, pid = %d\n",argv[0],opid); - return 1; - } - else if (errno != ESRCH) { perror("kill()"); return 1; } - } - fclose(fpid); - } else if (errno != ENOENT) { perror(pidfile); return 1; } - fpid = fopen(pidfile, "w"); - if ( !fpid ) { perror(pidfile); return 1; } - fprintf(fpid, "%d", getpid()); - fclose(fpid); - - glite_lbu_MaildirInit(reg_mdir); - glite_lbu_MaildirInit(dump_mdir); - glite_lbu_MaildirInit(sandbox_mdir); - if (store && *store) { - if (mkdir(store, 0750) != 0 && errno != EEXIST) { - fprintf(stderr, "Can't create directory %s: %s\n", store, strerror(errno)); - store = NULL; - } - } - - if ( !debug ) { - if ( daemon(1,0) == -1 ) { perror("deamon()"); exit(1); } - - fpid = fopen(pidfile,"w"); - if ( !fpid ) { perror(pidfile); return 1; } - fprintf(fpid, "%d", getpid()); - fclose(fpid); - openlog(name, LOG_PID, LOG_DAEMON); - } else { setpgid(0, getpid()); } - - dprintf("Master pid %d\n", getpid()); - - if ( globus_module_activate(GLOBUS_FTP_CLIENT_MODULE) != GLOBUS_SUCCESS ) { - dprintf("[master] Could not activate ftp client module\n"); - if (!debug) syslog(LOG_INFO, "Could not activate ftp client module\n"); - exit(1); - } else dprintf("[master] Ftp client module activated\n"); - - if ( !server_cert || !server_key ) - fprintf(stderr, "%s: key or certificate file not specified" - " - unable to watch them for changes!\n", argv[0]); - if ( cadir ) setenv("X509_CERT_DIR", cadir, 1); - edg_wll_gss_watch_creds(server_cert, &cert_mtime); - if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &gss_code) ) { - dprintf("[master] Server identity: %s\n", mycred->name); - } else { - char *errmsg; - edg_wll_gss_get_error(&gss_code, "edg_wll_gss_acquire_cred_gsi()", &errmsg); - dprintf("[master] %s\n", errmsg); - free(errmsg); - dprintf("[master] Running unauthenticated\n"); - } - - memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL); - sa.sa_handler = catchsig; - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - - sa.sa_handler = catch_chld; - sigaction(SIGCHLD, &sa, NULL); - - sa.sa_handler = SIG_IGN; - sigaction(SIGUSR1, &sa, NULL); - - sigemptyset(&sset); - sigaddset(&sset, SIGCHLD); - sigaddset(&sset, SIGTERM); - sigaddset(&sset, SIGINT); - sigprocmask(SIG_BLOCK, &sset, NULL); - - soap = calloc(1, sizeof *soap); - soap_init2(soap, SOAP_IO_KEEPALIVE, SOAP_IO_KEEPALIVE); - soap_set_omode(soap, SOAP_IO_BUFFER); - soap_set_namespaces(soap, jpps__namespaces); - - glite_gsplugin_init_context(&plugin_ctx); - glite_gsplugin_use_credential(plugin_ctx, mycred); - soap_register_plugin_arg(soap, glite_gsplugin,plugin_ctx); - - if ( (reg_pid = slave(reg_importer, "reg-imp")) < 0 ) { - perror("starting reg importer slave"); - exit(1); - } - for (i=0; i < dump_slaves; i++) { - if ( (dump_pids[i] = slave(dump_importer, "dump-imp")) < 0 ) { - perror("starting dump importer slave"); - exit(1); - } - } - if ( (sandbox_pid = slave(sandbox_importer, "sandbox-imp")) < 0 ) { - perror("starting sandbox importer slave"); - exit(1); - } - - while ( !die ) { - - sigprocmask(SIG_UNBLOCK, &sset, NULL); - sleep(5); - sigprocmask(SIG_BLOCK, &sset, NULL); - - if ( child_died ) { - int pid; - - while ( (pid = waitpid(-1, NULL, WNOHANG)) > 0 ) { - if ( !die ) { - if ( pid == reg_pid ) { - dprintf("[master] reg importer slave died [%d]\n", pid); - if (!debug) syslog(LOG_INFO, "reg importer slave died [%d]\n", die); - if ( (reg_pid = slave(reg_importer, "reg-imp")) < 0 ) { - perror("starting reg importer slave"); - kill(0, SIGINT); - exit(1); - } - dprintf("[master] reg importer slave restarted [%d]\n", reg_pid); - } else if ( pid == sandbox_pid ) { - dprintf("[master] sandbox importer slave died [%d]\n", pid); - if (!debug) syslog(LOG_INFO, "sandbox importer slave died [%d]\n", die); - if ( (sandbox_pid = slave(sandbox_importer, "sandbox-imp")) < 0 ) { - perror("starting sandbox importer slave"); - kill(0, SIGINT); - exit(1); - } - dprintf("[master] sandbox importer slave restarted [%d]\n", sandbox_pid); - } else /* must be in dump_pids */ { - dprintf("[master] dump importer slave died [%d]\n", pid); - if (!debug) syslog(LOG_INFO, "dump importer slave died [%d]\n", die); - for (i=0; (i < dump_slaves) && (pid != dump_pids[i]); i++); - assert(i < dump_slaves); // pid should be in pool - - if ( (dump_pids[i] = slave(dump_importer, "dump-imp")) < 0 ) { - perror("starting dump importer slave"); - kill(0, SIGINT); - exit(1); - } - dprintf("[master] dump importer slave restarted [%d]\n", dump_pids[i]); - - } - - } - } - child_died = 0; - continue; - } - } - - dprintf("[master] Terminating on signal %d\n", die); - if (!debug) syslog(LOG_INFO, "Terminating on signal %d\n", die); - kill(0, die); - - globus_module_deactivate_all(); - unlink(pidfile); - - return 0; -} - -static int slave(int (*fn)(void), const char *nm) -{ - struct sigaction sa; - sigset_t sset; - int pid, - conn_cnt = 0; - - - if ( (pid = fork()) ) return pid; - - asprintf(&name,"%s %d",nm,getpid()); - memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL); - sa.sa_handler = catchsig; - sigaction(SIGUSR1, &sa, NULL); - - sigemptyset(&sset); - sigaddset(&sset, SIGTERM); - sigaddset(&sset, SIGINT); - sigaddset(&sset, SIGUSR1); - sigprocmask(SIG_BLOCK, &sset, NULL); - - dprintf("[%s] slave started - pid [%d]\n", name, getpid()); - -#ifdef JP_PERF - while ( !die && (conn_cnt < MAX_REG_CONNS || (sink & 1)) ) { -#else - while ( !die && (conn_cnt < MAX_REG_CONNS) ) { -#endif - int ret = fn(); - - if ( ret > 0 ) conn_cnt++; - else if ( ret < 0 ) exit(1); - else if ( ret == 0 ) { - sigprocmask(SIG_UNBLOCK, &sset, NULL); - sleep(poll); - sigprocmask(SIG_BLOCK, &sset, NULL); - } - } - - if ( die ) { - dprintf("[%s] %d: Terminating on signal %d\n", name, getpid(), die); - if ( !debug ) syslog(LOG_INFO, "Terminating on signal %d", die); - } - dprintf("[%s] Terminating after %d connections\n", name, conn_cnt); - if ( !debug ) syslog(LOG_INFO, "Terminating after %d connections", conn_cnt); - - if (gftp_initialized--) - globus_ftp_client_handle_destroy(&hnd); - - exit(0); -} - - -static int reg_importer(void) -{ - struct _jpelem__RegisterJob in; - struct _jpelem__RegisterJobResponse empty; - int ret; - static int readnew = 1; - char *msg = NULL, - *fname = NULL, - *aux; - - if ( readnew ) ret = glite_lbu_MaildirTransStart(reg_mdir, &msg, &fname); - else ret = glite_lbu_MaildirRetryTransStart(reg_mdir, (time_t)JPREG_REPEAT_TIMEOUT, (time_t)JPREG_GIVUP_TIMEOUT, &msg, &fname); - if ( !ret ) { - readnew = !readnew; - if ( readnew ) ret = glite_lbu_MaildirTransStart(reg_mdir, &msg, &fname); - else ret = glite_lbu_MaildirRetryTransStart(reg_mdir, (time_t)JPREG_REPEAT_TIMEOUT, (time_t)JPREG_GIVUP_TIMEOUT, &msg, &fname); - if ( !ret ) { - readnew = !readnew; - return 0; - } - } - - if ( ret < 0 ) { - dprintf("[%s] glite_lbu_MaildirTransStart: %s (%s)\n", name, strerror(errno), lbm_errdesc); - if ( !debug ) syslog(LOG_ERR, "glite_lbu_MaildirTransStart: %s (%s)", strerror(errno), lbm_errdesc); - return -1; - } else if ( ret > 0 ) { - dprintf("[%s] JP registration request received\n", name); - if ( !debug ) syslog(LOG_INFO, "JP registration request received\n"); - - ret = 0; - if ( !(aux = strchr(msg, '\n')) ) { - dprintf("[%s] Wrong format of message!\n", name); - if ( !debug ) syslog(LOG_ERR, "Wrong format of message\n"); - ret = 0; - } else do { - *aux++ = '\0'; - in.job = msg; - in.owner = aux; - dprintf("[%s] Registering '%s'\n", name, msg); - if ( !debug ) syslog(LOG_INFO, "Registering '%s'\n", msg); -#ifdef JP_PERF - if ((sink & 1)) { - if (strncasecmp(msg, PERF_JOBID_START_PREFIX, sizeof(PERF_JOBID_START_PREFIX) - 1) == 0) { - stats_init(&perf, name); - stats_set_jobid(&perf, msg); - } - if (perf.name && !perf.limit) stats_get_limit(&perf, name); - } - if (!(sink & 2)) { -#endif - refresh_connection(soap); - ret = soap_call___jpsrv__RegisterJob(soap, jpps, "", &in, &empty); - if ( (ret = check_soap_fault(soap, ret)) ) break; -#ifdef JP_PERF - } else ret = 0; - if (perf.name && ret == 0) { - perf.count++; - if (perf.limit) { - dprintf("[%s statistics] done %ld/%ld\n", name, perf.count, perf.limit); - if (perf.count >= perf.limit) stats_done(&perf); - } else - dprintf("[%s statistics] done %ld/no limit\n", name, perf.count); - } -#endif - } while (0); - glite_lbu_MaildirTransEnd(reg_mdir, fname, ret? LBMD_TRANS_FAILED_RETRY: LBMD_TRANS_OK); - free(fname); - free(msg); - return 1; - } - - return 0; -} - -static int dump_importer(void) -{ - struct _jpelem__StartUpload su_in; - struct _jpelem__StartUploadResponse su_out; - struct _jpelem__CommitUpload cu_in; - struct _jpelem__CommitUploadResponse empty; - struct _jpelem__RegisterJob rj_in; - struct _jpelem__RegisterJobResponse rj_empty; - struct _jpelem__GetJobAttributes gja_in; - struct _jpelem__GetJobAttributesResponse gja_out; - static int readnew = 1; - char *msg = NULL, - *fname = NULL, - *bname; - char fspec[PATH_MAX]; - int ret, retry_upload, jperrno; - int fhnd; - msg_pattern_t tab[] = { - {"jobid", NULL}, - {"file", NULL}, - {"jpps", NULL}, - {"proxy", NULL}, - {NULL, NULL}}; -#define _job 0 -#define _file 1 -#define _jpps 2 -#define _proxy 3 - - - if ( readnew ) ret = glite_lbu_MaildirTransStart(dump_mdir, &msg, &fname); - else ret = glite_lbu_MaildirRetryTransStart(dump_mdir, (time_t)JP_REPEAT_TIMEOUT, (time_t)JP_GIVUP_TIMEOUT, &msg, &fname); - if ( !ret ) { - readnew = !readnew; - if ( readnew ) ret = glite_lbu_MaildirTransStart(dump_mdir, &msg, &fname); - else ret = glite_lbu_MaildirRetryTransStart(dump_mdir, (time_t)JP_REPEAT_TIMEOUT, (time_t)JP_GIVUP_TIMEOUT, &msg, &fname); - if ( !ret ) { - readnew = !readnew; - return 0; - } - } - - if ( ret < 0 ) { - dprintf("[%s] glite_lbu_MaildirTransStart: %s (%s)\n", name, strerror(errno), lbm_errdesc); - if ( !debug ) syslog(LOG_ERR, "glite_lbu_MaildirTransStart: %s (%s)", strerror(errno), lbm_errdesc); - return -1; - } - - dprintf("[%s] dump JP import request received\n", name); - if ( !debug ) syslog(LOG_INFO, "dump JP import request received"); - - soap_begin(soap); - - ret = 0; - if ( parse_msg(msg, tab) < 0 ) { - dprintf("[%s] Wrong format of message!\n", name); - if ( !debug ) syslog(LOG_ERR, "Wrong format of message"); - ret = 0; - } else do { - su_in.job = tab[_job].val; - su_in.class_ = "urn:org.glite.jp.primary:lb"; - su_in.name = NULL; - su_in.commitBefore = 1000 + time(NULL); - su_in.contentType = "text/lb"; -#ifdef JP_PERF - if ((sink & 1)) { - /* statistics started by file, ended by count limit (from the appropriate result fikle) */ - FILE *f; - char item[200]; - - /* starter */ - if (!perf.name) { - f = fopen(PERF_START_FILE, "rt"); - if (f) { - stats_init(&perf, name); - fscanf(f, "%s", item); - fclose(f); - unlink(PERF_START_FILE); - stats_set_jobid(&perf, item); - } else - dprintf("[%s statistics]: not started/too much dumps: %s\n", name, strerror(errno)); - } - if (perf.name && !perf.limit) stats_get_limit(&perf, name); - } - if (!(sink & 2)) { -#endif - retry_upload = 2; - do { - dprintf("[%s] Importing LB dump file '%s'\n", name, tab[_file].val); - if ( !debug ) syslog(LOG_INFO, "Importing LB dump file '%s'\n", msg); - refresh_connection(soap); - ret = soap_call___jpsrv__StartUpload(soap, tab[_jpps].val?:jpps, "", &su_in, &su_out); - if ( (ret = check_soap_fault(soap, ret)) ) { - /* unsuccessful dump, register job */ - refresh_connection(soap); - /* check job existence */ - memset(&gja_in, 0, sizeof gja_in); - memset(&gja_out, 0, sizeof gja_out); - gja_in.jobid = su_in.job; - gja_in.attributes = soap_malloc(soap, sizeof(char *)); - gja_in.__sizeattributes = 1; - gja_in.attributes[0] = GLITE_JP_ATTR_REGTIME; - ret = soap_call___jpsrv__GetJobAttributes(soap, jpps, "", &gja_in, &gja_out); - jperrno = glite_jp_clientGetErrno(soap, ret); - gja_in.attributes[0] = NULL; - /* no error ==> some application fault from JP */ - if (jperrno == 0) { - dprintf("[%s] Dump failed when job %s exists\n", name, su_in.job); - ret = -1; - break; - } - /* other then "job not found" error ==> other problem, don't register */ - if (jperrno != ENOENT && jperrno != -2) { - ret = check_soap_fault(soap, ret); - break; - } - /* "job not found" error ==> register job */ - refresh_connection(soap); - rj_in.job = su_in.job; - rj_in.owner = mycred->name; - dprintf("[%s] Failsafe registration\n", name); - dprintf("[%s] \tjobid: %s\n[%s] \towner: %s\n", name, rj_in.job, name, rj_in.owner); - if ( !debug ) syslog(LOG_INFO, "Failsafe registration '%s'\n",rj_in.job); - ret = soap_call___jpsrv__RegisterJob(soap, tab[_jpps].val?:jpps, "", &rj_in, &rj_empty); - if ( (ret = check_soap_fault(soap, ret)) ) break; - retry_upload--; - ret = 1; - } - } while (ret != 0 && retry_upload > 0); - if (ret) break; - dprintf("[%s] Destination: %s\n\tCommit before: %s\n", name, su_out.destination, ctime(&su_out.commitBefore)); - if (su_out.destination == NULL) { - dprintf("[%s] StartUpload returned NULL destination\n", name); - if ( !debug ) syslog(LOG_ERR, "StartUpload returned NULL destination"); - ret = 1; - break; - } - - if ( (fhnd = open(tab[_file].val, O_RDONLY)) < 0 ) { - dprintf("[%s] Can't open dump file: %s\n", name, tab[_file].val); - if ( !debug ) syslog(LOG_ERR, "Can't open dump file: %s", tab[_file].val); - ret = 1; - break; - } - if ( (ret = gftp_put_file(su_out.destination, fhnd)) ) break; - close(fhnd); - dprintf("[%s] File sent, commiting the upload\n", name); - cu_in.destination = su_out.destination; - refresh_connection(soap); - ret = soap_call___jpsrv__CommitUpload(soap, tab[_jpps].val?:jpps, "", &cu_in, &empty); - if ( (ret = check_soap_fault(soap, ret)) ) break; - dprintf("[%s] Dump upload succesfull\n", name); -#ifdef JP_PERF - } else ret = 0; - if (perf.name && ret == 0) { - perf.count++; - if (perf.limit) { - dprintf("[%s statistics] done %ld/%ld\n", name, perf.count, perf.limit); - if (perf.count >= perf.limit) stats_done(&perf); - } else - dprintf("[%s statistics] done %ld/no limit\n", name, perf.count); - } -#endif - if (store && *store) { - bname = strdup(tab[_file].val); - snprintf(fspec, sizeof fspec, "%s/%s", store, basename(bname)); - free(bname); - if (rename(tab[_file].val, fspec) != 0) - fprintf(stderr, "moving %s to %s failed: %s\n", tab[_file].val, fspec, strerror(errno)); - else - dprintf("[%s] moving %s to %s OK\n", name, tab[_file].val, fspec); - } else { - if (unlink(tab[_file].val) != 0) - fprintf(stderr, "removing %s failed: %s\n", tab[_file].val, strerror(errno)); - else - dprintf("[%s] %s removed\n", name, tab[_file].val); - } - } while (0); - soap_end(soap); - - glite_lbu_MaildirTransEnd(dump_mdir, fname, ret? LBMD_TRANS_FAILED_RETRY: LBMD_TRANS_OK); - free(fname); - free(msg); - - return 1; -} - - -static int sandbox_importer(void) -{ - struct _jpelem__StartUpload su_in; - struct _jpelem__StartUploadResponse su_out; - struct _jpelem__CommitUpload cu_in; - struct _jpelem__CommitUploadResponse empty; - static int readnew = 1; - char *msg = NULL, - *fname = NULL; - int ret; - int fhnd; - msg_pattern_t tab[] = { - {"jobid", NULL}, - {"file", NULL}, - {"jpps", NULL}, - {"proxy", NULL}, - {NULL, NULL}}; - -#define _job 0 -#define _file 1 -#define _jpps 2 -#define _proxy 3 - - - if ( readnew ) ret = glite_lbu_MaildirTransStart(sandbox_mdir, &msg, &fname); - else ret = glite_lbu_MaildirRetryTransStart(sandbox_mdir, (time_t)JP_REPEAT_TIMEOUT, (time_t)JP_GIVUP_TIMEOUT ,&msg, &fname); - if ( !ret ) { - readnew = !readnew; - if ( readnew ) ret = glite_lbu_MaildirTransStart(sandbox_mdir, &msg, &fname); - else ret = glite_lbu_MaildirRetryTransStart(sandbox_mdir, (time_t)JP_REPEAT_TIMEOUT, (time_t)JP_GIVUP_TIMEOUT ,&msg, &fname); - if ( !ret ) { - readnew = !readnew; - return 0; - } - } - - if ( ret < 0 ) { - dprintf("[%s] glite_lbu_MaildirTransStart: %s (%s)\n", name, strerror(errno), lbm_errdesc); - if ( !debug ) syslog(LOG_ERR, "glite_lbu_MaildirTransStart: %s (%s)", strerror(errno), lbm_errdesc); - return -1; - } - - dprintf("[%s] sandbox JP import request received\n", name); - if ( !debug ) syslog(LOG_INFO, "sandbox JP import request received"); - - ret = 0; - if ( parse_msg(msg, tab) < 0 ) { - dprintf("[%s] Wrong format of message!\n", name); - if ( !debug ) syslog(LOG_ERR, "Wrong format of message"); - ret = 0; - } else do { - su_in.job = tab[_job].val; - // XXX: defined in org.glite.jp.primary/src/builtin_plugins.h - // shloud use symbolic const... - // do not distinquish between ibs and obs now - su_in.class_ = "urn:org.glite.jp.primary:isb"; - su_in.name = NULL; - su_in.commitBefore = 1000 + time(NULL); - su_in.contentType = "tar/lb"; - dprintf("[%s] Importing LB sandbox tar file '%s'\n", name, tab[_file].val); - if ( !debug ) syslog(LOG_INFO, "Importing LB sandbox tar file '%s'\n", msg); -#ifdef JP_PERF - if (!(sink & 2)) { -#endif - refresh_connection(soap); - ret = soap_call___jpsrv__StartUpload(soap, tab[_jpps].val?:jpps, "", &su_in, &su_out); - ret = check_soap_fault(soap, ret); - /* XXX: grrrrrrr! test it!!!*/ -// if ( (ret = check_soap_fault(soap, ret)) ) break; - dprintf("[%s] Destination: %s\n\tCommit before: %s\n", name, su_out.destination, ctime(&su_out.commitBefore)); - - if ( (fhnd = open(tab[_file].val, O_RDONLY)) < 0 ) { - dprintf("[%s] Can't open sandbox tar file: %s\n", name, tab[_file].val); - if ( !debug ) syslog(LOG_ERR, "Can't open sandbox tar file: %s", tab[_file].val); - ret = 1; - break; - } - if ( (ret = gftp_put_file(su_out.destination, fhnd)) ) break; - close(fhnd); - dprintf("[%s] File sent, commiting the upload\n", name); - cu_in.destination = su_out.destination; - refresh_connection(soap); - ret = soap_call___jpsrv__CommitUpload(soap, tab[_jpps].val?:jpps, "", &cu_in, &empty); - if ( (ret = check_soap_fault(soap, ret)) ) break; - dprintf("[%s] Dump upload succesfull\n", name); -#ifdef JP_PERF - } else ret = 0; -#endif - } while (0); - - glite_lbu_MaildirTransEnd(sandbox_mdir, fname, ret? LBMD_TRANS_FAILED_RETRY: LBMD_TRANS_OK); - free(fname); - free(msg); - - return 1; -} - - -/** Parses every line looking for pattern string and stores the value into - * the given variable - * - * line format is: key[space(s)]+val - */ -int parse_msg(char *msg, msg_pattern_t tab[]) -{ - char *eol = msg, - *key, *val; - - while ( eol && *eol != '\0' ) { - int i; - - key = eol; - if ( (eol = strchr(key, '\n')) ) *eol++ = '\0'; - while ( isblank(*key) ) key++; - if ( *key == '\0' ) continue; - val = key; - while ( !isblank(*val) ) val++; - if ( *val == '\0' ) return -1; - *val++ = '\0'; - while ( isblank(*val) ) val++; - if ( *val == '\0' ) return -1; - - for ( i = 0; tab[i].key; i++ ) { - if ( !strcmp(tab[i].key, key) ) { - tab[i].val = val; - break; - } - } - } - - return 0; -} - - -#define BUFSZ 1024 - -static globus_mutex_t gLock; -static globus_cond_t gCond; -static globus_bool_t gDone; -static globus_bool_t gError = GLOBUS_FALSE; -static globus_byte_t gBuffer[BUFSZ]; -static int gOffset; - - -static void gftp_done_cb( - void *user_arg, - globus_ftp_client_handle_t *handle, - globus_object_t *err) -{ - if ( err != GLOBUS_SUCCESS ) { - char *tmp = globus_object_printable_to_string(err); - dprintf("[%s] Error in callback: %s\n", name, tmp); - if ( !debug ) syslog(LOG_ERR, "Error in callback: %s", tmp); - gError = GLOBUS_TRUE; - globus_libc_free(tmp); - } - globus_mutex_lock(&gLock); - gDone = GLOBUS_TRUE; - globus_cond_signal(&gCond); - globus_mutex_unlock(&gLock); -} - -static void gftp_data_cb( - void *user_arg, - globus_ftp_client_handle_t *handle, - globus_object_t *error, - globus_byte_t *buffer, - globus_size_t length, - globus_off_t offset, - globus_bool_t eof) -{ - if ( !eof ) { - int rc; - globus_mutex_lock(&gLock); - if ( (rc = read(*((int *)user_arg), gBuffer, BUFSZ)) < 0 ) { - dprintf("[%s] Error reading dump file\n", name); - if ( !debug ) syslog(LOG_ERR, "Error reading dump file"); - gDone = GLOBUS_TRUE; - gError = GLOBUS_TRUE; - globus_cond_signal(&gCond); - } else { - globus_ftp_client_register_write( - handle, gBuffer, rc, gOffset, rc == 0, gftp_data_cb, user_arg); - gOffset += rc; - } - globus_mutex_unlock(&gLock); - } -} - -static int gftp_put_file(const char *url, int fhnd) -{ - static globus_ftp_client_operationattr_t op_attr; - static globus_ftp_client_handleattr_t hnd_attr; - int gftp_retried = 0; - - globus_mutex_init(&gLock, GLOBUS_NULL); - globus_cond_init(&gCond, GLOBUS_NULL); - - /* one lost connection survival cycle */ - do { - - if (!gftp_initialized++) { -#define put_file_err(errs) { \ - dprintf("[%s] %s\n", name, errs); \ - if ( !debug ) syslog(LOG_ERR, errs); \ - return 1; \ -} - if ( globus_ftp_client_handleattr_init(&hnd_attr) != GLOBUS_SUCCESS ) - put_file_err("Could not initialise handle attributes"); - - if ( globus_ftp_client_handleattr_set_cache_all(&hnd_attr, GLOBUS_TRUE) != GLOBUS_SUCCESS) - put_file_err("Could not set connection caching"); - - if ( globus_ftp_client_operationattr_init(&op_attr) != GLOBUS_SUCCESS ) - put_file_err("Could not initialise operation attributes"); - - if ( globus_ftp_client_handle_init(&hnd, &hnd_attr) != GLOBUS_SUCCESS ) - put_file_err("Could not initialise ftp client handle"); - } - if ( globus_ftp_client_operationattr_set_authorization( - &op_attr, server_cert? mycred->gss_cred: GSS_C_NO_CREDENTIAL, - NULL, "", 0, NULL) != GLOBUS_SUCCESS ) - put_file_err("Could not set authorization procedure"); -#undef put_file_err - - gDone = GLOBUS_FALSE; - gError = GLOBUS_FALSE; - - /* do the op */ - if ( globus_ftp_client_put( - &hnd, url, &op_attr, - GLOBUS_NULL, gftp_done_cb, (void *)&fhnd) != GLOBUS_SUCCESS) { - dprintf("[%s] Could not start file put\n", name); - if ( !debug ) syslog(LOG_ERR, "Could not start file put"); - gError = GLOBUS_TRUE; - gDone = GLOBUS_TRUE; - } else { - int rc; - globus_mutex_lock(&gLock); - if ( (rc = read(fhnd, gBuffer, BUFSZ)) < 0 ) { - dprintf("[%s] Error reading dump file\n", name); - if ( !debug ) syslog(LOG_ERR, "Error reading dump file"); - gDone = GLOBUS_TRUE; - gError = GLOBUS_TRUE; - globus_cond_signal(&gCond); - } else { - globus_ftp_client_register_write(&hnd, - gBuffer, rc, gOffset, rc == 0, gftp_data_cb, (void *)&fhnd); - gOffset += rc; - } - globus_mutex_unlock(&gLock); - } - - globus_mutex_lock(&gLock); - while ( !gDone ) globus_cond_wait(&gCond, &gLock); - globus_mutex_unlock(&gLock); - - if (gError == GLOBUS_TRUE) { - gftp_retried++; - gftp_initialized = 0; - globus_ftp_client_handle_destroy(&hnd); - dprintf("[%s] %s: FTP upload failed\n", name, gftp_retried <= 1 ? "Warning" : "Error"); - } - } while (gError == GLOBUS_TRUE && gftp_retried <= 1); - - return (gError == GLOBUS_TRUE)? 1: 0; -} - - -static int refresh_connection(struct soap *soap) { - struct timeval to = {JPPS_NO_RESPONSE_TIMEOUT, 0}; - edg_wll_GssCred newcred; - edg_wll_GssStatus gss_code; - glite_gsplugin_Context gp_ctx; - - gp_ctx = glite_gsplugin_get_context(soap); - glite_gsplugin_set_timeout(gp_ctx, &to); - - switch ( edg_wll_gss_watch_creds(server_cert, &cert_mtime) ) { - case 0: break; - case 1: - if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &newcred, &gss_code) ) { - dprintf("[%s] reloading credentials successful\n", name); - edg_wll_gss_release_cred(&mycred, &gss_code); - mycred = newcred; - glite_gsplugin_use_credential(gp_ctx, newcred); - } else { dprintf("[%s] reloading credentials failed, using old ones\n", name); } - break; - case -1: dprintf("[%s] edg_wll_gss_watch_creds failed\n", name); break; - } - - return 0; -} - - -#ifdef JP_PERF -static void stats_init(perf_t *perf, const char *name) { - struct timeval tv; - - memset(perf, 0, sizeof *perf); - perf->count = 0; - perf->name = strdup(name); - gettimeofday(&tv, NULL); - perf->start = tv.tv_sec + (double)tv.tv_usec / 1000000.0; - dprintf("[%s statistics] start detected\n", name); -} - -static void stats_set_jobid(perf_t *perf, const char *jobid) { - perf->id = strdup(jobid + sizeof(PERF_JOBID_START_PREFIX) - 1); - dprintf("[%s statistics] ID %s\n", perf->name, perf->id); -} - -static void stats_get_limit(perf_t *perf, const char *name) { - FILE *f; - char *fn, item[200]; - int count; - - /* stopper */ - asprintf(&fn, PERF_STOP_FILE_FORMAT, perf->id); - f = fopen(fn, "rt"); - free(fn); - if (f) { - fscanf(f, "%s\t%d", item, &count); - if (strcasecmp(item, name) != 0) fscanf(f, "%s\t%d", item, &count); - dprintf("[%s statistics] expected %d %s\n", name, count, item); - fclose(f); - perf->limit = count; - } -} - -static void stats_done(perf_t *perf) { - struct timeval tv; - - gettimeofday(&tv, NULL); - perf->end = tv.tv_sec + (double)tv.tv_usec / 1000000.0; - dprintf("[%s statistics] %s\n", perf->name, perf->id); - dprintf("[%s statistics] start: %lf\n", perf->name, perf->start); - dprintf("[%s statistics] stop: %lf\n", perf->name, perf->end); - dprintf("[%s statistics] count: %ld (%lf job/day)\n", perf->name, perf->count, 86400.0 * perf->count / (perf->end - perf->start)); - free(perf->id); - free(perf->name); - memset(perf, 0, sizeof *perf); -} -#endif - -/* XXX: we don't use it */ -SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} }; - diff --git a/org.glite.jp.client/src/jptype_map.h b/org.glite.jp.client/src/jptype_map.h deleted file mode 100644 index ee64f9d..0000000 --- a/org.glite.jp.client/src/jptype_map.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include "soap_version.h" - -#if GSOAP_VERSION >= 20700 -#define INPUT_SANDBOX jptype__UploadClass__INPUT_SANDBOX -#define OUTPUT_SANDBOX jptype__UploadClass__OUTPUT_SANDBOX -#define JOB_LOG jptype__UploadClass__JOB_LOG - -#define OWNER jptype__AttributeType__OWNER -#define TIME jptype__AttributeType__TIME -#define TAG jptype__AttributeType__TAG - -#define EQUAL jptype__queryOp__EQUAL -#define UNEQUAL jptype__queryOp__UNEQUAL -#define LESS jptype__queryOp__LESS -#define GREATER jptype__queryOp__GREATER -#define WITHIN jptype__queryOp__WITHIN -#endif - diff --git a/org.glite.jp.client/src/typemap.dat b/org.glite.jp.client/src/typemap.dat deleted file mode 100644 index 72f515f..0000000 --- a/org.glite.jp.client/src/typemap.dat +++ /dev/null @@ -1,3 +0,0 @@ -jpsrv = http://glite.org/wsdl/services/jp -jptype = http://glite.org/wsdl/types/jp -jpelem = http://glite.org/wsdl/elements/jp diff --git a/org.glite.jp.common/.cvsignore b/org.glite.jp.common/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.jp.common/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.jp.common/Makefile b/org.glite.jp.common/Makefile deleted file mode 100644 index 62f05a3..0000000 --- a/org.glite.jp.common/Makefile +++ /dev/null @@ -1,90 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -globalprefix=glite -jpprefix=jp -package=glite-jp-common -version=0.0.0 -PREFIX=/opt/glite - -globus_prefix=/opt/globus -nothrflavour=gcc32 -thrflavour=gcc32pthr -expat_prefix=/opt/expat -gsoap_prefix=/software/gsoap-2.6 - -CC=gcc - --include Makefile.inc - - -VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/project:${jpproject} - -DEBUG:=-g -O0 -W -Wno-sign-compare -CFLAGS:=${DEBUG} -D_GNU_SOURCE -I. -I${top_srcdir}/interface -I${stagedir}/include - -offset=0 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - - -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -rpath ${stagedir}/lib ${version_info} -LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} -INSTALL:=libtool --mode=install install -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} - -HDRS:=types.h context.h attr.h known_attr.h backend.h builtin_plugins.h file_plugin.h indexdb.h type_plugin.h - -SRCS:=context.c attr.c utils.c indexdb.c -OBJS:=${SRCS:.c=.lo} -THROBJS:=${OBJS:.o=.thr.lo} -LIBS:=-L${stagedir}/lib -lglite_jobid -lglite_lbu_db -THRLIBS:=${LIBS} - -commonlib:= libglite_jp_common_${nothrflavour}.la -commonlib_thr:= libglite_jp_common_${thrflavour}.la - -TEST_LIBS:=-L${cppunit}/lib -lcppunit -ldl -TEST_INC:=-I${cppunit}/include - - -default all: compile - -compile: ${commonlib} ${commonlib_thr} - -${commonlib}: ${OBJS} - ${LINK} -o $@ ${OBJS} ${LIBS} - -${commonlib_thr}: ${THROBJS} - ${LINK} -o $@ ${THROBJS} ${THRLIBS} - -check: type_test - ./type_test type_test.xml - -type_test: %: %.cpp compile - ${CXX} -c ${CFLAGS} ${TEST_INC} $< - ${LINKXX} -o $@ $@.o ${commonlib} ${TEST_LIBS} - -doc: - -stage: compile - $(MAKE) install PREFIX=${stagedir} - -install: - -mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix} - cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${jpprefix} - -mkdir -p ${PREFIX}/lib - ${INSTALL} -m 755 ${commonlib} ${commonlib_thr} ${PREFIX}/lib - -clean: - rm -rvf *.o *.lo .libs lib* - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ - rm -f glite jp - -%.thr.lo: %.c - ${COMPILE} -o $@ -c $< - -%.lo: %.c - ${COMPILE} -o $@ -c $< diff --git a/org.glite.jp.common/build.xml b/org.glite.jp.common/build.xml deleted file mode 100755 index 6e50854..0000000 --- a/org.glite.jp.common/build.xml +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.common/interface/attr.h b/org.glite.jp.common/interface/attr.h deleted file mode 100644 index aa35d09..0000000 --- a/org.glite.jp.common/interface/attr.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_ATTR_H -#define GLITE_JP_ATTR_H - -#ifdef __cplusplus -extern "C" { -#endif - -void glite_jp_attrval_free(glite_jp_attrval_t *,int); -void glite_jp_attrval_copy(glite_jp_attrval_t *,const glite_jp_attrval_t *); - -/* Search through registered type plugins and call appropriate plugin method. - * See type_plugin.h for detailed description. - */ - -int glite_jp_attrval_cmp(glite_jp_context_t ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result); - -char *glite_jp_attrval_to_db_full(glite_jp_context_t ctx,const glite_jp_attrval_t *attr); -char *glite_jp_attrval_to_db_index(glite_jp_context_t ctx,const glite_jp_attrval_t *attr,int len); - -int glite_jp_attrval_from_db(glite_jp_context_t ctx,const char *str,glite_jp_attrval_t *attr); -const char *glite_jp_attrval_db_type_full(glite_jp_context_t ctx,const char *attr); -const char *glite_jp_attrval_db_type_index(glite_jp_context_t ctx,const char *attr,int len); - -time_t glite_jp_attr2time(const char *); -char * glite_jp_time2attr(time_t); - -#ifdef __cplusplus -}; -#endif - - -#endif /* GLITE_JP_ATTR_H */ diff --git a/org.glite.jp.common/interface/backend.h b/org.glite.jp.common/interface/backend.h deleted file mode 100644 index 47df2b5..0000000 --- a/org.glite.jp.common/interface/backend.h +++ /dev/null @@ -1,131 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_BACKEND_H -#define GLITE_JP_BACKEND_H - -/* do we need it? -#include -#include -#include -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -int glite_jppsbe_get_names( - glite_jp_context_t ctx, - const char *job, - const char * /* class */, - char ***names_out -); - -int glite_jppsbe_destination_info( - glite_jp_context_t ctx, - const char *destination, - char **job_out, - char **class_out, - char **name_out -); - -int glite_jppsbe_get_job_url( - glite_jp_context_t ctx, - const char *job, - const char * /* class */, - const char *name, /* optional within class */ - char **url_out -); - -int glite_jppsbe_open_file( - glite_jp_context_t ctx, - const char *job, - const char * /* class */, - const char *name, /* optional within class */ - int mode, - void **handle_out -); - -int glite_jppsbe_close_file( - glite_jp_context_t ctx, - void *handle -); - -int glite_jppsbe_file_attrs( - glite_jp_context_t ctx, - void *handle, - struct stat *buf -); - -int glite_jppsbe_pread( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset, - ssize_t *nbytes_ret -); - -int glite_jppsbe_pwrite( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset -); - -int glite_jppsbe_append( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes -); - -int glite_jppsbe_is_metadata( - glite_jp_context_t ctx, - const char *attr -); - -int glite_jppsbe_get_job_metadata( - glite_jp_context_t ctx, - const char *job, - glite_jp_attrval_t attrs_inout[] -); - -int glite_jppsbe_query( - glite_jp_context_t ctx, - const glite_jp_query_rec_t query[], - char *attrs[], - void *arg, - int (*callback)( - glite_jp_context_t ctx, - const char *job, - const glite_jp_attrval_t metadata[], - void *arg - ) -); - -char* glite_jpps_get_namespace( - const char* attr -); - -#ifdef __cplusplus -}; -#endif - -#endif /* GLITE_JP_BACKEND_H */ - diff --git a/org.glite.jp.common/interface/builtin_plugins.h b/org.glite.jp.common/interface/builtin_plugins.h deleted file mode 100644 index a8b659d..0000000 --- a/org.glite.jp.common/interface/builtin_plugins.h +++ /dev/null @@ -1,25 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#define GLITE_JP_FILETYPE_TAGS "urn:org.glite.jp.primary:tags" -#define GLITE_JP_FILETYPE_LB "urn:org.glite.jp.primary:lb" -#define GLITE_JP_FILETYPE_CLASSAD "urn:org.glite.jp.primary:classad" -#define GLITE_JP_FILETYPE_ISB "urn:org.glite.jp.primary:isb" -#define GLITE_JP_FILETYPE_OSB "urn:org.glite.jp.primary:osb" - -#define GLITE_JP_FPLUG_TAGS_APPEND 0 diff --git a/org.glite.jp.common/interface/context.h b/org.glite.jp.common/interface/context.h deleted file mode 100644 index ba702bc..0000000 --- a/org.glite.jp.common/interface/context.h +++ /dev/null @@ -1,43 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_CONTEXT_H -#define GLITE_JP_CONTEXT_H - -#ifdef __cplusplus -extern "C" { -#endif - -int glite_jp_init_context(glite_jp_context_t *); -void glite_jp_free_context(glite_jp_context_t); -void glite_jp_free_query_rec(glite_jp_query_rec_t *); - -char *glite_jp_peer_name(glite_jp_context_t); -char *glite_jp_error_chain(glite_jp_context_t); - -int glite_jp_stack_error(glite_jp_context_t, const glite_jp_error_t *); -int glite_jp_clear_error(glite_jp_context_t); - -int glite_jp_add_deferred(glite_jp_context_t,int (*)(glite_jp_context_t,void *),void *); -int glite_jp_run_deferred(glite_jp_context_t); - - -#ifdef __cplusplus -}; -#endif - -#endif /* GLITE_JP_CONTEXT_H */ diff --git a/org.glite.jp.common/interface/file_plugin.h b/org.glite.jp.common/interface/file_plugin.h deleted file mode 100644 index 52f0a37..0000000 --- a/org.glite.jp.common/interface/file_plugin.h +++ /dev/null @@ -1,103 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_FILEPLUGIN_H -#define GLITE_JP_FILEPLUGIN_H - -/** Methods of the file plugin. */ - -typedef struct _glite_jpps_fplug_op_t { - -/** Open a file. -\param[in] fpctx Context of the plugin, returned by its init. -\param[in] bhandle Handle of the file via JPPS backend. -\param[in] uri URI (type) of the opened file. -\param[out] handle Handle to the opened file structure, to be passed to other plugin functions. -*/ - int (*open)(void *fpctx,void *bhandle,const char *uri,void **handle); -/** Open from a string. -\param[in] fpctx Context of the plugin, returned by its init. -\param[in] str The string to use. -\param[in] uri URI (type) of the string -\param[in] ns namespace to handle -\param[out] handle Handle to the opened file structure, to be passed to other plugin functions. -*/ - - int (*open_str)(void *fpctx,const char *str,const char *uri,const char *ns,void **handle); - -/** Close the file. Free data associated to a handle */ - int (*close)(void *fpctx,void *handle); - -/** "Preprocess" the file -- this function is called once after the file is commited */ - int (*filecom)(void *fpctx,void *handle); - -/** Retrieve value(s) of an attribute. -\param[in] fpctx Plugin context. -\param[in] handle Handle of the opened file. -\param[in] ns Namespace of queried attribute. -\param[in] attr Queried attribute. -\param[out] attrval GLITE_JP_ATTR_UNDEF-terminated list of value(s) of the attribute. - If there are more and there is an interpretation of their order - they must be sorted, eg. current value of tag is the last one. -\retval 0 success -\retval ENOSYS this attribute is not defined by this type of file -\retval ENOENT no value is present -*/ - int (*attr)(void *fpctx,void *handle, const char *attr,glite_jp_attrval_t **attrval); - -/** File type specific operation. -\param[in] fpctx Plugin context. -\param[in] handle Handle of the opened file. -\param[in] oper Code of the operation, specific for a concrete plugin. -*/ - int (*generic)(void *fpctx,void *handle,int oper,...); - -} glite_jpps_fplug_op_t; - -/** Data describing a plugin. */ -typedef struct _glite_jpps_fplug_data_t { - void *fpctx; /**< Context passed to plugin operations. */ - char **uris; /**< NULL-terminated list of file types (URIs) - handled by the plugin. */ - char **classes; /**< The same as uris but filesystem-friendly - (can be used to construct file names).*/ - char **namespaces; /**< Which attribute namespaces this plugin handles. */ - - glite_jpps_fplug_op_t ops; /**< Plugin operations. */ -} glite_jpps_fplug_data_t; - -/** Initialisation function of the plugin. - Called after dlopen(), must be named "init". -\param[in] ctx JPPS context -\param[out] data filled-in plugin data -*/ - -typedef int (*glite_jpps_fplug_init_t)( - glite_jp_context_t ctx, - glite_jpps_fplug_data_t *plugin_data -); - - - - -/* XXX: not really public interface follows */ - -int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv); -int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t ***plugin_data); -int glite_jpps_fplug_lookup_byclass(glite_jp_context_t, const char *class,glite_jpps_fplug_data_t ***plugin_data); - -#endif /* GLITE_JP_FILEPLUGIN_H */ diff --git a/org.glite.jp.common/interface/indexdb.h b/org.glite.jp.common/interface/indexdb.h deleted file mode 100644 index 06761d3..0000000 --- a/org.glite.jp.common/interface/indexdb.h +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_INDEXDB_H -#define GLITE_JP_INDEXDB_H - -/** - * \file indexdb.h - * \brief Helper functions for accessing Job Provenance Index Server database. - */ - -#include "glite/lbu/db.h" - -#ifdef __cplusplus -extern "C" { -#endif - - -#ifdef GLITE_JP_INDEX_COMPILE - -/** - * For generating table names. - */ -#define GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "attr_" - -#endif - - -/** - * Returns internal id from attribute name. - * - * The attribute id is used in some places in the database schema. Because of the future possible changes in the schema, you should rather use other functions to get SQL commands (table names and where conditions). - * - * \param[in] name attribute name - * \return attribute id string - */ -char *glite_jp_indexdb_attr2id(const char *name); - -/** - * Get parts of the SQL SELECT command to the given attribute: - * - * SELECT column, full_value_column FROM table WHERE where; - * - * This is quick version requiring additional information about indexing of the attribute. - */ -int glite_jp_indexdb_attr2select_from_index(const char *name, int indexed, char **column, char **full_value_column, char **table, char **where); - -/** - * Get parts of the SQL SELECT command to the given attribute: - * - * SELECT column, full_value_column FROM table WHERE where; - * - * This is the most portable way - it will peep to the DB for information about indexing. - */ -int glite_jp_indexdb_attr2select_from_db(const char *name, glite_lbu_DBContext dbctx, char **column, char **full_value_column, char **table, char **where); - -#ifdef __cplusplus -}; -#endif - - -#endif /* GLITE_JP_INDEXDB_H */ diff --git a/org.glite.jp.common/interface/known_attr.h b/org.glite.jp.common/interface/known_attr.h deleted file mode 100644 index 196eb93..0000000 --- a/org.glite.jp.common/interface/known_attr.h +++ /dev/null @@ -1,58 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_KNOWN_ATTR_H -#define GLITE_JP_KNOWN_ATTR_H - -/** Namespace of JP system attributes */ -#define GLITE_JP_SYSTEM_NS "http://egee.cesnet.cz/en/Schema/JP/System" -#define GLITE_JP_WORKFLOW_NS "http://egee.cesnet.cz/en/Schema/JP/Workflow" - -/** Job owner, as specified with RegisterJob JPPS operation */ -#define GLITE_JP_ATTR_OWNER GLITE_JP_SYSTEM_NS ":owner" - -/** JobId */ -#define GLITE_JP_ATTR_JOBID GLITE_JP_SYSTEM_NS ":jobId" - -/** Timestamp of job registration in JP. - * Should be almost the same time as registration with LB. */ -#define GLITE_JP_ATTR_REGTIME GLITE_JP_SYSTEM_NS ":regtime" - -/** Workflow node relationships. */ -#define GLITE_JP_ATTR_WF_ANCESTOR GLITE_JP_WORKFLOW_NS ":ancestor" -#define GLITE_JP_ATTR_WF_SUCCESSOR GLITE_JP_WORKFLOW_NS ":successor" - -/** Attributes derived from LB system data - * \see jp_job_attrs.h */ - -/** Namespace for LB user tags, schemaless, all values are strings */ -#define GLITE_JP_LBTAG_NS "http://egee.cesnet.cz/en/WSDL/jp-lbtag" -#define GLITE_JP_JDL_NS "http://jdl" - -/** Namespace for Sandboxes */ -#define GLITE_JP_ISB_NS "http://egee.cesnet.cz/en/Schema/JP/ISB" -#define GLITE_JP_OSB_NS "http://egee.cesnet.cz/en/Schema/JP/OSB" - -/** Namespace for file names listed from tar */ -#define GLITE_JP_ATTR_ISB_FILENAME GLITE_JP_ISB_NS ":filename" -#define GLITE_JP_ATTR_OSB_FILENAME GLITE_JP_OSB_NS ":filename" - -/** Namespace for filenames to be unpacked from sanbox tar */ -#define GLITE_JP_ISB_CONTENT_NS GLITE_JP_ISB_NS ":content" -#define GLITE_JP_OSB_CONTENT_NS GLITE_JP_OSB_NS ":content" - -#endif /* GLITE_JP_KNOWN_ATTR_H */ diff --git a/org.glite.jp.common/interface/type_plugin.h b/org.glite.jp.common/interface/type_plugin.h deleted file mode 100644 index 8442ce8..0000000 --- a/org.glite.jp.common/interface/type_plugin.h +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_TYPEPLUGIN_H -#define GLITE_JP_TYPEPLUGIN_H - -typedef struct _glite_jp_tplug_data_t { - - char *namespace; - void *pctx; - -/** Compare attribute values. - * \param[in] a value to compare - * \param[in] b value to compare - * \param[out] result like strcmp() - * \param[out] err set if the values cannot be compared - * \retval 0 OK - * \retval other error - */ - int (*cmp)( - void *ctx, - const glite_jp_attrval_t *a, - const glite_jp_attrval_t *b, - int *result); - -/** Convert to database string representation. - * It is guaranteed the returned value can be converted back with - * from_db(). - * The resulting value may not be suitable for indexing with db engine. - * - * \param[in] attr the attribute value to convert - * \retval NULL can't be converted - * \retval other the string representation. - * */ - char * (*to_db_full)(void *ctx,const glite_jp_attrval_t *attr); - -/** Convert to a database string representation suitable for indexing. - * The function is non-decreasing (wrt. cmp() above and strcmp()), however it - * is not guaranteed to be one-to-one. - * - * \param[in] attr the value to convert - * \param[in] len maximum length of the converted value. - * \retval NULL can't be converted - * \retval other the string representation - */ - char * (*to_db_index)(void *ctx,const glite_jp_attrval_t *attr,int len); - -/** Convert from the database format. - * \param[in] str the string value - * \param[inout] attr name contains the name of the attribute to be converted - * the rest of attr is filled in. - */ - int (*from_db)(void *ctx,const char *str,glite_jp_attrval_t *attr); - -/** Query for database types suitable to store values returned by - * to_db_full() and to_db_index(). - * Useful for db column dynamic creation etc. - * Return pointer to internal static data, non-reentrant. - */ - const char * (*db_type_full)(void *ctx,const char *attr); - const char * (*db_type_index)(void *ctx,const char *attr,int len); - -} glite_jp_tplug_data_t; - -/** Plugin init function. - Must be called init, supposed to be called as many times as required - for different param's (e.g. xsd files). - Registers the plugin in ctx. - */ - -typedef int (*glite_jp_tplug_init_t)( - glite_jp_context_t ctx, - const char *param, - glite_jp_tplug_data_t *plugin_data -); - -#endif /* GLITE_JP_TYPEPLUGIN_H */ diff --git a/org.glite.jp.common/interface/types.h b/org.glite.jp.common/interface/types.h deleted file mode 100644 index 97e8281..0000000 --- a/org.glite.jp.common/interface/types.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_TYPES_H -#define GLITE_JP_TYPES_H - -#include - -typedef struct _glite_jp_error_t { - int code; - const char *desc; - const char *source; - struct _glite_jp_error_t *reason; -} glite_jp_error_t; - -typedef struct _glite_jp_context { - glite_jp_error_t *error; - int (**deferred_func)(struct _glite_jp_context *,void *); - void **deferred_arg; - void *feeds; - struct soap *other_soap; - char *peer; - void **plugins; - void **type_plugins; - void *dbhandle; - char **trusted_peers; - char *myURL; - int noauth; -} *glite_jp_context_t; - -typedef enum { - GLITE_JP_ATTR_ORIG_ANY, /**< for queries: don't care about origin */ - GLITE_JP_ATTR_ORIG_SYSTEM, /**< JP internal, e.g. job owner */ - GLITE_JP_ATTR_ORIG_USER, /**< inserted by user explicitely */ - GLITE_JP_ATTR_ORIG_FILE /**< coming from uploaded file */ -} glite_jp_attr_orig_t; - -typedef struct { - char *name; /**< including namespace */ - char *value; - int binary; /**< value is binary */ - size_t size; /**< in case of binary value */ - glite_jp_attr_orig_t origin; - char *origin_detail; /**< where it came from, i.e. file URI:name */ - time_t timestamp; -} glite_jp_attrval_t; - - -typedef enum { - GLITE_JP_QUERYOP_UNDEF, - GLITE_JP_QUERYOP_EQUAL, - GLITE_JP_QUERYOP_UNEQUAL, - GLITE_JP_QUERYOP_LESS, - GLITE_JP_QUERYOP_GREATER, - GLITE_JP_QUERYOP_WITHIN, - GLITE_JP_QUERYOP_EXISTS, - GLITE_JP_QUERYOP__LAST, -} glite_jp_queryop_t; - -typedef struct { - char *attr; - glite_jp_queryop_t op; - char *value, *value2; - int binary; - size_t size,size2; - glite_jp_attr_orig_t origin; -} glite_jp_query_rec_t; - -#endif /* GLITE_JP_TYPES_H */ diff --git a/org.glite.jp.common/project/build.number b/org.glite.jp.common/project/build.number deleted file mode 100644 index 8717663..0000000 --- a/org.glite.jp.common/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Mon Jan 16 06:46:39 CET 2006 -module.build=39 diff --git a/org.glite.jp.common/project/build.properties b/org.glite.jp.common/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.jp.common/project/configure.properties.xml b/org.glite.jp.common/project/configure.properties.xml deleted file mode 100644 index d4e6f4f..0000000 --- a/org.glite.jp.common/project/configure.properties.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -jpprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -expat_prefix=${with.expat.prefix} -gsoap_prefix=${with.gsoap.prefix} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -cppunit=${with.cppunit.prefix} -jpproject=${subsystem.project.dir} -project=${component.project.dir} - - - diff --git a/org.glite.jp.common/project/properties.xml b/org.glite.jp.common/project/properties.xml deleted file mode 100755 index b9d669d..0000000 --- a/org.glite.jp.common/project/properties.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.common/project/tar_exclude b/org.glite.jp.common/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.jp.common/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.jp.common/project/version.properties b/org.glite.jp.common/project/version.properties deleted file mode 100644 index 1441742..0000000 --- a/org.glite.jp.common/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.3.0 -module.age=1 diff --git a/org.glite.jp.common/src/attr.c b/org.glite.jp.common/src/attr.c deleted file mode 100644 index 0e9eee1..0000000 --- a/org.glite.jp.common/src/attr.c +++ /dev/null @@ -1,308 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include "glite/jobid/strmd5.h" -#include "types.h" -#include "attr.h" -#include "type_plugin.h" -#include "context.h" - -void glite_jp_attrval_free(glite_jp_attrval_t *a,int f) -{ - free(a->name); - free(a->value); - free(a->origin_detail); - memset(a,0,sizeof *a); - if (f) free(a); -} - -void glite_jp_attrval_copy(glite_jp_attrval_t *dst,const glite_jp_attrval_t *src) -{ - dst->name = strdup(src->name); - dst->origin = src->origin; - dst->size = src->size; - dst->timestamp = src->timestamp; - dst->origin_detail = src->origin_detail ? - strdup(src->origin_detail) : NULL; - if ((dst->binary = src->binary)) { - dst->value = malloc(src->size); - memcpy(dst->value,src->value,src->size); - } - else dst->value = strdup(src->value); -} - - -#define min(x,y) ((x) > (y) ? (y) : (x)) - -static int fb_cmp(void *ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result) -{ - if (a->binary != b->binary) return EINVAL; - if (a->binary) { - *result = memcmp(a->value,b->value,min(a->size,b->size)); - if (!*result && a->size != b->size) - *result = a->size > b->size ? 1 : -1; - } - else *result = strcmp(a->value,b->value); - return 0; -} - -/* XXX: depends on specific definition of glite_jp_attr_orig_t */ -static char orig_char[] = "ASUF"; - -/* XXX: don't allocate memory, don't grow more than twice */ -static int escape_colon(const char *in, char *out) -{ - int i,o; - - for (i=o=0; in[i]; i++) switch (in[i]) { - case ':': out[o++] = '\\'; out[o++] = ':'; break; - case '\\': out[o++] = '\\'; out[o++] = '\\'; break; - default: out[o++] = in[i]; break; - } - out[o] = 0; - return o; -} - -/* XXX: read until unescaped colon is found - * allocates output */ -static char * unescape_colon(const char *in,int *rd) -{ - int i,o; - char *out; - - for (i=o=0; in[i] && in[i] != ':'; i++,o++) - if (in[i] == '\\') i++; - - out = malloc(o+1); - - for (i=o=0; in[i] && in[i] != ':'; i++) - if (in[i] == '\\') out[o++] = in[++i]; - else out[o++] = in[i]; - - out[o] = 0; - *rd = i; - return out; -} - -static char * fb_to_db_full(void *ctx,const glite_jp_attrval_t *attr) -{ - - int vsize = attr->binary ? attr->size * 4/3 + 6 : strlen(attr->value)+1, - len; - - /* 4x: + \0 + ASUF + BS + %12d */ - char *db = malloc(19 + (attr->origin_detail ? 2*strlen(attr->origin_detail) : 0) + vsize); - - if (attr->origin < 0 || attr->origin > GLITE_JP_ATTR_ORIG_FILE) { - free(db); return NULL; - } - len = sprintf(db,"%c:%d:%c:",attr->binary ? 'B' : 'S', - attr->timestamp,orig_char[attr->origin]); - - if (attr->origin_detail) len += escape_colon(attr->origin_detail,db+len); - db[len++] = ':'; - - if (attr->binary) { - vsize = base64_encode(attr->value,attr->size,db+len,vsize-1); - if (vsize < 0) { free(db); return NULL; } - db[len+vsize] = 0; - } - else strcpy(db+len,attr->value); - - return db; -} - -static char * fb_to_db_index(void *ctx,const glite_jp_attrval_t *attr,int len) -{ - char *s; - -/* XXX: binary values not really handled. Though the formal semantics is not broken */ - if (attr->binary) return strdup("XXX"); - - s = strdup(attr->value); - if (len < strlen(s)) s[len] = 0; - return s; -} - -static int fb_from_db(void *ctx,const char *str,glite_jp_attrval_t *attr) -{ - int p = 2; - char *colon,*cp; - - if (str[0] != 'B' && str[0] != 'S') return EINVAL; - attr->binary = str[0] == 'B'; - cp = attr->value = strdup(str); - - colon = strchr(cp+p,':'); - if (!colon) return EINVAL; - - *colon++ = 0; - attr->timestamp = (time_t) atol(cp+p); - p = colon-cp; - - for (attr->origin = GLITE_JP_ATTR_ORIG_ANY; orig_char[attr->origin] && orig_char[attr->origin] != cp[p]; attr->origin++); - if (!orig_char[attr->origin]) return EINVAL; - - p += 2; - if (cp[p] == ':') attr->origin_detail = NULL; - else { - int r; - attr->origin_detail = unescape_colon(cp+p,&r); - p += r; - } - if (cp[p++] != ':') return EINVAL; - - if (attr->binary) { - attr->size = base64_decode(str+p,attr->value,strlen(str)); - if (attr->size < 0) return EINVAL; - } - else strcpy(attr->value,str+p); - - return 0; -} - -static const char * fb_type_full(void *ctx,const char *attr) -{ - return "mediumblob"; -} - -static const char * fb_type_index(void *ctx,const char *attr,int len) -{ - static char tbuf[100]; - sprintf(tbuf,"varchar(%d)",len); - return tbuf; -} - - - -static glite_jp_tplug_data_t fallback_plugin = { - "", - NULL, - fb_cmp, - fb_to_db_full, - fb_to_db_index, - fb_from_db, - fb_type_full, - fb_type_index, -}; - -static glite_jp_tplug_data_t *get_plugin(glite_jp_context_t ctx,const char *aname) -{ - void **cp = ctx->type_plugins; - char *colon,*ns; - - if (!cp) return &fallback_plugin; - glite_jp_clear_error(ctx); - ns = strdup(aname); - colon = strrchr(ns,':'); - if (colon) *colon = 0; else *ns = 0; - - while (*cp) { - glite_jp_tplug_data_t *p = *cp; - if (!strcmp(ns,p->namespace)) { - free(ns); - return p; - } - cp++; - } - free(ns); - return &fallback_plugin; /* XXX: is it always desirable? */ -} - -int glite_jp_attrval_cmp(glite_jp_context_t ctx,const glite_jp_attrval_t *a,const glite_jp_attrval_t *b,int *result) -{ - glite_jp_tplug_data_t *ap = get_plugin(ctx,a->name); - glite_jp_error_t err; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - glite_jp_clear_error(ctx); - - if (strcmp(a->name,b->name)) { - err.code = EINVAL; - err.desc = "Can't compare different attributes"; - return glite_jp_stack_error(ctx,&err); - } - - return ap->cmp ? ap->cmp(ap->pctx,a,b,result) : fb_cmp(ap->pctx,a,b,result); -} - -char *glite_jp_attrval_to_db_full(glite_jp_context_t ctx,const glite_jp_attrval_t *attr) -{ - glite_jp_tplug_data_t *ap = get_plugin(ctx,attr->name); - - glite_jp_clear_error(ctx); - return ap->to_db_full ? ap->to_db_full(ap->pctx,attr) : fb_to_db_full(ap->pctx,attr); -} - -char *glite_jp_attrval_to_db_index(glite_jp_context_t ctx,const glite_jp_attrval_t *attr,int len) -{ - glite_jp_tplug_data_t *ap = get_plugin(ctx,attr->name); - - glite_jp_clear_error(ctx); - return ap->to_db_index ? ap->to_db_index(ap->pctx,attr,len) : fb_to_db_index(ap->pctx,attr,len); -} - - -int glite_jp_attrval_from_db(glite_jp_context_t ctx,const char *str,glite_jp_attrval_t *attr) -{ - glite_jp_tplug_data_t *ap = get_plugin(ctx,attr->name); - - glite_jp_clear_error(ctx); - return ap->from_db ? ap->from_db(ap->pctx,str,attr) : fb_from_db(ap->pctx,str,attr); -} - -const char *glite_jp_attrval_db_type_full(glite_jp_context_t ctx,const char *attr) -{ - glite_jp_tplug_data_t *ap = get_plugin(ctx,attr); - - glite_jp_clear_error(ctx); - return ap->db_type_full ? ap->db_type_full(ap->pctx,attr) : fb_type_full(ap->pctx,attr); -} - -const char *glite_jp_attrval_db_type_index(glite_jp_context_t ctx,const char *attr,int len) -{ - glite_jp_tplug_data_t *ap = get_plugin(ctx,attr); - - glite_jp_clear_error(ctx); - return ap->db_type_index ? ap->db_type_index(ap->pctx,attr,len) : fb_type_index(ap->pctx,attr,len); -} - -/* XXX: UNIX time, should be ISO blahblah */ -time_t glite_jp_attr2time(const char *a) -{ - long t; - - sscanf(a,"%ld",&t); - return t; -} - -/* XXX: UNIX time, should be ISO blahblah */ -char * glite_jp_time2attr(time_t t) -{ - char *r; - - asprintf(&r,"%ld",(long) t); - return r; -} - diff --git a/org.glite.jp.common/src/context.c b/org.glite.jp.common/src/context.c deleted file mode 100644 index c30214e..0000000 --- a/org.glite.jp.common/src/context.c +++ /dev/null @@ -1,162 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include - -#include "types.h" -#include "context.h" - -int glite_jp_init_context(glite_jp_context_t *ctx) -{ - return (*ctx = calloc(1,sizeof **ctx)) != NULL; -} - -void glite_jp_free_context(glite_jp_context_t ctx) -{ - glite_jp_clear_error(ctx); - free(ctx); -} - -char *glite_jp_peer_name(glite_jp_context_t ctx) -{ - return strdup(ctx->peer ? ctx->peer : "unknown"); -} - -char *glite_jp_error_chain(glite_jp_context_t ctx) -{ - char *ret = NULL,indent[300] = ""; - int len = 0,add; - char buf[2000]; - - glite_jp_error_t *ep = ctx->error; - - do { - add = snprintf(buf,sizeof buf,"%s%s: %s (%s)\n", - indent, - ep->source, - strerror(ep->code), - ep->desc ? ep->desc : ""); - ret = realloc(ret,len + add + 1); - strncpy(ret + len,buf,add); ret[len += add] = 0; - strcat(indent," "); - } while ((ep = ep->reason)); - - return ret; -} - -int glite_jp_stack_error(glite_jp_context_t ctx, const glite_jp_error_t *err) -{ - glite_jp_error_t *reason = ctx->error; - - ctx->error = calloc(1,sizeof *ctx->error); - ctx->error->code = err->code; - ctx->error->desc = err->desc ? strdup(err->desc) : NULL; - ctx->error->source = err->source ? strdup(err->source) : NULL; - ctx->error->reason = reason; - - return err->code; -} - -int glite_jp_clear_error(glite_jp_context_t ctx) -{ - glite_jp_error_t *e = ctx->error, *r; - - while (e) { - r = e->reason; - free((char *) e->source); - free((char *) e->desc); - free(e); - e = r; - } - ctx->error = NULL; - return 0; -} - - -void glite_jp_free_query_rec(glite_jp_query_rec_t *q) -{ - free(q->attr); - free(q->value); - free(q->value2); - memset(q,0,sizeof *q); -} - -int glite_jp_queryrec_copy(glite_jp_query_rec_t *dst, const glite_jp_query_rec_t *src) -{ - memcpy(dst,src,sizeof *src); - if (src->attr) dst->attr = strdup(src->attr); - if (src->value) dst->value = strdup(src->value); - if (src->value2) dst->value2 = strdup(src->value2); - return 0; -} - -int glite_jp_run_deferred(glite_jp_context_t ctx) -{ - int i,cnt,ret; - - if (!ctx->deferred_func) return 0; - - glite_jp_clear_error(ctx); - for (cnt=0;ctx->deferred_func[cnt];cnt++); - for (i=0; ideferred_func)(ctx,*ctx->deferred_arg))) { - glite_jp_error_t err; - char desc[100]; - - sprintf(desc,"calling func #%d, %p",i,*ctx->deferred_func); - err.code = ret; - err.desc = desc; - err.source = "glite_jp_run_deferred()"; - - glite_jp_stack_error(ctx,&err); - return ret; - } - else { - memmove(ctx->deferred_func,ctx->deferred_func+1, - (cnt-i) * sizeof *ctx->deferred_func); - memmove(ctx->deferred_arg,ctx->deferred_arg+1, - (cnt-i) * sizeof *ctx->deferred_arg); - } - } - free(ctx->deferred_func); ctx->deferred_func = NULL; - free(ctx->deferred_arg); ctx->deferred_arg = NULL; - return 0; -} - -int glite_jp_add_deferred( - glite_jp_context_t ctx, - int (*func)(glite_jp_context_t, void *), - void *arg -) -{ - int (**v)(glite_jp_context_t, void *) = ctx->deferred_func; - int i; - - for (i=0; v && v[i]; i++); - - ctx->deferred_func = realloc(ctx->deferred_func, (i+2) * sizeof *ctx->deferred_func); - ctx->deferred_func[i] = func; - ctx->deferred_func[i+1] = NULL; - - ctx->deferred_arg = realloc(ctx->deferred_arg,(i+2) * sizeof *ctx->deferred_arg); - ctx->deferred_arg[i] = arg; - ctx->deferred_arg[i+1] = NULL; - - return 0; -} diff --git a/org.glite.jp.common/src/indexdb.c b/org.glite.jp.common/src/indexdb.c deleted file mode 100644 index 86f4e85..0000000 --- a/org.glite.jp.common/src/indexdb.c +++ /dev/null @@ -1,88 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ident "$Header:" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#define GLITE_JP_INDEX_COMPILE 1 - -#include "indexdb.h" - -char *glite_jp_indexdb_attr2id(const char *name) { - size_t i, len; - char *lname, *id; - - len = strlen(name); - lname = malloc(len + 1); - for (i = 0; i < len + 1; i++) lname[i] = tolower(name[i]); - id = str2md5(lname); - free(lname); - - return id; -} - - -int glite_jp_indexdb_attr2select_from_index(const char *name, int indexed __attribute__((unused)), char **column, char **full_value_column, char **table, char **where) { - char *id; - - if (column) *column = strdup("value"); - if (full_value_column) *full_value_column = strdup("full_value"); - if (table) { - id = glite_jp_indexdb_attr2id(name); - asprintf(table, GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "%s", id); - free(id); - } - if (where) *where = strdup(""); - - return 0; -} - - -int glite_jp_indexdb_attr2select_from_db(const char *name, glite_lbu_DBContext dbctx, char **column, char **full_value_column, char **table, char **where) { - char *sql, *id; - glite_lbu_Statement stmt; - int ret; - - if (table) { - trio_asprintf(&sql, "SELECT attrid FROM attrs WHERE name='%|Ss'", name); - ret = glite_lbu_ExecSQL(dbctx, sql, &stmt); - free(sql); - switch (ret) { - case -1: return glite_lbu_DBError(dbctx, NULL, NULL); - case 1: break; - default: return EINVAL; - } - if (glite_lbu_FetchRow(stmt, 1, NULL, &id) < 0) return glite_lbu_DBError(dbctx, NULL, NULL); - asprintf(table, GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "%s", id); - free(id); - glite_lbu_FreeStmt(&stmt); - } - if (column) *column = strdup("value"); - if (full_value_column) *full_value_column = strdup("full_value"); - if (where) *where = strdup(""); - - return 0; -} diff --git a/org.glite.jp.common/src/utils.c b/org.glite.jp.common/src/utils.c deleted file mode 100644 index d27d606..0000000 --- a/org.glite.jp.common/src/utils.c +++ /dev/null @@ -1,80 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glite/jobid/strmd5.h" -#include "types.h" -#include "context.h" -#include "known_attr.h" -#include "attr.h" - -/* -#include "feed.h" -#include "tags.h" -*/ - -#include "backend.h" - - -typedef struct _rl_buffer_t { - char *buf; - size_t pos, size; - off_t offset; -} rl_buffer_t; - -/* - * realloc the line to double size if needed - * - * \return 0 if failed, did nothing - * \return 1 if success - */ -int check_realloc_line(char **line, size_t *maxlen, size_t len) { - void *tmp; - - if (len > *maxlen) { - *maxlen <<= 1; - tmp = realloc(*line, *maxlen); - if (!tmp) return 0; - *line = tmp; - } - - return 1; -} - - -char* glite_jpps_get_namespace(const char* attr){ - char* namespace = strdup(attr); - char* colon = strrchr(namespace, ':'); - if (colon) - namespace[strrchr(namespace, ':') - namespace] = 0; - else - namespace[0] = 0; - return namespace; -} - diff --git a/org.glite.jp.common/test/type_test.cpp b/org.glite.jp.common/test/type_test.cpp deleted file mode 100644 index 532fc95..0000000 --- a/org.glite.jp.common/test/type_test.cpp +++ /dev/null @@ -1,217 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "types.h" -#include "attr.h" -#include "context.h" -#include "backend.h" - - -class TypePluginTest: public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(TypePluginTest); - CPPUNIT_TEST(simple); - CPPUNIT_TEST(binary); - CPPUNIT_TEST(origin); - CPPUNIT_TEST(origin2); - CPPUNIT_TEST(index); - CPPUNIT_TEST_SUITE_END(); -public: - void simple(); - void binary(); - void origin(); - void origin2(); - void index(); -}; - -void TypePluginTest::simple() -{ - glite_jp_context_t ctx; - - glite_jp_attrval_t attr = { - "myattr", - "short string", - 0,0, - GLITE_JP_ATTR_ORIG_USER, - NULL, - 0 - },attr2; - - char *db; - - glite_jp_init_context(&ctx); - attr.timestamp = time(NULL); - - db = glite_jp_attrval_to_db_full(ctx,&attr); - - CPPUNIT_ASSERT_MESSAGE(std::string("glite_jp_attrval_to_db_full()"),db); - std::cerr << db << std::endl; - - glite_jp_attrval_from_db(ctx,db,&attr2); - CPPUNIT_ASSERT_MESSAGE(std::string("value"),!strcmp(attr.value,attr2.value)); - CPPUNIT_ASSERT_MESSAGE(std::string("origin"),attr.origin == attr2.origin); - CPPUNIT_ASSERT_MESSAGE(std::string("timestamp"),attr.timestamp == attr2.timestamp); -} - -void TypePluginTest::binary() -{ - glite_jp_context_t ctx; - - glite_jp_attrval_t attr = { - "myattr", - NULL, - 1,1000, - GLITE_JP_ATTR_ORIG_USER, - NULL, - 0 - },attr2; - - char *db; - - glite_jp_init_context(&ctx); - attr.timestamp = time(NULL); - attr.value = (char *) malloc(attr.size); - - db = glite_jp_attrval_to_db_full(ctx,&attr); - - CPPUNIT_ASSERT_MESSAGE(std::string("glite_jp_attrval_to_db_full()"),db); - std::cerr << db << std::endl; - - glite_jp_attrval_from_db(ctx,db,&attr2); - CPPUNIT_ASSERT_MESSAGE(std::string("size"),attr.size == attr2.size); - CPPUNIT_ASSERT_MESSAGE(std::string("value"),!memcmp(attr.value,attr2.value,attr.size)); -} - -void TypePluginTest::origin() -{ - glite_jp_context_t ctx; - - glite_jp_attrval_t attr = { - "myattr", - NULL, - 0,0, - GLITE_JP_ATTR_ORIG_USER, - NULL, - 0 - },attr2; - - char *db; - - glite_jp_init_context(&ctx); - attr.timestamp = time(NULL); - attr.value = "origin test"; - attr.origin_detail = "simple origin"; - - db = glite_jp_attrval_to_db_full(ctx,&attr); - - CPPUNIT_ASSERT_MESSAGE(std::string("glite_jp_attrval_to_db_full()"),db); - std::cerr << db << std::endl; - - glite_jp_attrval_from_db(ctx,db,&attr2); - CPPUNIT_ASSERT_MESSAGE(std::string("origin detail"),!strcmp(attr.origin_detail,attr2.origin_detail)); -} - -void TypePluginTest::origin2() -{ - glite_jp_context_t ctx; - - glite_jp_attrval_t attr = { - "myattr", - NULL, - 0,0, - GLITE_JP_ATTR_ORIG_USER, - NULL, - 0 - },attr2; - - char *db; - - glite_jp_init_context(&ctx); - attr.timestamp = time(NULL); - attr.value = "origin:test"; - attr.origin_detail = "ftp://some.server:1234/ugly \\file"; - - db = glite_jp_attrval_to_db_full(ctx,&attr); - - CPPUNIT_ASSERT_MESSAGE(std::string("glite_jp_attrval_to_db_full()"),db); - std::cerr << db << std::endl; - - glite_jp_attrval_from_db(ctx,db,&attr2); - CPPUNIT_ASSERT_MESSAGE(std::string("origin detail"),!strcmp(attr.origin_detail,attr2.origin_detail)); - CPPUNIT_ASSERT_MESSAGE(std::string("value"),!strcmp(attr.value,attr2.value)); -} - -void TypePluginTest::index() -{ - /* TODO: check monotonity */ -} - -CPPUNIT_TEST_SUITE_REGISTRATION(TypePluginTest); - - -int main (int argc,const char *argv[]) -{ - CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); - - assert(argc == 2); - std::ofstream xml(argv[1]); - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - CppUnit::TestRunner runner; - runner.addTest(suite); - runner.run(controller); - - CppUnit::XmlOutputter xout( &result, xml ); - CppUnit::CompilerOutputter tout( &result, std::cout); - xout.write(); - tout.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} - - - - -/* fake to link */ -int glite_jppsbe_pread( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset, - ssize_t *nbytes_ret -) -{ - abort(); -} - - diff --git a/org.glite.jp.doc/LICENSE b/org.glite.jp.doc/LICENSE deleted file mode 100644 index 259a91f..0000000 --- a/org.glite.jp.doc/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.jp.doc/Makefile b/org.glite.jp.doc/Makefile deleted file mode 100644 index d15495a..0000000 --- a/org.glite.jp.doc/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# Default values -top_srcdir=. -stagedir=. -globalprefix=glite -lbprefix=lb -package=glite-jp-doc -version=0.0.0 -PREFIX=/opt/glite - --include Makefile.inc - -VPATH = ${top_srcdir}/src -KPATH = TEXINPUTS=".:$(VPATH)//:" -KPATHBIB = BIBINPUTS=".:$(VPATH)//:" - -LATEX = $(KPATH) latex -PDFLATEX = $(KPATH) pdflatex -BIBTEX = $(KPATHBIB) bibtex -DVIPS = $(KPATH) dvips -AT3=${stagedir}/sbin/glite-lb-at3 -INSTALL=install - -default all: generate JPUG.pdf JPAG.pdf JPDG.pdf - -generate: - -# %.dvi: %.tex -# $(LATEX) $< -# $(BIBTEX) `basename $< .tex` -# $(LATEX) $< -# $(LATEX) $< -# -# %.ps: %.dvi -# $(DVIPS) -ta4 -o $@ $< - -%.pdf: %.tex - $(PDFLATEX) $< - $(BIBTEX) `basename $< .tex` - $(PDFLATEX) $< - $(PDFLATEX) $< - -%.tex: %.tex.T - rm -f $@ - ${AT3} $< >$@ || rm -f $@ - chmod -w $@ >/dev/null - -install: - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - $(INSTALL) -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - $(INSTALL) -m 644 ${top_srcdir}/src/README ${PREFIX}/share/doc/${package}-${version} - $(INSTALL) -m 644 JPUG.pdf ${PREFIX}/share/doc/${package}-${version} - $(INSTALL) -m 644 JPAG.pdf ${PREFIX}/share/doc/${package}-${version} - $(INSTALL) -m 644 JPDG.pdf ${PREFIX}/share/doc/${package}-${version} - -clean: - rm -rvf JPUG* JPAG* JPDG* - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ - - -# dependencies: - -JPUG.pdf: JPUG.tex \ - JPUG-Introduction.tex \ - JPUG-Tools.tex glite-jpis-client.tex jpimporter.tex gui.tex \ - JPUG-UseCases.tex - -JPAG.pdf: JPAG.tex \ - JPAG-Introduction.tex LB-JP-interaction.tex \ - JPAG-Installation.tex \ - JPAG-Configuration.tex \ - JPAG-Running.tex \ - JPAG-Testing.tex \ - JPAG-Troubleshooting.tex - -JPDG.pdf: JPDG.tex \ - JPDG-Introduction.tex \ - JPDG-WS.tex - -.PHONY: all clean diff --git a/org.glite.jp.doc/configure b/org.glite.jp.doc/configure deleted file mode 100755 index 0bf1a3f..0000000 --- a/org.glite.jp.doc/configure +++ /dev/null @@ -1,701 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp.doc/project/ChangeLog b/org.glite.jp.doc/project/ChangeLog deleted file mode 100644 index 0b26ff7..0000000 --- a/org.glite.jp.doc/project/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -1.0.0-1 -- Initial version - -1.0.0-2 -- configure updated - diff --git a/org.glite.jp.doc/project/version.properties b/org.glite.jp.doc/project/version.properties deleted file mode 100644 index b7186ff..0000000 --- a/org.glite.jp.doc/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# $Header$ -module.version=1.0.0 -module.age=2 diff --git a/org.glite.jp.doc/src/JPAG-Configuration.tex b/org.glite.jp.doc/src/JPAG-Configuration.tex deleted file mode 100644 index 9e5759f..0000000 --- a/org.glite.jp.doc/src/JPAG-Configuration.tex +++ /dev/null @@ -1,36 +0,0 @@ -\section{Configuration} -\TODO{} - -\subsection{JPPS} -\subsubsection{Setting up the MySQL database} - - -\subsection{JPIS} - -\begin{alltt} -The JP-IS server daemon assume prior creation of its database. Simple tool - for database creation is org.glite.jp.index/config/dbsetup.sh - -customize startup script /etc/init.d/glite-jp-indexd (see below) - and set up service startup using this script - - -Currently, configuration is done by command line options, and -some hard-coded options. - - -The index server takes the following options: - -./glite-jp-indexd [option] - -d, --debug don't run as daemon, additional diagnostics - -q, --query-type hist/cont/both (default history) - -n, --noauth don't check user identity with result owner - -m, --mysql database connect string - -p, --port port to listen - -i, --pidfile file to store master pid - -o, --logfile file to store logs - -x, --config file with server configuration - -The config file parameter is required. There is the example configuration in -$GLITE_LOCATION/etc/glite-jpis-config.xml. -\end{alltt} diff --git a/org.glite.jp.doc/src/JPAG-Installation.tex b/org.glite.jp.doc/src/JPAG-Installation.tex deleted file mode 100644 index ff638c3..0000000 --- a/org.glite.jp.doc/src/JPAG-Installation.tex +++ /dev/null @@ -1,9 +0,0 @@ -\section{Installation} -\TODO{Import the content of \texttt{glite\_installation\_guide\_\[LB\|JP\].doc}.} - -\subsection{Complete RPMs description} - -\subsection{Daemons description} - -\subsection{CLI tools description} -% admin (sbin) tools diff --git a/org.glite.jp.doc/src/JPAG-Introduction.tex b/org.glite.jp.doc/src/JPAG-Introduction.tex deleted file mode 100644 index bb356c9..0000000 --- a/org.glite.jp.doc/src/JPAG-Introduction.tex +++ /dev/null @@ -1,75 +0,0 @@ -\section{Introduction} -\TODO{Do a reasonable merge with the JPUG-Introduction, do not duplicate text...} - - -\subsection{Job Provenance service overview} -The information about jobs submitted to gLite Workload Management -System is collected by the Logging and Bookkeeping (LB) service. -LB tracks jobs in terms of events and processes them in -a~real time to give overall view on the actual job state. The user may -query the bookkeeping server to obtain either the raw events or the -computed job state, she may also register for receiving notifications -on particular job state changes. - -While the LB is intended to keep track of jobs during its lifetime, it -is not supposed to be used for long term archival of such data. The -Job Provenance (JP) service is designed to provide long-term storage -of all data related to job life and allow the end user to perform -data-mining in this data. -The JP is supposed to provide the permanent storage of -the job related information as stored within the \LB, to couple it with -the input sandboxes and other system oriented information necessary to -reproduce the environment where a~particular job run. - -\subsubsection{Gathering data into Job Provenance} -Fig.~\ref{fig:psinter} depicts basic gLite middleware components and -their interaction with the Job Provenance. - -\begin{figure}[htpb] - \centering - \includegraphics[scale=0.7]{JP-interactions} - \caption{Data flow into gLite Job Provenance} - \label{fig:psinter} -\end{figure} - -JP is formed of two classes of services: permanent \emph{Primary -Storage} (JPPS) accepts and stores job data while possibly volatile -and configurable \emph{Index Servers} (JPIS) provide an optimized -querying and data-mining interface to the end-users. The only direct -data retrieval scenario supported by JPPS is the case when user know exact ID -of jobs in the interest. - -\subsubsection{Getting data from Job Provenance} - -The role of \emph{Index Servers} (JPIS) is processing and re-arranging the data -from Primary Storage(s) into a~form suitable for frequent and complex user -queries. A user query part of JP is shown in Fig.~\ref{fig:query}. - -\begin{figure}[htpb] - \centering - \includegraphics[scale=0.8]{JP-query} - \caption{Index Server interactions} - \label{fig:query} -\end{figure} - -Index Servers are created, configured, and populated semi-dynamically -according to particular user community needs. It is responsibility of -its administrator to setup the JPIS with appropriate configuration. There -is no prescribed relationship between Primary Storage and Index Server -installations. An Index Server may retrieve data from multiple -Primary Storages and vice versa. - -% TODO: update -% The interface exposed by JPIS to the end user is described in the -% chapter~\ref{reference}. Command line interface tool for end-user -% interface to the JPIS is described in the chapter~\ref{CLI}. See the -% next chapter (use cases) for futher description of JP to user -% interactions. - - -% LB-JP-interaction -\input{LB-JP-interaction} - -% -\subsection{Deployment scenarios} - diff --git a/org.glite.jp.doc/src/JPAG-Running.tex b/org.glite.jp.doc/src/JPAG-Running.tex deleted file mode 100644 index 69fefc2..0000000 --- a/org.glite.jp.doc/src/JPAG-Running.tex +++ /dev/null @@ -1,33 +0,0 @@ -\section{Running and stopping the services} -\TODO{} - - -\subsection{JPPS} - - -\subsection{JPIS} - -\begin{alltt} -Preferred way of starting the daemon is using start-up script -(config/startup). It loads glite.conf file (personal version may be stored -in ~/.glite.conf) where many variables may be set to configure the daemon. -The script takes following variables: - -GLITE_JPIS_CONFIG - server config file specification - (default is $GLITE_LOCATION//etc/glite-jpis-config.xml) -GLITE_JPIS_DEBUG - setting to '-d' forces the daemon not to daemonize -GLITE_JPIS_QT - defines query type - 'hist' ... history query - 'cont' ... continuous query - 'both' ... combination of previous types -GLITE_JPIS_AUTH - setting to '-n' forces the daemon not to check - authorisation -GLITE_JPIS_PORT - used port (default 8902) -GLITE_JPIS_DB - database connection string - (default jpis/@localhost:jpis) -GLITE_JPIS_LOGFILE - log file - (default is $GLITE_LOCATION_VAR/log/glite-jp-indexd.log) -GLITE_JPIS_PIDFILE - pid file - (default is $GLITE_LOCATION_VAR/run/glite-jp-indexd.log) - -\end{alltt} diff --git a/org.glite.jp.doc/src/JPAG-Testing.tex b/org.glite.jp.doc/src/JPAG-Testing.tex deleted file mode 100644 index 1055b71..0000000 --- a/org.glite.jp.doc/src/JPAG-Testing.tex +++ /dev/null @@ -1,545 +0,0 @@ -\section{Testing JP functionality} -% AKA Testplan - -\def\req{\noindent\textbf{Prerequisities: }} -\def\how{\noindent\textbf{How to run: }} -\def\result{\noindent\textbf{Expected result: }} -\def\jpps{\noindent\textbf{JP PS log should contain: }} -\def\jpis{\noindent\textbf{JP IS log should contain: }} - - -\subsection{JPPS standalone tests} - -\subsubsection{Job registration} - -\paragraph{Basic functionality} -\label{regjob} -\req\ Running JPPS - -\how -\begin{itemize} -\item call RegisterJob operation: -\begin{verbatim} -$ jpps-test RegisterJob JOBID OWNER -\end{verbatim} -where JOBID and OWNER should be replaced with real values, JOBID should not have -been registered with JP before. - -\item call GetJobAttributes to verify: -\begin{verbatim} -$ jpps-test GetJobAttr JOBID http://egee.cesnet.cz/en/Schema/JP/System:owner -\end{verbatim} -\end{itemize} -\result Should print the OWNER value supplied. - -\paragraph{AuthZ check} -\req\ JPPS running, a~job registered with the procedure in~\ref{regjob} - -\how\ -Call GetJobAttributes using different user credentials - -\result\ -Should fail with ``Permission denied'' error - -\subsubsection{Tag recording} -\label{tagreg} - -\paragraph{Basic functionality} -\req\ -JPPS running, a~job registered with the procedure in~\ref{regjob} - -\how -\begin{itemize} -\item Call RecordTag operation: -\begin{verbatim} -$ jpps-test RecordTag JOBID TAGNAME STRINGVALUE -\end{verbatim} -\item Call GetJobAttributes to verify -\begin{verbatim} -$ jpps-test GetJobAttr JOBID TAGNAME -\end{verbatim} -\end{itemize} -\result -The recorded value should be returned. - -\how\ Record another values(s) of the same tag by repeating the RecordTag call - -\result\ GetJobAttr should return all the recorded values - - -\paragraph{AuthZ check} -\req\ JPPS running, a~job registered with the procedure in~\ref{tagreg} \\ -\how\ Call RecordTag using different user credentials \\ -\result\ Should fail with ``Permission denied'' error \\ - - -\subsubsection{File upload} - - -\paragraph{Basic functionality} -\req\ JPPS running, my certificate subject amont JPPS trusted peers, -\verb'globus-url-copy' in PATH - -\how -Run the aggregate test script from \verb'org.glite.jp.primary/build' - -\begin{verbatim} -$ ../examples/jpps_store_test -o 'OWNER' -d ../examples/job_template -\end{verbatim} -(substitute real cert.\ subject for OWNER) - -\result\ -The script calls JPPS operations RegisterJob and StartUpload, -uploads an \LB\ job log generated from the template file, -calls CommitUpload. - -Finally, the upload is checked by retrieving two attribute -values: LB/Attributes:user and LB/Attributes:finalStatusk via the GetJobAttr -call. -Both calls should return OK and print reasonable values. - -%- call StartUpload, LB dump file type -%* check with GetJobFiles -- shoud return nothing -%- upload via ftp -%- call CommitUpload -%* check with GetJobFiles -- should return URL -%- retrieve and check the file - -\paragraph{Phase checks} -\TODO{salvet} -% soubor nelze zapsat pred otevrenim operaci StartUpload -% nelze cist pred Commitem -% nelze zapsat po Commitu - -\paragraph{AuthZ checks} -(should fail) - -\TODO{salvet} -%* call GetJobFiles with different credentials -% -%* StartUpload with different credentials -% -%- StartUpload -%* ftp upload with different credentials -% -%* ftp GET with different credentials - - -\paragraph{Cleanup} -(Foreseen test for feature which is not implemented yet) -%- call StartUpload, short timeout -%- upload via ftp -%(don't call CommitUpload) -%* uploaded file should be purged after timeout - -\subsection{\LB\ plugin} -%\TODO{honik} -\LB\ plugin is a component integrating the \LB\ functionality into JP. - - -\subsubsection{Standalone tests} -\LB\ plugin as a standalone component is used for example in the \texttt{glite-lb-statistics} -program (part of org.glite.lb.utils). This program reads a dump file of events related to -one particular job and using the \LB\ plugin it computes the job state and many other job -statistics. See the \LB\ testplan for more details. - -\subsubsection{Integrated tests} -\req JPPS running with the \texttt{-P/path/to/the/glite\_lb\_plugin.so} - -\how -\begin{itemize} -\item call GetJobAttributes to get the LB attributes -\begin{verbatim} -$ jpps-test GetJobAttr JOBID ATTRIBUTE - -where ATTRIBUTE is one of the -http://egee.cesnet.cz/en/Schema/LB/Attributes:jobId -http://egee.cesnet.cz/en/Schema/LB/Attributes:user -http://egee.cesnet.cz/en/Schema/LB/Attributes:VO -http://egee.cesnet.cz/en/Schema/LB/Attributes:eNodes -http://egee.cesnet.cz/en/Schema/LB/Attributes:eProc -http://egee.cesnet.cz/en/Schema/LB/Attributes:RB -http://egee.cesnet.cz/en/Schema/LB/Attributes:CE -http://egee.cesnet.cz/en/Schema/LB/Attributes:host -http://egee.cesnet.cz/en/Schema/LB/Attributes:UIHost -http://egee.cesnet.cz/en/Schema/LB/Attributes:CPUTime -http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus -http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDate -http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusReason -http://egee.cesnet.cz/en/Schema/LB/Attributes:LRMSDoneStatus -http://egee.cesnet.cz/en/Schema/LB/Attributes:LRMSStatusReason -http://egee.cesnet.cz/en/Schema/LB/Attributes:retryCount -http://egee.cesnet.cz/en/Schema/LB/Attributes:additionalReason -http://egee.cesnet.cz/en/Schema/LB/Attributes:jobType -http://egee.cesnet.cz/en/Schema/LB/Attributes:nsubjobs -http://egee.cesnet.cz/en/Schema/LB/Attributes:lastStatusHistory -http://egee.cesnet.cz/en/Schema/LB/Attributes:fullStatusHistory -\end{verbatim} -\end{itemize} - -\result Should print the corresponding LB attributes - -\subsection{JPPS-JPIS interaction (feeds)} - - -%set of queries (how many?) with different "triggering conditions": -%- on job registration -%- on LB file upload -%- on RecordTag - -%corresponding sets of jobs to each query, each containing jobs which match -%and which don't - -%- initial IS release -- single query, so just one set of jobs -%- due to 3.2 no point in pre-loading PS database, use 1.3.1 - -\subsubsection{Batch feed} -%- upload jobs to PS -%- start feed -%* check IS contents (jobs and expected attr values) - -\req\ Clean JP-PS and JP-IS database. - -\how\ -\begin{enumerate} - \item \emph{Start JP primary server} - \item \emph{Register job to PS} - \begin{alltt} - for j in `seq 1 10`; - do - for i in glite-jp-primary-sample_job*.lb; - do - ./glite-jp-primary-store-test -o \emph{CERT_DN} - -t "my_tag=car" -s https://localhost:8901 -d $i; - done; - done - \end{alltt} - You should see something like: - \begin{alltt} - ** ./glite-jp-primary-test -s https://localhost:8901 RegisterJob - https://nonexistent.test.server/jpps_store_test_7199 - /O=CESNET/O=Masaryk University/CN=Milos Mulac - OK - ** ./glite-jp-primary-test -s https://localhost:8901 GetJobAttr - https://nonexistent.test.server/jpps_store_test_7199 - http://egee.cesnet.cz/en/Schema/JP/System:owner - OK - Attribute values: /O=CESNET/O=Masaryk University/CN=Milos Mulac - SYSTEM Thu Feb 16 14:40:02 2006 - .... - Attribute values: - car FILE Thu Feb 16 14:40:02 2006 - \end{alltt} - \item \emph{Start JP index server, using history query}\\ - \item \emph{Check content of IS database}\\ - \begin{alltt} - mysql -u jpis -e "select * from jobs;" jpis - \end{alltt} - You should get 50 results, similar to: - \begin{alltt} -| jobid | dg_jobid -| ownerid | aclid | ps -+----------------------------------+---------------------------------+ -| 7bd73b18b33410ba605fba99dbdd803f | https://nonexistent.test.server/jpps_store_test_5993 -| 5864429d57da18e4ecf9ea366c6b2c9c | NULL | https://localhost:18950 | -... -50 rows in set (0.00 sec) - \end{alltt} -\end{enumerate} -\result{} Expected results in the IS database content check (last step). - - -\subsubsection{Incremental feed - simple tests} -%- register feed -%- upload job to PS -%* check PS and IS output - -\req\ Clean JP-PS and JP-IS database. - -\how\ -\begin{enumerate} - \item \emph{Start JP primary server} - \item \emph{Start JP index server, using continuous query} - \item \emph{Registerjob} - \begin{alltt} - ./jpps-test -s https://localhost:18950 RegisterJob - https://nonexistent.test.server/jpps_store_test_6880 "/O=CESNET/O=Masaryk - University/CN=Milos Mulac" - OK - \end{alltt} - \jpps\ - \begin{alltt} - [22004] client DN: /O=CESNET/O=Masaryk University/CN=Milos Mulac - __jpsrv__RegisterJob https://nonexistent.test.server/jpps_store_test_6881 - /O=CESNET/O=Masaryk University/CN=Milos Mulac - feed to https://scientific.civ.zcu.cz:8902, job https://nonexistent.test.server/ - jpps_store_test_6881 - \end{alltt} - \jpis\ - \begin{alltt} - ... - [21984] incoming request - __jpsrv__UpdateJobs - ... - glite_jpis_lazyInsertJob: owner '/O=CESNET/O=Masaryk University/CN=Milos Mulac' - found - glite_jpis_insertAttrVal: (http://egee.cesnet.cz/en/Schema/JP/System:owner) - sql=INSERT INTO attr_52942b8c70bab8491ab5d3b9713d79f5 (jobid, value, full_value, - origin) VALUES ( - '6e436919404778b75cd27eef266190bb', - 'S:/O=CESNET/O=Masaryk University/CN=Milos Mulac', - 'S:/O=CESNET/O=Masaryk University/CN=Milos Mulac', - '1' -) - glite_jpis_insertAttrVal: (http://egee.cesnet.cz/en/Schema/JP/System:regtime) ... - ... - \end{alltt} - - \item \emph{Start upload} - \begin{alltt} - ./jpps-test -s https://localhost:18950 StartUpload - https://nonexistent.test.server/jpps_store_test_6880 - urn:org.glite.jp.primary:lb 1234 text/plain - OK - Destination: gsiftp://scientific.civ.zcu.cz:8960//home/mulac/jp/internal/ - data/5864429d57da18e4ecf9ea366c6b2c9c/1889/jpps_store_test_6880/lb - Commit before: Sat Mar 17 10:12:48 2007 - \end{alltt} - \jpps\ - \begin{alltt} - [22004] client DN: /O=CESNET/O=Masaryk University/CN=Milos Mulac - data_basename: (null) - \end{alltt} - \jpis\ - nothing - \item \emph{globus-url-copy} - \begin{alltt} - globus-url-copy file:/home/mulac/src/ORG/org.glite.jp.primary/build/job.6880 - gsiftp://scientific.civ.zcu.cz:8960//home/mulac/jp/internal/ - data/5864429d57da18e4ecf9ea366c6b2c9c/1889/jpps_store_test_6880/lb - \end{alltt} - \jpps\ - nothing \\ - \jpis\ - nothing \\ - \noindent\textbf{Other:} - File specified in gsiftp URL should be created. - \item \emph{Commit upload} - \begin{alltt} - ./jpps-test -s https://localhost:18950 CommitUpload - gsiftp://scientific.civ.zcu.cz:8960//home/mulac/jp/internal/data/ - 5864429d57da18e4ecf9ea366c6b2c9c/1889/jpps_store_test_6880/lb - OK - \end{alltt} - \jpps\ - \begin{alltt} - [22004] client DN: /O=CESNET/O=Masaryk University/CN=Milos Mulac - glite_jpps_match_file: https://nonexistent.test.server/jpps_store_test_6880 lb (null) - lb_plugin: opened 8 events - lb_plugin: close OK - feed to https://scientific.civ.zcu.cz:8902, job https://nonexistent.test.server/ - jpps_store_test_6880 - \end{alltt} - \jpis\ - \begin{alltt} - ... - __jpsrv__UpdateJobs - ... - glite_jpis_insertAttrVal: (http://egee.cesnet.cz/en/Schema/LB/Attributes:CE) - sql=INSERT INTO attr_c47f78255056386d2b3da6d506d1f244 (jobid, value, - full_value, origin) VALUES ( - '39a0a14f4fc084fbb466728986e5ea2f', - 'S:destination CE/queue', - 'S:destination CE/queue', - '3' - ) - ... - \end{alltt} - \end{enumerate} - -\result{} Expected results in logs. - - -\subsubsection{Incremental feed} -%- register feed -%- upload jobs to PS one by one -%* check IS contents (matching jobs should turn up, others not) - -\req\ Clean JP-PS and JP-IS database. - -\how\ -\begin{enumerate} - \item \emph{Start JP primary server} - \item \emph{Start JP index server, using continuous query} - \item \emph{Register job to PS} - The same as in previous test case. - - \item \emph{Check output of IS}\\ - You should see incomming connection logs, and among them - several times something like: - \begin{alltt} - - INSERT INTO attr_52942b8c70bab8491ab5d3b9713d79f5 (jobid, value, - full_value, origin) VALUES ( - '6f4866f3e4f8204c269449e6924d73c0', - 'S:/O=CESNET/O=Masaryk University/CN=Milos Mulac', - 'S:/O=CESNET/O=Masaryk University/CN=Milos Mulac', - '1') - .... - \end{alltt} - \item \emph{Check content of IS database}\\ - Do the same test as in previous test case. It must give you the same - result. You can also look whether the insert from previous step was - successful: - \begin{alltt} - mysql -u jpis -e "select * from - attr_52942b8c70bab8491ab5d3b9713d79f5;" jpis - \end{alltt} - should return: - \begin{alltt} -| jobid | value -| full_value | origin | -+----------------------------------+-----------------------------------+ -| 76698aabbf5d60dfa5b42c279e1f0e8c | S:/O=CESNET/O=Masaryk University/CN=Milos -Mulac -| S:/O=CESNET/O=Masaryk University/CN=Milos Mulac | 1 | - \end{alltt} -\end{enumerate} -\result{} Expected database INSERTs in the JP-IS (last two steps). - -\subsubsection{Multiple feeds at time} -\TODO{TBD} - -\subsubsection{Advanced feed features (to be implemented)} -- remove (not implemented in PS yet) -- splitted info about one job (check that the PS doesn't duplicate - attribute values) - probably covered in 3.2 - - -\subsubsection{PS-IS AuthZ} -\TODO{Not implemented yet} - -\subsection{IS queries} - - -%TBD: insert job sets via JP-IS interaction or directly? -% - better to populate database directly, independent on previous chain -% -%All basic tests: -%- clear IS database -%- insert prepared job set -%- ask queries and check answers -%- clear database -% -%TBD: Is one job set enough? -% - better to have one complete set -% - -A majority of test from this chapter is automated by shell -script. The script is located in \texttt{org.glite.jp.index} module -under \texttt{example/query-tests} directory and called \texttt{run-test.sh}. -It is available as a part of JP index server RPM package. - -\begin{hints} -The testing shell script is highly configurable via -environmental varibles. Please, run the script (run-test.sh) with -'-?' option to get list of all variables and their meaning, if you are -not satisfied with default setting. -\end{hints} - -\subsubsection{Simple query} -This test starts new index server instance, creates testing DB -and populate it with prepared data sample. Then simple query is given -to server, answer is checked with supposed return output and -cleanup is done. - - -\how\ Run \texttt{run-test.sh} - -\begin{hints} -The query is in file test/simple\_query.in and has following - form: (status=Ready) -\end{hints} - -\subsubsection{Complex query test} -This is similar to simple query test, only tested query is more complicated. - -\how\ Run \texttt{run-test.sh} - -\begin{hints} -The query is in file test/complex\_query.in and has followhing - form: (status=Done OR status=READY) AND (user!=God) -\end{hints} - -\subsubsection{Feed \& query test} -This test starts testing index server, feeds it by -mimicing bahaviour of primary storage server by sending data -via soap call, and then asks the index server using a complex -query. After that it checks the responce and does cleanup. - -More precise description of steps: -\begin{enumerate} - \item Simulation of response from a primary storage, making appropriate - changes in JP-IS database (inserts feedid). - \item Invocation of updateJobs wsdl call, normally invoked by JP-PS, and - sending this way some data to the JP-IS which stores them in its database. - \item Invocation of queryJobs wsdl call, normally called by user - program, obtaining previously inserted data. Test query used here has form - (status=Done OR status=Ready) AND (user!=God). -\end{enumerate} - -\how\ Run \texttt{run-test.sh} - -\subsubsection{AuthZ checks} -This test verifies that qeury responses are properly restricted by -authorization checks. Currently only implicit ACLs are implemented -inside JP-IS server, so explicit ACLs and its evaluation is to be implemented. - -There are 3 scenarios to be verified: -\begin{itemize} - \item Authorization (checking ownership) is swithed off (IS with -n - option). This scenario is tested by simple query test described above. - \item Only user jobs are returned and jobs not owned by the user posing - the query are not covered by the query response. This scenario is - covered by Feed \& query test described above. - \item Check that queries to jobs not owned by the IS user are - returning empty response. The same behaviour as simple query test - described above but with user credential not matching job - owner. This test is implemented by \texttt{run-test.sh} under AuthZ - check part. -\end{itemize} - -\subsubsection{Another supposed tests not implemented yet} - -\begin{itemize} - \item Check "origin" behaviour -- queries with origin tag - \item IS CLI tests -- use prepared config files and command line parameters - and check expected QueryJobs contents -\end{itemize} - - -\subsection{IS standalone advanced features} -\TODO{Not implemented yet} - -\subsubsection{Server startup} - -\paragraph{Reboot persistency / configuration vs. database content} - situations handling -- prepared config files -- checking behaviour (how?) after reboot with different config file - -\paragraph{Registration of PS feeds} -! already covered by 3 -- prepared config files -- checking appropriate FeedIndex calls - -\subsubsection{Admin interface} -\TODO{Admin interface not implemented yet} - -\subsubsection{Type plugin} -\TODO{type plugin tests -- to be designed, future type plugin implementation} - -\subsection{Deployment} -\TODO{tests on JP deployment process} -\TODO{TBD} - diff --git a/org.glite.jp.doc/src/JPAG-Troubleshooting.tex b/org.glite.jp.doc/src/JPAG-Troubleshooting.tex deleted file mode 100644 index c4397a4..0000000 --- a/org.glite.jp.doc/src/JPAG-Troubleshooting.tex +++ /dev/null @@ -1,6 +0,0 @@ -\section{Troubleshooting} -\TODO{} - -\subsection{Debugging} -\subsection{Fine tuning the performance} - diff --git a/org.glite.jp.doc/src/JPAG.tex b/org.glite.jp.doc/src/JPAG.tex deleted file mode 100644 index ba6d840..0000000 --- a/org.glite.jp.doc/src/JPAG.tex +++ /dev/null @@ -1,48 +0,0 @@ -\documentclass{egee} -%\usepackage{doxygen} - -\input{definitions} - -\title{Job Provenance} -\Subtitle{Administrator's Guide} -\author{CESNET EGEE II JRA1 team} -\DocIdentifier{EGEE-II....} -\Date{\today} -\Activity{JRA1: Middleware Engineering and Integration} -\DocStatus{DRAFT} -\Dissemination{PUBLIC} -\DocumentLink{http://...} - -\Abstract{ This administrator's guide explains how to administer the Job -Provenance (\JP) service. Several deployment scenarios are described together -with the installation, configuration, running and troubleshooting steps. } - -\begin{document} - -\input{frontmatter} -\newpage -\tableofcontents - -\newpage -\input{JPAG-Introduction} - -\newpage -\input{JPAG-Installation} - -\newpage -\input{JPAG-Configuration} - -\newpage -\input{JPAG-Running} - -\newpage -\input{JPAG-Testing} - -\newpage -\input{JPAG-Troubleshooting} - -\nocite{jgc} -\bibliographystyle{unsrt} -\bibliography{lbjp} - -\end{document} diff --git a/org.glite.jp.doc/src/JPDG-Introduction.tex b/org.glite.jp.doc/src/JPDG-Introduction.tex deleted file mode 100644 index a1edd45..0000000 --- a/org.glite.jp.doc/src/JPDG-Introduction.tex +++ /dev/null @@ -1,4 +0,0 @@ -\section{Introduction} - -\TODO{Best practices :)} - diff --git a/org.glite.jp.doc/src/JPDG-WS.tex b/org.glite.jp.doc/src/JPDG-WS.tex deleted file mode 100644 index 80d84cf..0000000 --- a/org.glite.jp.doc/src/JPDG-WS.tex +++ /dev/null @@ -1,34 +0,0 @@ -\section{Web Service Interface} - -In source code tree the WSDLs are located in these files:\\ -\texttt{org.glite.jp.ws-interface/src/JobProvenanceIS.xml,\\ -org.glite.jp.ws-interface/src/JobProvenancePS.xml,\\ -org.glite.jp.ws-interface/src/JobProvenanceTypes.xml -} - -\TODO{Add more info about the Web Service Interface...} - -% JPWS reference: -{ -\parindent0pt -\def\chapter#1{} -\def\section#1{\subsection{#1}} -\def\subsection#1{\par\medskip\textbf{#1}\par} - -\let\odesc=\description -\let\oedesc=\enddescription -\renewenvironment{description}{\odesc\itemindent=1em -\listparindent=2em -}{\oedesc} -%\renewenvironment{description}{\list{}{\labelwidth 5cm\leftmargin 5cm}} -%{\endlist} - -\let\null=\relax - -% this file was manually generated using db2latex (http://db2latex.sourceforge.net) -% from org.glite.jp.ws-interface/build/doc-html.xml -% TODO: generate it automatically here in Makefile - -\input{jpws} -} - diff --git a/org.glite.jp.doc/src/JPDG.tex b/org.glite.jp.doc/src/JPDG.tex deleted file mode 100644 index c591987..0000000 --- a/org.glite.jp.doc/src/JPDG.tex +++ /dev/null @@ -1,36 +0,0 @@ -\documentclass{egee} - -\input{definitions} - -\title{Job Provenance} -\Subtitle{Developer's Guide} -\author{CESNET EGEE II JRA1 team} -\DocIdentifier{EGEE-II....} -\Date{\today} -\Activity{JRA1: Middleware Engineering and Integration} -\DocStatus{DRAFT} -\Dissemination{PUBLIC} -\DocumentLink{http://...} - -\Abstract{This developer's guide explains how to use the Job Provenance (\JP) -service API, namely the Web Services Interface is described in details together with -programing examples. } - -\begin{document} - -\input{frontmatter} -\tableofcontents - -\newpage -\input{JPDG-Introduction} - -\newpage -\input{JPDG-WS} - -\newpage -\nocite{jgc} -\bibliographystyle{unsrt} -\bibliography{lbjp} - -\end{document} - diff --git a/org.glite.jp.doc/src/JPUG-Introduction.tex b/org.glite.jp.doc/src/JPUG-Introduction.tex deleted file mode 100644 index 36b8e6b..0000000 --- a/org.glite.jp.doc/src/JPUG-Introduction.tex +++ /dev/null @@ -1,693 +0,0 @@ -\section{Introduction} - -The Job Provenance (\JP) service is primarily designed to provide a permanent -storage and advanced querying interface to the data about Grid jobs and -the environment they were run in. This information is to be used for -statistical purposes, lookup for patterns in the Grid behavior and also -for job re-submission. - -The Job Provenance extends the data model specified by the \LB service -with additional information about each job---most specifically the input -and output data files---and also information about the run time -environment. - -The Job Provenance must fulfill rather contradictory requirements. It -must keep detailed information about each job, the environment the job -run in and the affected files, as possible. On the other hand, being a -permanent service, the job records must be kept reasonably small -to fit into reasonable sized storage system. Given the expected number of -jobs on large scale Grids---\eg the EGEE already -reports\footnote{\url{http://egee-jra2.web.cern.ch/EGEE-JRA2/QoS/JobsMetrics/JobMetrics.htm}} -20k jobs per day, that is 7.5M jobs per year, a number of jobs before the -large experiments will be deployed---the \JP must also support very -efficient searching and querying features. Another problem is associated -with the long life span of the \JP service. It must be expected that the -data formats will change over the time, while the \JP is expected to deal -with old and new data formats in a uniform way. They can be achieved via -extensibility of the JP data model. - -As the data collection serviced by the JP will extensively grow, it is -impossible to rely only on the primary data when navigating through it. -Users must be able to add annotations to individual job records and these -annotations serve two primary purposes---to help in organizing the \JP -data and to be a source of additional information, not provided directly -by the automated collection of primary data. Even annotations must follow -the WORM (write once read many times) semantics, as they are always added -on top of the already stored data, never re-writing the old annotations. -Work with the most recent set of annotations as well as ability to -inspect the history of annotations must be supported. - -Fig.~\ref{fig:psinter} depicts interaction between Job Provenance and -other Grid middleware components (on the example of the gLite -infrastructure). -\begin{figure}[ht] - \centering - \includegraphics[scale=0.5]{images/JP-interactions} - \caption{Data flow into gLite Job Provenance} - \label{fig:psinter} -\end{figure} - -\subsection{Concepts} -\ludek{\TODO{Obrazky moc nezapadaji do soucasne struktury textu :-(}} - -\subsubsection{Data gathering}% -\label{data} -%\begin{comment} -%\todo{job record, job attributes} \todo{open design, scalable} -%\todo{we have very small persistent record (jobid, owner, timescale), -% set of associated files and we maintain corresponding plugins (by what?) to -% interpret them; metadata are mined, indexed and provided on demand} -%\todo{attribute namespaces---a glue to source of metadata} -%\end{comment} - -The primary data organization in \JP is on a per job basis, a concept -taken from the \LB data organization. Every data item stored in JP is -associated to a~particular Grid job. As the overall storage capacity -requirements may become enormous, we store only volatile data which are -neither stored reliably elsewhere nor are reproducible by the job. -The data gathered from the gLite middleware fall into the following categories: -\begin{itemize} -\item job inputs, directly required for job re-running -\begin{itemize} -\item complete job description (JDL) as submitted to WMS -\item miscellaneous input files (gLite WMS input sandbox) provided by the user -(but job input files from remote storage \emph{are not} copied to JP) -\end{itemize} -\item job execution track, witnessing the environment of job execution -\begin{itemize} -\item complete \LB data, for example when and where the job was - planned and executed, how many times and for what reasons it was - resubmitted etc. -\item ``measurements'' on computing elements, \eg versions of installed -software, environment settings etc. -\end{itemize} -\end{itemize} -In addition, the service allows the user to add arbitrary annotations to -a~job in a form of ``name = value'' pairs. -These annotations can be recorded either during the job execution or at any time -afterward. -Besides providing information on the job (\eg it was a~production-phase -job of a particular experiment) these annotations may carry -information on relationships between the job and other entities -like external datasets, forming the desired data provenance record. - -%\TODO{zduraznit WORM semantiku + citace na IPAW} -Once a~piece of data is recorded for a~job, it can be never updated or -replaced. -New values can be recorded% -\footnote{It seems to make sense only for the annotations, not the -middleware data, and the current implementation makes this restriction. -However, it can be relaxed without principal impact.} -but the old values are always preserved. -Consequently the recorded history cannot be lost. - - -\subsubsection{Data representation}% -\label{attrib} - -The \JP concept distinguishes between two views on the processed data. -The data are stored in the \JP in the \emph{raw representation}. -Two input modes are assumed, depending mainly on the size -and structure of the data: -\begin{itemize} -\item Small size \emph{tags} in a form of ``name = value'' pairs, -enter the system via its primary interface (as a~web service operation -in the current implementation). -``Value'' is assumed to be a literal, without any structure that \JP should -be aware of. - -\item \emph{Bulk files}, \eg the complete dump of \LB data or the job input -sandbox, are uploaded via a~suitable transfer protocol% -\footnote{The current implementation supports \texttt{gsiftp://} only but -other protocols can be easily added.}. -Files are supposed to be structured. -However, they are stored ``as is'', and upon upload they are annotated with -format identification, including version of the format. -JP allows installing plugins that handle particular file formats (see bellow), -understanding the file structure and extracting required information. -\end{itemize} - -Most data manipulation is done using the \emph{logical view}. -Any piece of information stored in JP is represented -as a~value of a particular named \emph{attribute}. Tags (user -annotations) map to attributes in a~straightforward way, name and value -of the tags becoming name and value of an attribute. An uploaded file is -usually a~source of multiple attributes, which are automatically extracted -via \emph{plugins}. JP defines a~\emph{file-type plugin interface API}. The -task of the plugin is parsing a~particular file type and providing calls -to retrieve attribute values. - -To avoid naming conflicts even with future attributes, -an attribute name always falls into a~namespace. -Currently we declare three different namespaces: for JP system attributes -(\eg job owner or -registration time), attributes inherited from \LB, and unqualified user tags. - -\ludek{ -This representation unifies the user annotations, the ``system'' -middleware data and information extracted from uploaded files into -a~single view.} - -\iffalse -An attribute value must be always representable in the form of a~printable -string. -If it is not the case for a~native attribute type, -converting rules must be provided by a~plugin (dynamically loadable library) -implementing a~specified API. -\fi - -We keep the scheme symmetric, which means that none of the currently declared attribute -namespaces is privileged in any sense. -However, it may present a~vulnerability\Dash a~malicious user may try -to override a~\JP system attribute using the user annotation interface. -Therefore each attribute value carries a~further \emph{origin classification}: -currently \emph{system}, \emph{user} (recorded as tag), and -\emph{file} (found in an uploaded file). - -Finally, as JP does not support updating data intentionally -(see Sect~\ref{data}), multiple values of an attribute are allowed. -The order in which the values were recorded can be reconstructed from -timestamps attached to each value, getting the ``attribute update'' semantics -if it is required. - -Attributes, representing the logical view, is the only way to specify queries on JP. -However, once the user knows an~actual jobid, bulk files can be retrieved -in the raw form, too (assumed to be useful in the case of input sandboxes -reused for job re-execution). - -\subsubsection{Layered architecture}% -\label{layered} -\JP is formed of two classes of services: the permanent \emph{Primary Storage} -(JPPS) accepts and stores job data -while possibly volatile and configurable \emph{Index Servers} (JPIS) -provide an optimized querying and data-mining interface to the end-users. - -The expected large amount of stored data yields a requirement on -maximal compactness of the storage. -The raw data should be compressed, -and the set of metadata kept with each job must be minimal. -\JP defines a~set of \emph{primary attributes} which are maintained -by JPPS for each job. -Jobid is the only mandatory primary attribute, -other suggested ones are the job owner, submission time, -and the virtual organization. -All other attributes are retrieved from the raw data only when requested. - -The restricted set of primary attributes prohibits user queries to be served -by the JPPS directly (with the only exception of the known jobid). -Due to the expected low selectivity of primary attributes such queries -would result in processing large number of job records, overloading -the server when the queries became frequent. - -These contradictory requirements (compactness vs. performance) had to be -resolved at another component layer. -The main idea is preprocessing the huge \JP dataset with several queries, -each of them covering a~superset of one expected class of user queries -(\eg jobs of particular VO, submitted in certain period). -If these super-queries are chosen carefully, they retrieve only a~small -fraction of the primary data. Their results can thus be stored (or cached) -in a~richer form, including various indices, hence being suitable -for fast response to user queries. -Querying JPPS in this way and maintaining the cache of the query result -is the task of Index Servers in the \JP architecture. - -Relationship of JPPS and JPIS is a many-to-many---a~single JPIS can query -multiple JPPS's and vice versa, a~single JPPS is ready to feed multiple JPIS's. - -The query conditions restrict the dataset in terms of the matching job records. -Similarly, the query specifies a~set of attributes to retrieve, -reducing also considerably the amount of retrieved data per each matching job. - -Index Servers query JPPS in two modes: in \emph{batch mode} JPIS is populated -with all JPPS content matching the query. In this way JPIS can be created -from scratch, despite the ope-ration is rather heavy for JPPS. -On the other hand, the \emph{incremental mode} allows JPIS to subscribe with -JPPS to receive new matching records as well as updates to already stored -records whenever new data arrive to JPPS. -This mode allows existing JPIS to be kept up to date while it is -still lightweight for JPPS. - -Finally, the described layer of JPIS's needn't be the only one. -The architecture (despite not the current implementation) allows -building another layer of JPIS's with many-to-many relationship with -the previous layer instances, combining their data, providing support -for other specific user queries etc. - -\subsection{Prototype implementation} - -The \JP prototype implementation% -\footnote{a part of the gLite middleware 3.x} -follows the described architecture. - -\subsubsection{Primary Storage}% -\label{primary} -\iffalse -The JP \emph{Primary Storage} (JPPS) is a~permanent service responsible -for gathering the job data and their long-term archival. -The primary data are kept in as compact form as possible, and -only minimal metadata (jobid and owner, registration time) are maintained -and indexed. -\fi - -A~single instance of JPPS, shown in Fig.~\ref{fig:psinter}, -is formed by a~front-end, exposing -its operations via a~web-service interface% -\footnote{Described in detail in ``EGEE Middleware -Design'',\\ \url{https://edms.cern.ch/document/487871/}, -documented web service definitions can be found at \\ -\url{http://egee.cesnet.cz/en/WSDL/}}% -, and a~back-end, responsible -for actual data storage and providing the bulk file transfer interface. -The front-end metadata (the primary attributes for each job, -authorization information, and JPIS subscription data) -are stored in a~relational database (currently MySQL). - -The back-end uses Globus \texttt{gridftp} server enriched with authorization -callbacks accessing the same database to check whether a~user -is allowed to upload or retrieve a~given file. -Both the front- and back-ends share a~filesystem so that the file-type plugins -linked into the front-end access their files via POSIX~I/O. - -JPPS operations fall into the following categories: -\begin{itemize} -\item\emph{Job registration.} -Each job has to be explicitly registered with JP. -Currently the registration is done transparently by the \LB server -upon job submission (in parallel with the job registration in \LB, -though not blocking the job submission). - -\item\emph{Tag recording.} -Add user tags (annotations) in the ``name = value'' form to JP job records. - -\item\emph{Bulk file upload.} -File properties (type, optional name etc.) -are specified via the front-end interface, the upload itself goes -directly to the back-end (using \texttt{gridftp} transfer). - -\item\emph{Index Server feed} allows JPIS to ask for batch feed -as well as register for incremental updates. - -\item\emph{Data retrieval.} -The only direct data retrieval supported by JPPS is keyed by -the jobid. -Both individual attributes and the whole files can be retrieved. -\end{itemize} - -Primary Storage covers the first set of requirements specified -for a Job Provenance (see Sect.~\ref{jp:req}), \ie storing a~compact job -record, allowing the user to add annotations, and providing elementary -access to the data. - -\subsubsection{Index Server} -Index Servers are created, configured, and populated semi-dynamically -according to particular user community needs. -The configuration is formed by: -\begin{itemize} -\item one or more Primary Storages to contact, -\item conditions (expressed in terms of \JP attributes) -on jobs that should be retrieved, -\item list of attributes to be retrieved, -\item list of attributes to be indexed\Dash a~user query must refer -to at least one of these for performance reasons. -\end{itemize} -The set of attributes and the conditions specify the set of data that -is retrieved from JPPS, and they reflect the assumed pattern -of user queries. - -The current JPIS implementation keeps the data also in a~MySQL database. -Its schema is flexible, reflecting the server configuration -(columns are created to hold particular attribute value, as well as indices). - -The JPIS interface operations fall into the following categories: -\begin{itemize} -\item\emph{Responses to user queries.} -A~query specifies a~set of attributes to retrieve and -conditions determining the set of matching jobs. -The structure of the query language is identical to~\LB---% -it allows two-level nesting of comparisons of an attribute -with a~constant value. - -\item\emph{JPIS-JPPS communication} implements the data flow from JPPS to JPIS. - -\item\emph{Administrative} calls to change JPIS configuration -without interfering with its normal operation. -\end{itemize} - - -\iffalse % puvodni text, pouzity jen jako zdroj materialu v predchozim - -The role of \emph{Index Servers} (JPIS) is processing and re-arranging the data -from Primary Storage(s) into a~form suitable for frequent and complex user -queries. - -We can divide implemented operation into three categories: -\begin{description} -\item[Responses to user queries.] -The main purpose of JPIS is to enable user complex queries. - -\begin{itemize} -\item The \texttt{QueryJobs} operation enables to ask the user query and -specify which attributes of matched jobs are returned. -\end{itemize} - -\item[JPIS-JPPS communication.] Internal call enabling data exchange between. -JPIS and JPPS. -\begin{itemize} -\item The \texttt{UpdateJobs} Called by JPPS as a response to \texttt{FeedIndex} -request. Updates information on jobs in JPIS, according to what JPPS -currently knows. -\end{itemize} - -\item[Administration.] Admin calls for changing configuration on the fly. -\begin{itemize} -\item The \texttt{AddFeed} Called by JPIS admin tool to ask new primary storage server to feed it. Updates information on JPPS in index server, according to what JPPS currently knows. -\item The \texttt{GetFeedIDs} Called by JPIS admin tool to find out its open feeds. -\item The \texttt{DeleteFeed} Called by JPIS admin tool to remove one feed session. -\end{itemize} - -\end{description} - - -\subsubsection{Index Server} -\label{index} -%\begin{wrapfigure}{r}{.5\hsize} -\begin{figure} - \centering - \includegraphics[scale=0.5]{images/JP-query} - \caption{Index Server interactions} - \label{fig:query} -\end{figure} -%\end{wrapfigure} - - - -A~typical interaction is shown in Fig.~\ref{fig:query}.%\\[-8mm] - -\begin{enumerate} -\item The user queries one or more JPIS, receiving a~list of ID's -of matching jobs. -\item JPPS is directly queried for additional job attributes or URL's of -stored files. -\item The required files are retrieved. -\end{enumerate} - -The current format of the user query is a~list of lists of conditions. -A~condition is comparison (less, greater, equal) of an attribute -\wrt\ a~constant. Items of an~inner list must refer to the same attribute -and they are logically or-ed. -Finally the inner lists are logically and-ed. -According to our experience with the \LB\ service, -this query language is powerful enough to satisfy user needs -while simple enough to allow efficient implementation. - -Index Servers are created, configured, and populated semi-dynamically -according to particular user community needs. -The configuration is formed by: -\begin{itemize} -\item one or more Primary Storages to contact, -\item conditions on jobs that should be retrieved, -\item list of attributes to be retrieved, -\item list of attributes to be indexed\Dash a~user query must refer -to at least one of these for performance reasons. -\end{itemize} -The set of attributes and the conditions specify the set of data that -is retrieved from JPPS, and it reflects the assumed pattern -of user queries. -The amount of data fed into a~single JPIS instance is assumed to be -only a~fraction of data in JPPS, -both regarding the number of jobs, and the number of distinct attributes. - -Communication between JPIS and JPPS involves two -complementary web-service operations: -JPIS calls the \texttt{FeedIndex} operation of JPPS, -specifying the list of attributes and conditions. -Unlike the user queries, the query on JPPS is a~single and-ed list, -allowing less complex processing on JPPS where significantly larger -data set are involved. -JPPS responds by calling the \texttt{UpdateJobs} operation of JPIS -(repeatedly to split up large dataset). - -The following flags in the \texttt{FeedIndex} call specify the query mode: -\begin{itemize} -\item \emph{history}\Dash JPPS should process all its stored data, -giving the user the guaranty that if -her query is a~logical restriction of the JPIS configuration, -it returns a~complete result. -This type of query is usually necessary to populate JPIS but it imposes -rather high load on JPPS. -\item \emph{continuous}\Dash JPIS registers with JPPS for receiving -\emph{future updates} when data matching the query arrive. -This type of query allows JPIS to be kept up to date while imposing minimal -load on JPPS. -\end{itemize} - -The current JPIS implementation keeps the data also in a~MySQL database. -Its schema is flexible, reflecting the Server configuration -(columns are created to hold particular attribute value, as well as indices). -There is no prescribed relationship between Primary Storage and Index Server -installations. -An Index Server may retrieve data from multiple Primary Storages -and vice versa. - -\fi % konec materialu - -\subsubsection{Scalability and deployment} -Having evaluated a~random sample of \LB data on approx. 1000 jobs, -we claim that the usual size of a~complete \LB data dump varies -from 2\,kB to 100\,kB, with very rare exceptions (less than 1\,\%) -of sizes up to 5\,MB. -However, these plain text files contain repeating patterns and they can -be compressed with the ratio of 1:4--1:20 in the typical cases -and even higher for the large files. -Therefore the assumption of 10\,kB compressed \LB dump per job is a~fairly -safe upper limit. -Unfortunately, we were not able to do a~similar assessment for job sandbox -sizes. Expecting the sandboxes to contain only miscellaneous input files -we work with the hypothesis of 100\,kB--1\,MB sandbox size. - -The current statistics for the entire infrastructure of the EGEE project -report the rate of 20,000 jobs per day, while the middleware -performance challenges aim at one million jobs per day. - -\begin{table} -\begin{tabular}{r|c|c|c} -\textbf{job rate $\backslash$ size} & \textbf{10\,kB \LB} & \textbf{100\,kB sandbox} & \textbf{1\,MB sandbox} \\ -\hline -current 20\,k/day & 73\,GB/year & 730\,GB/year & 7.3\,TB/year \\ -challenge 1\,M/day & 3.6\,TB/year & (36\,TB/year) & (360\,TB/year) -\end{tabular} -\caption{Expected aggregate storage size (whole EGEE)} -\label{t:jpsize} -\end{table} - -\begin{table} -\begin{tabular}{r|c|c|c} -\textbf{job rate $\backslash$ size} & \textbf{10\,kB \LB} & \textbf{100\,kB sandbox} & \textbf{1\,MB sandbox} \\ -\hline -current 20\,k/day & 2.3\,kB/s & 23\,kB/s & 230\,kB/s \\ -challenge 1\,M/day & 115\,kB/s & (1.15\,MB/s) & (11.5\,MB/s) -\end{tabular} -\caption{Expected aggregate incoming data rate (whole EGEE)} -\label{t:jprate} -\end{table} - - -Tables~\ref{t:jpsize} and \ref{t:jprate} use the discussed numbers to derive -the per-year storage size and per-second incoming data rate requirements on Job -Provenance. -The sandbox numbers for the 1\,M job challenge are shown in parentheses -because of being rather hypothetical\Dash -in order to achieve the required job throughput at WMS side, -the jobs must be submitted in fairly large \emph{collections} -(chunks of approx. 100--10,000 individual jobs) that share a~single input -sandbox% -\footnote{This statement is based on informal discussions with WMS developers. -The targeted WMS instance throughput at the time of this manuscript preparation -was 1 sandbox-less job per second, \ie\ 84.6\,k such jobs per day (achieving -the 1\,M job rate with WMS clustering only), -while the sandbox handling overhead is considered -to be unsustainable at this rate.}. -Therefore the real aggregate storage and throughput requirements on \JP can be -reduced by the factor of at least 100. - -Despite these figures are aggregate for the whole huge EGEE infrastructure, -they clearly show that the requirements could be met even with a~single -reasonably sized server. - -JP is designed to support many-to-many relationship of JPPS and JPIS -instances. Therefore there are no strict design requirements on the -number and structure of installations. -However, for practical reasons (some emerge from Sect.~\ref{jpusage}), -it is desirable to keep just small number of well known -JPPS's permanent services. -Typical setup can be one \JP per a~larger virtual organization, or even -one \JP shared by several smaller ones. -The outlined numbers show that this approach should not face technical -limits. -On the other hand, JPIS's are expected to be set up and configured -semi-dynamically, according to the varying needs of even small user -communities. - - -\iffalse -Only limited number of JPPS installations must be deployed even on -a~large Grid to concentrate the provenance data. At most one JPPS per -a~virtual organization is envisaged for the EGEE environment. -This mean each JPPS must be able to deal with data on millions of jobs. The -typical size of an \LB\ dump is around 10\,kB per compressed record, -and gLite users are encouraged not to use large job sandboxes, too. -Consequently, the back-end storage requirements are at the order of 10-100\,GB. -JPPS metadata are formed by a~single tuple for -each job and for each file, with unique indices on jobid and file name. -The used MySQL database engine is capable to handle millions of such records. -\fi - - -\subsection{Use patterns}% -\label{jpusage} - -\subsubsection{Storing data} -Propagation of data from other middleware components to \JP is done -transparently. -The user may affect it indirectly by -specifying the destination JPPS and gathered data extent -(\eg whether to store the job to \JP at all, or which sandbox files to keep) -via parameters in the job description. These settings -may be overridden by the WMS or CE policies. - -The user stores data to \JP directly when recording annotations -(Sects.~\ref{data} and~\ref{primary}). \ludek{JPPS instance which stores -the information on the job must be known, see bellow.} - -\subsubsection{Single job processing} -When full information on a~particular job is required (\eg for the -job re-execution), -the JPPS instance which keeps the job data must be contacted. -If it is known (\eg the only JPPS serving particular VO), the data retrieval -is straightforward using JPPS interfaces, as the jobid is the primary -key to access JPPS data. - -However, if JPPS for the job is not known, it must be looked up -using JPIS query. -Depending on the amount of the user's knowledge of the job details -\wrt\ JPIS configurations (\eg JPIS configured to request information -on jobs submitted in a~certain time interval is aware of the user's -job only if its submission time falls into this interval) -it may be necessary to query multiple JPIS's to find the particular job. - -\subsubsection{Job information retrieval} -Besides preserving the job data -the principal purpose of the \JP is to provide job information -according to some criteria, -freeing the user of the burden to keep complete records on her jobs. - -As discussed in Sect.~\ref{layered} the searches cannot be served -directly by the JPPS. -Therefore, the search must be done with querying a~particular JPIS -which configuration matches the user query: -\begin{itemize} -\item The user query criteria overlap with the JPIS configuration. -\Eg it makes little sense to look for -jobs submitted in May 2005 at a~JPIS restricted to be fed with data on -jobs submitted in 2006 only. - -\item The criteria trigger a~configured index at JPIS, avoiding -full scan through its data. -\end{itemize} -Again, it may be necessary to query multiple JPIS's and concatenate -the partial results. -Currently we do not address the potentially non-trivial problem of finding -suitable JPIS's. -It falls out of the scope of the \JP level, and should be preferably -solved at the service discovery level. - -\iffalse -Such a~search would result in scanning through all data stored in JP -which are expected to be huge, being unacceptable for frequent user queries. -Instead we define an architecture that allows -batch pre-processing of configurable queries. -The result of such query, a~superset of certain user query type, is further -indexed in order to provide fast response to concrete user queries. - - -We foreseen the following typical user queries: -\begin{itemize} -\item The user knows a jobid, job isn't longer in the \LB. He will ask the - JPPS to get all or selected attributes of job. -\item The user knows a jobid, job is in a terminal state. The user wants - all files (LB event dump, sandbox) stored by JP for further processing. -\item The user is looking for jobs with specific properties. In this case - (no jobid known) a JPIS must be used. There are the same query interface - provided by any JPIS but if a particular query can be answered by - the given JPIS depends on its configuration. - The user should know the proper JPIS to use for its particular - needs. -\item The user wants to add a user tag (annotation) to a job. He must know - the jobid(s). -\end{itemize} -\fi - - -\subsection{Security} - -The data stored in the \JP are in fact potentially more -sensitive as they also include information about the inputs and are kept -for eternity. All the interaction between components is -authenticated and only encrypted channels are used to transfer data. The -basic security model is inherited from the \LB, thus user and server -certificates are used for encryption and TLS is used for channel -encryption. - -The data in JPPS and JPIS are not encrypted as this would create a -problem with permanent depository of encryption keys. We also cannot use -users' public keys to encrypt the data as this would complicate sharing -and also endanger the data in case of private key loss. Instead, with a -very limited number of JPPS's deployed, we trust the \JP servers. Each -JPPS keeps list of authorized components (\LB, Resource Brokers,~\ldots) -that are allowed to upload data to the \JP server. - -The sensitive nature of data requires also strong authorization support. -While currently only implicit ACLs (only the job owner has access to -the data) are supported, we plan to use the VOMS -based authorization service to provide a fine grained (at the user/group -level) of authorization control. In the same way as in the \LB, users -will be able to specify who is authorized to access the data stored in -the \JP. In the current model, we plan to support read-only sharing, the -annotations should be always stored by the job owner only. However, a~way -to transfer ownership of the data to another person must be also -developed, to cover employees leave and even a death. - -\iffalse -\subsubsection{Internal and external interactions} - -Fig.~\ref{fig:psinter} shows interaction of \JP with other gLite components, -Fig.~\ref{fig:query} shows internal data flow in \JP as well as interaction -with the end-user (JP client). -In this section we discuss the involved operations and data transfers. -Unless specified otherwise, the communication occurs as web-service calls -over SSL-authenticated connections. -The interfaces are described in detail in~document ``EGEE Middleware Design'' -\footnote{https://edms.cern.ch/document/487871/}, -documented web service definitions can be found at \url{http://egee.cesnet.cz/en/WSDL/}. - -\emph{Search for jobs.} -The user does not known actual jobid's and searches for a~set of -jobs matching particular conditions (see Sect.~\ref{user}). -Such query cannot be served directly by \JP Primary Storage due to performance -reasons\Dash it would typically require sweep through a~large set of primary data. -On the contrary, the query must be directed to an Index Server that was -already populated with jobs matching a~broader condition. -By calling -the Index Server \texttt{QueryJobs} operation, the user -retrieves -a~set of jobid's with addresses of Primary Storage -where the data on the jobs are stored. - - -\subsubsection{Scalability and extensibility} -\todo{configuration, describe index server administrator role} -\todo{modularity (plug-ins), type plugin IS?} -\todo{najit kompromis pro rozdeleni informaci sem a do Service and - administrators view dole, nebo jedno zrusit} -\fi - diff --git a/org.glite.jp.doc/src/JPUG-Tools.tex b/org.glite.jp.doc/src/JPUG-Tools.tex deleted file mode 100644 index 2dbf1f7..0000000 --- a/org.glite.jp.doc/src/JPUG-Tools.tex +++ /dev/null @@ -1,25 +0,0 @@ -\section{Tools description} - -In this section we give a description of the tools that are installed -together with the \verb'glite-jp-client'. These are the only \JP\ tools that a -regular grid user may need to use. - - -% This file was manually generated using db2latex (http://db2latex.sourceforge.net) -% from org.glite.jp.index/doc/glite-jpis-client.sgml -% TODO: update the original file -% TODO: generate it automatically here in Makefile -{ -\parindent0pt -\def\section#1{\subsection{#1}} -\newcommand{\dbz}{} -\newcommand{\docbooktolatexpipe}{\ensuremath{|}} -\newskip\docbooktolatexoldparskip -\input{glite-jpis-client} -} - - -\input{jpimporter} - - -\input{gui} diff --git a/org.glite.jp.doc/src/JPUG-UseCases.tex b/org.glite.jp.doc/src/JPUG-UseCases.tex deleted file mode 100644 index 0218f4a..0000000 --- a/org.glite.jp.doc/src/JPUG-UseCases.tex +++ /dev/null @@ -1,159 +0,0 @@ -\section{Job Provenance use cases} - -\subsection{Prerequisities} - -\subsubsection{LB/JP relationship} -When JP deployed, any job in a terminal state will disappear from LB -after preconfigured timeout (one week for example). If a user wants -any information about such a job before this timeout (or before it -reach a terminal state) he must use the LB service (please refer to LB -user's guide). After that timeout he must use the JP service. - -% TODO: update -% For LB configuration please see gLite installation guide. For a -% technical description of LB-JP interactions please see -% \texttt{http://egee.cesnet.cz/en/JRA1/LB-JP-interaction-guide.pdf}. - -\subsubsection{JP service location} -To call JP you need to know JP services address. There are two services: -\begin{itemize} -\item JP primary storage (JPPS)\\ - From JP design point of view there are only few PS in the - grid. Expected implementation is that these JPPS locations - are preconfigured in a UI instance while one of them is configured as - default JPPS. -\item JP index server (JPIS)\\ - Each index server is build (configured and started) by site/VO/user - group administrator (or even "senior user") based on given - community needs (expected queries and its optimization). So in - principle the index server location for a given query is to be - provided by the user. We expect that the UI instance will provide - mechanism allowing selection from preconfigured JPIS servers list. -\end{itemize} - -\subsection{JP use case 1 -- get job info} - -The scenario: -\begin{itemize} -\item The user wants information about a particular job. He knows a - job id. Job isn't longer in the LB. Procedure: Ask the JPPS to get all - or selected attributes of job. -\end{itemize} - -The implementation: -\begin{itemize} - \item Let a user to specify attributes to be returned. See section - \ref{attributes}. - \item Call GetJobAttributes operation of a JPPS and display the values - returned. -\end{itemize} - -Examples and hints: -\begin{itemize} - \item \texttt{org.glite.jp.primary/examples/jpps-test.c}\\ - This utility is used for all JPPS operations. Some hints how to use it - can be find in the test plan document. -\end{itemize} - -\subsection{JP use case 2 -- get job files} - -The scenario: -\begin{itemize} - \item The user knows a job id, job is in a terminal state. The user wants - all files (LB event dump, sandbox) stored by JP for futher processing. -\end{itemize} - -The implementation: -\begin{itemize} - \item Call GetJobFiles operation of a JPPS. You will get a list of URLs - which can be used to download the files. -\end{itemize} - -Examples and hints: -\begin{itemize} - \item The same as use case 1. -\end{itemize} - -\subsection{JP use case 3 -- job lookup} - -The scenario: -\begin{itemize} - \item The user is looking for jobs with specific properties. In this case - (no job id known) a JPIS must be used. There are the same query interface - provided by any JPIS but if a particular query can be answered by - the given JPIS depends on its configuration (configuration - determines which attributes are uploaded by PS to IS, and which of - them are indexed). - \item The user should know the proper JPIS to use for its particular - needs. - \item The scenario can continue by the JP use cases number 1 and 2 described - above (JPIS answer will contain job ids and identification of JPPSs - to ask for all available JP data about the jobs). -\end{itemize} - -The implementation: -\begin{itemize} - \item The user will select a JPIS and provide query. The JPIS operation - QueryJobs is called and list of jobs matching the query is returned. -\end{itemize} - -Examples and hints: -\begin{itemize} - \item JPIS CLI tool\\ - org.glite.jp.index/examples/jpis-client.c - - \item example in org.glite.jp.index/examples/jpis-test.c (starting - from line 161) -\end{itemize} - -\subsection{JP use case 4 -- job annotation} - -The scenario: -\begin{itemize} - \item The user wants to add a user tag (annotation) to a job. He must know - the job id(s) (or use the JP use case number 3 to find it). -\end{itemize} - -The implementation: -\begin{itemize} - \item Call RecordTag operation of JPPS for the job(s) to add requested - user tag. -\end{itemize} - -Examples and hints: -\begin{itemize} - \item The same as use case 1. -\end{itemize} - - -\subsection{Job attributes} -\label{attributes} -Job attributes are referenced by its names. Each attribute belongs to -one namespace (represented by a prefix in the attribute name). - -A namespace is defined by a service (currently we have one for LB and -one for JP) providing its data to the JP or a user group/experiment -who wants to attach its own data to the job. - -It is expected that UI have preconfigured list of available namespaces -and XML schema for each namespace (the schema can be automatically -retrieved based on the namespace name). A list of available attributes -is generated from these schemas when user have to select attributes to -be retrieved from JP. - -\begin{itemize} - \item The namespaces (schema is available at the URL representing namespace):\\ - http://egee.cesnet.cz/en/Schema/LB/Attributes\\ - http://egee.cesnet.cz/en/Schema/JP/System <<<<<<<(NOT YET)\\ - \item There are header files with known names of attributes generated from - these schema files in our build procedure:\\ - org.glite.lb.server/build/jp\_job\_attrs.h\\ - org.glite.jp.common/interface/known\_attr.h <<<<<<<\\ -\end{itemize} - - -\subsection{Authentication and authorization} -All the calls must be authenticated by user credentials. In the -current JP release only implicit ACLs are available -- the job -information is available for job owner only. - diff --git a/org.glite.jp.doc/src/JPUG.tex b/org.glite.jp.doc/src/JPUG.tex deleted file mode 100644 index afa410f..0000000 --- a/org.glite.jp.doc/src/JPUG.tex +++ /dev/null @@ -1,43 +0,0 @@ -\documentclass{egee} - -\input{definitions} - -\title{Job Provenance} -\Subtitle{User's Guide} -\author{CESNET EGEE II JRA1 team} -\DocIdentifier{EGEE-II....} -\Date{\today} -\Activity{JRA1: Middleware Engineering and Integration} -\DocStatus{DRAFT} -\Dissemination{PUBLIC} -\DocumentLink{http://...} - -\Abstract{This user's guide explains how to use the Job Provenance (\JP) -service from the user's point of view. The service architecture is described -thoroughly. Examples on using \JP\ are given... } - -\begin{document} - -\input{frontmatter} -\tableofcontents - -\newpage -\input{JPUG-Introduction} - -\newpage -\input{JPUG-Tools} - -\newpage -\input{JPUG-UseCases} - -%\appendix -%\newpage -%\input{JPUG-Appendix} - -\newpage -\nocite{jgc} -\bibliographystyle{unsrt} -\bibliography{lbjp} - -\end{document} - diff --git a/org.glite.jp.doc/src/LB-JP-interaction.tex b/org.glite.jp.doc/src/LB-JP-interaction.tex deleted file mode 100644 index f8dae21..0000000 --- a/org.glite.jp.doc/src/LB-JP-interaction.tex +++ /dev/null @@ -1,74 +0,0 @@ -\subsection{Interaction with Logging and Bookeeping (\LB)} - -In this section we describe the interaction of JP with Logging and Bookkeeping -(\LB) service. The data flows between LB and JP services are displayed in -Figure~\ref{fig:LB-JP-interactions}. These flows are numbered and one can use -this numbers to find additional information about each flow in -table~\ref{tab:LB-JP-interactions}. - -\begin{figure}[htpb] - \centering - \includegraphics[width=0.9\hsize]{LB-JP-interaction-details} - \caption{LB to JP interactions detail overview} - \label{fig:LB-JP-interactions} -\end{figure} - -\begin{table}[htpb] - \centering - \begin{tabular}{|c|p{3cm}|l|p{9cm}|} - \hline - &spool directory&initiated by&description\\ - \hline - \hline - 1&lb.export.dump, - lb.export.dump.keep&lb-exporter& - Export of LB job records into spool directory. It uses glite-lb-purge utility. LB-exporter reads this spool directory in a regular manner and implement next processing of LB dumps. Optionally it can keep handled dumps in lb.export.dump.keep.\\ - \hline - 2&lb.export.jpreg&LB server&When new job come to the LB server - it stores its - registration into the spool directory. It is responsibility of - JP-importer process to handle such registrations.\\ - \hline - 3&lb.export.jpdump, - lb.export.jobs, - lb.export.jobs.keep&lb-exporter& - LB-exporter do its processing of LB dumps (they are in per job form) and passes on it to the JP-importer using the spool directory lb.export.jpdump and temporary storage lb.export.jobs. It can keep the job files for futher usage.\\ - \hline - 4&none&jp-importer&JP importer handles registrations received from LB - server and sends it to the JP primary server front-end (using its WS - interface).\\ - \hline - 5&none&jp-importer&JP importer handles LB dumps received from LB - exporter and sends it to the JP primary server back-end using its - gridftp interface.\\ - \hline - \end{tabular} - \caption{LB to JP data flows description} - \label{tab:LB-JP-interactions} -\end{table} - - -Notes: -\begin{itemize} - \item Only JP Primary Storage (JPPS) server is involved in described - data flows. JP Index Servers are not part of this picture (they are - feeded via corresponding JPPS). - \item Only flows number 4 and 5 are designed to be inter-host. All - the other interactions assume the components are on the same host and - do use access to a shared filesystem. - \item Data flow number 1 use glite-lb-purge utility (see its - documentation) and passes to it argument from lb.export.purgeargs - clause of the deployment configuration file. This argument contain - the timeouts controlling after how long period of time a job - staying in a terminal state is to be purged from the LB server. - \item The LB exporter have a feature to store LB job event dumps in a - directory for further handling (e.g. for job statistic tool). This behaviour - is controled by lb.export.jobs.keep deployment config file clause (leave - this clause empty if you don't use dumps for futher handling). - \item The LB exporter also have a feature to keep all handled LB - dumps (in glite-lb-purge format) in filesystem. This feature is - controlled by lb.export.dump.keep. - \item LB exporter is not a deamon, it's periodic invocation is - provided by cron deamon. -\end{itemize} - diff --git a/org.glite.jp.doc/src/README b/org.glite.jp.doc/src/README deleted file mode 100644 index 663de30..0000000 --- a/org.glite.jp.doc/src/README +++ /dev/null @@ -1,12 +0,0 @@ -This is the official documentation for Job Provenance Service. -It consists of the following documents: - -JPUG.pdf - Job Provenance User's Guide -JPAG.pdf - Job Provenance Admin's Guide -JPDG.pdf - Job Provenance Developer's Guide - -Please, report all bugs to EU EGEE Bug Tracking System located at -https://savannah.cern.ch/bugs/?func=additem&group=jra1mdw - -Feel free to send us your non-bugs comments to email -egee-jra1@lindir.ics.muni.cz diff --git a/org.glite.jp.doc/src/copyright.tex b/org.glite.jp.doc/src/copyright.tex deleted file mode 100644 index 981ab62..0000000 --- a/org.glite.jp.doc/src/copyright.tex +++ /dev/null @@ -1,24 +0,0 @@ -% Taken from: -% https://twiki.cern.ch/twiki/bin/view/EGEE/EGEEgLiteSoftwareLicense -% -\vfill{} - -{\bf -Copyright} \copyright\ {\bf Members of the EGEE Collaboration. 2004. See -\href{http://www.eu-egee.org/partners/}{http://www.eu-egee.org/partners/} for -details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (the "License"); you may not use -this file except in compliance with the License. You may obtain a copy of the -License at - -\begin{center} -\href{http://www.apache.org/licenses/LICENSE-2.0}{http://www.apache.org/licenses/LICENSE-2.0} -\end{center} - -Unless required by applicable law or agreed to in writing, software distributed -under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR -CONDITIONS OF ANY KIND, either express or implied. See the License for the -specific language governing permissions and limitations under the License. -} - diff --git a/org.glite.jp.doc/src/definitions.tex b/org.glite.jp.doc/src/definitions.tex deleted file mode 100644 index 34a61ed..0000000 --- a/org.glite.jp.doc/src/definitions.tex +++ /dev/null @@ -1,24 +0,0 @@ -\usepackage{xspace} -%\usepackage{doxygen} -\usepackage{alltt} -\usepackage{comment} - -\def\LB{L\&B\xspace} -\def\JP{JP\xspace} -%\def\eg{e.\,g.} -\def\eg{for example\xspace} -\def\Eg{For example\xspace} -%\def\ie{i.\,e.} -\def\ie{that is\xspace} -\def\wrt{with respect to\xspace} -\def\Dash{---\penalty-1000} - -\long\def\TODO#1{\par\noindent\textbf{TODO:} {\sl#1}\par} -\long\def\ludek#1{} - -\def\path#1{{\normalfont\textsf{#1}}} -\def\code#1{\texttt{#1}} - -\specialcomment{hints}{\par\noindent\textbf{Hints: }\begingroup\slshape}{\endgroup} - -\hyphenation{plug-in} diff --git a/org.glite.jp.doc/src/egee.cls b/org.glite.jp.doc/src/egee.cls deleted file mode 100644 index e0a03bf..0000000 --- a/org.glite.jp.doc/src/egee.cls +++ /dev/null @@ -1,507 +0,0 @@ -% egee.cls: -% -% $Id$ -% -% $Log$ -% Revision 1.1.1.1 2007/11/13 17:42:10 jpospi -% initial import -% -% Revision 1.13 2004/08/31 19:24:27 szamsu -% Fixing overfull problem in page headers. Saving the logo and reusing it later, instead of loading in again. -% -% Revision 1.12 2004/08/09 14:03:54 szamsu -% proper IST number -% -% Revision 1.11 2004/08/03 17:02:21 szamsu -% Information Society Infrastrcutures logo replacing the old IST logo -% -% Revision 1.10 2004/08/03 13:34:37 szamsu -% Removed 'compat2' option on geometry, because it has also specified -% 'scale{0.8,0.9}' for page size, which we define otherwise. Added the -% 'centering' and 'includeheadfoot' options, which were defined in -% 'compat2'. -% -% Revision 1.9 2004/07/09 16:06:52 leanne -% Removed the Lead partner which is not used in egee -% -% Revision 1.8 2004/06/03 09:56:11 leanne -% removed lead partner - -% Revision 1.8 2004/06/03 09:56:11 diana -% updated the front page -% -% Revision 1.7 2004/05/26 09:38:55 leanne -% Removed DocumentLink in pdfinfo - it was causing errors -% -% Revision 1.6 2004/05/26 08:36:58 leanne -% Updated IST number in template -% -% Revision 1.5 2004/05/24 13:25:04 diana -% added template for egee latex documents -% -% Revision 1.4 2004/05/17 10:56:51 diana -% added compat2 option to geometry and hypertex option to hyperref to get logo and links back on the page -% -% Revision 1.3 2004/02/18 18:08:48 leanne -% Modified Document identifiers to mauch the EGEE Word templates -% -% Revision 1.2 2004/02/18 17:23:21 leanne -% Changed Work Package to Activity. Included definition of Document Link. -% -% Revision 1.1.1.1 2004/02/18 11:17:44 leanne -% Initial version of EGGE LaTeX Style files based on the EDG LaTeX Style -% -% -% Revision 1.0 2004/02/17 leanne -% Took the datagrid.cls file and modified it for the EGEE project -% Original Authors: -% Frohner Akos -% Diana Bosio -% Paul Millar -% Thanks are due to Norman Gray -% -\NeedsTeXFormat{LaTeX2e} -\ProvidesClass{egee}[2002/06/20 EGEE LaTeX Class] -\typeout{EGEE LaTeX class -- 2002/06/13 Rock Lobster!} -% -%% Notes: This class file tries, as largely as possible, to copy the Microsoft -%% Word template document EDMS 2098656 v2.2. Differences and notes are listed -%% below: -%% o The Word Template uses 11pt for the main body, but 12 point -%% occasionally. Any such occurrence of 12pt is mapped into 11pt in this -%% class-file. -%% o This class inherits 11pt article. In that class Huge=30pt and -%% LARGE=22pt, which matches the required point-size for the title page. -%% o The parskip in the Word doc is exactly 1.4mm (0.7mm above and below). -%% Here we've taken the liberty of adding some glue to make things fit -%% better. -%% o The Word Template shows all the (sub)sections on the contents page in -%% capitals and subsubsections in italics. The LateX class doesn't. - -%% Interface - example of an option, should we want to use these later. -%\newif\ifmonotitle\monotitlefalse - -%\DeclareOption{mono}{\monotitletrue} - -\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} -\ProcessOptions - - -% Inherit! -\LoadClass[11pt]{article} - -% Necessary packages: -\RequirePackage{lastpage} -\RequirePackage{tabularx} -\RequirePackage{pslatex} -\RequirePackage{times} -\RequirePackage{verbatim} -\RequirePackage{geometry} -\RequirePackage{url} - -\usepackage[hang,bf,small]{caption} - -% -% We now define a new \if command to test for PDF being enabled. -% It is important because loading graphicx overrides the definition -% of \pdfoutput and sets it to true even when PDF is not enabled. -% Use \ifpdf instead of \ifx\pdfoutput\undefined hereafter. -% - -\newif\ifpdf -\ifx\pdfoutput\undefined - \pdffalse - % \typeout{PDF _not_ defined} -\else - \pdfoutput=1 - \pdftrue - % \typeout{PDF _is_ defined} -\fi - -\ifpdf - \usepackage[pdftex, - pdfpagemode={UseOutlines},bookmarks=true,bookmarksopen=true, - bookmarksopenlevel=0,bookmarksnumbered=true, - hypertexnames=false,colorlinks,linkcolor={blue}, - citecolor={blue},urlcolor={red}, - pdfstartview={FitV}]{hyperref} -\else - \usepackage[hypertex]{hyperref} -\fi - -\ifpdf - \usepackage[pdftex]{graphicx} - \pdfcompresslevel 9 - \pdfadjustspacing 1 -\else - \usepackage[dvips]{graphicx} -\fi - -\usepackage{color} - -\def\footsize{5mm} - -%% -%% PAGE GEOMETRY DEFINITIONS -%% -% From Template file -\geometry{centering,includeheadfoot} -\geometry{a4paper,top=12.5mm,headheight=12.5mm,headsep=5mm,foot=\footsize,footskip=13.3mm,bottom=12.5mm} -\geometry{right=25mm,left=25mm} - - -% APM -- I don't think these are right, my impression is above is correct -%\geometry{a4paper,margin=0.98in,headheight=0.72in} - - -%% -%% PAGE COLOUR DEFINITIONS -%% -\definecolor{blue}{rgb}{0.1,0.1,0.5} -\definecolor{lightgrey}{gray}{0.65} - - -% paulm's prefered name ... -\def\bibname{References} - -\setlength{\parindent}{0pt} -\setlength{\parskip}{1.4mm plus 0.4mm minus 0.2mm} - -\def\@defaultfooter{ - \def\@oddfoot{\vbox to \footsize {% - {\color{blue}\hrule width \textwidth height 1pt depth 0pt}% - \vfil - \small\hbox to \textwidth{\ISTNumber% - \hfil - \hbox{\colorbox{yellow}{\MakeUppercase{\@Dissemination}}}% - \hfil - \hbox{\thepage/\pageref{LastPage}}}% - }% - }% -} - - -\def\ps@title{% - \@defaultfooter - \def\@oddhead{\hbox to \textwidth{\LargeEGEELogo\hfil\ISTLogo}} -} - -\def\ps@headings{% - \@defaultfooter - \def\@oddhead{\vbox to \headheight{% -%\hrule width \textwidth height 1pt\relax - \vbox to 0.75\headheight{% - \hbox to \textwidth{% - \hbox to 0pt{\EGEELogo\hss}% - \hfil - \hbox to 8cm{% - \vbox to 0.75\headheight{% - \vfil - \parbox{8cm}{% - \centering\color{blue}% - \textbf{\MakeUppercase{\@title}}% -\ifx\@Subtitle\@empty\else - \par\textbf{\scriptsize\@Subtitle}% -\fi - }% - \vfil - }% - \hss}% - \hfil -%\hbox to 0pt{\vrule width 1pt height 10pt depth 0pt \hss}% -%% {\scriptsize\setlength{\parskip}{0pt}\setlength{\topsep}{0pt}% -%% % \vbox to 0.75\headheight{% -%% \parbox{4cm}{x% -%% \begin{flushright}% -%% \textit{Doc. Identifier}:\\ -%% \textbf{\@DocIdentifier}\\ -%% \vfil -%% \textit{Date}: \textbf{\@Date} -%% \end{flushright}% -%% }% -%% % }% -%% }% -\hbox to 0pt{\hss\vbox to 0.75\headheight{%\hrule -\tiny%\scriptsize -\parfillskip0pt -\leftskip 0pt plus 1fil -\parskip0ex -\textit{Doc.\ Identifier}: -\par -\textbf{\@DocIdentifier} -\vfil -\textit{Date}: \textbf{\@Date} -%\hrule -}}% -% \hbox to 4cm{\scriptsize -% \vbox to 0.75\headheight{% -% \parbox{4cm}{ -% \halign{\hfill####\cr -% \textit{Doc. Identifier}:\cr -% \textbf{\@DocIdentifier}\cr -% % \noalign{\vfil} -% \textit{Date}: \textbf{\@Date}\cr -% }}% -% \vfil -% }% -% }% - }% - }% -%\hrule width \textwidth height 1pt\relax - \vfil\vskip 2.5mm\relax - {\color{blue}\hrule width \textwidth height 1pt depth 0pt}% - }% - }% -} - -\pagestyle{headings} - -\setlength{\captionmargin}{1cm} - -% image file extensions respective to the output format -\ifpdf - \DeclareGraphicsExtensions{.jpg,.pdf,.png} - \pdfcompresslevel=9 -% \pdfinfo{ /Title (\@DocumentLink) } - \pdfinfo{ /Title (EGEE) } -\else - \DeclareGraphicsExtensions{.eps} -\fi - -\def\frontboxwidth{10.6cm}% - - - -%% -%% Define our title page -%% -\AtBeginDocument{ -\pagestyle{title}% -\hbox{}% Force top of page -\vfill -{\centering - \Huge\bf\textsf{\textcolor{blue}{EGEE}}\\[20mm]% - \LARGE\sc\textsf{\bf \@title}\\[5mm]% - \ifx\@Subtitle\@empty\else - \normalsize\textsf{\@Subtitle}\\[10mm]% - \fi - \ifx\@DeliverableId\@empty\else - \LARGE\sc\textsf{\bf \@DeliverableId}\\[5mm]% - \fi -}% -\vfill -\hbox to \textwidth{ - \hfil - \vbox{ - {\color{blue}\hrule width \frontboxwidth height 1mm depth 0pt} - \hbox to \frontboxwidth{\sf - \begin{tabularx}{\frontboxwidth}{l>{\raggedright\arraybackslash}X} - Document identifier: & \textbf{\@DocIdentifier}\\[3mm] - Date: & \textbf{\@Date}\\[3mm] - Activity:& \textbf{\@Activity}\\[3mm] - Document status: & \textbf{\@DocStatus}\\[3mm] - Document link:& \textbf{\@DocumentLink}\\[3mm] - \end{tabularx} - } - {\color{blue}\hrule width \frontboxwidth height 1mm depth 0pt} - } -} -\vfill -{\sf\underline{Abstract}: \@Abstract} -\vfill -\newpage % end of the first page -\pagestyle{headings} -\setcounter{tocdepth}{3} -} % End of AtBeginningDocument - - -% -% EGEE style small-capital section titles. -% -% The numbering is aligned with the WinWord style, -% although it is not common in the english typography... -% -\newcommand{\sectionbreak}{\newpage} -\renewcommand{\thesection}{\arabic{section}.} -\renewcommand{\thesubsection}{\thesection\arabic{subsection}.} -\renewcommand{\thesubsubsection}{\thesubsection\arabic{subsubsection}.} - -\renewcommand\section{\@startsection {section}{1}{\z@}% - {-3.5ex \@plus -1ex \@minus -.2ex}% - {2.3ex \@plus.2ex}% - {\normalfont\Large\bfseries\sffamily\scshape}} - -\renewcommand\subsection{\@startsection{subsection}{2}{\z@}% - {-3.25ex\@plus -1ex \@minus -.2ex}% - {1.5ex \@plus .2ex}% - {\normalfont\large\bfseries\sffamily\scshape}} -\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}% - {-3.25ex\@plus -1ex \@minus -.2ex}% - {1.5ex \@plus .2ex}% - {\normalfont\normalsize\bfseries\sffamily\scshape}} - - - -%% APM NEED TO REDEFINE section -%\titleformat{\section}{\Large\bfseries\sffamily\scshape}{\thesection}{1em}{} -%\titlecontents{section} [2em] {\vspace*{4pt}} -% {\large \sc \bfseries \contentslabel{2em}} -% {\large \sc \bfseries \hspace*{-2em}} -% {\large \textbf{\titlerule*[1ex]{.}\contentspage}} [\vspace*{4pt}] - -%\titleformat{\subsection}{\large\bfseries\sffamily\scshape}{\thesubsection}{1em}{} -%\titlecontents{subsection} [5em] {} -% {\sc \contentslabel{3em}} -% {\sc \hspace*{-3em}} -% {\titlerule*[1ex]{.}\contentspage} - - -% -% common constants -% -\def\ISTNumber{INFSO-RI-508833} -\newsavebox{\@EGEELogo} -\savebox{\@EGEELogo}{\includegraphics[height=0.75\headheight]{egee}} -\def\EGEELogo{\usebox{\@EGEELogo}} -\def\LargeEGEELogo{\includegraphics[height=\headheight]{egee}} -\def\ISTLogo{\includegraphics[height=\headheight]{isi}} - -% -% parameters to be supplied by the author -% -\def\Subtitle#1{\gdef\@Subtitle{#1}} -\gdef\@Subtitle{\@latex@warning@no@line{No \noexpand\Subtitle given}} - -\def\DeliverableId#1{\gdef\@DeliverableId{#1}} -\gdef\@DeliverableId{\@latex@warning@no@line{No \noexpand\DeliverableId given}} - -\def\DocIdentifier#1{\gdef\@DocIdentifier{#1}} -\gdef\@DocIdentifier{\@latex@warning@no@line{No \noexpand\DocIdentifier given % - (e.g. EGEE-JRA1-TEC-edmsId-v0-1)}} - -\def\Date#1{\gdef\@Date{#1}} -\gdef\@Date{\@latex@warning@no@line{No \noexpand\Date given % - (e.g. 01/01/2004)}} - -\def\Activity#1{\gdef\@Activity{#1}} -\gdef\@Activity{\@latex@warning@no@line{No \noexpand\Activity given % - (e.g. JRA1 Middleware Engineering and Integration )}} - -\def\DocStatus#1{\gdef\@DocStatus{#1}} -\gdef\@DocStatus{\@latex@warning@no@line{No \noexpand\DocStatus given % - (e.g. DRAFT, WORKING, DELIVERED)}} - -\def\Dissemination#1{\gdef\@Dissemination{#1}} -\gdef\@Dissemination{\@latex@warning@no@line{No \noexpand\Dissemination given % - (e.g. PUBLIC, INTERNAL, ...)}} - -\def\DocumentLink#1{\gdef\@DocumentLink{#1}} -\gdef\@DocumentLink{\@latex@warning@no@line{No \noexpand\DocumentLink given % - (e.g. http://cern.ch)}} - -\long\def\Abstract#1{\gdef\@Abstract{#1}} -\gdef\@Abstract{\@latex@warning@no@line{No \noexpand\Abstract given}} - -%% -%% Define the abstract using an environment abstract - -% -% This will produce the mailto link in the PDF file -% -% -% We use the URL package, which does this nicely. The old way (\HTTP) was -% a bit buggy as it had problems with '~'s and '_'s -% -\urlstyle{sf} -\ifpdf - \newcommand{\Email}[1]{\href{mailto:#1}{<{#1}>}} - \newcommand{\HTTP}[1]{\href{#1}{\url{#1}}} -\else - \newcommand{\Email}[1]{\textsf{<{#1}>}} - \newcommand{\HTTP}[1]{\url{#1}} -\fi - - -% -% We now redifine \part and \section so that the table of contents -% has the sections/parts in upper case. -% -% Note: need to use \uppercase because \MakeUppercase is not robust -% -\def\@part[#1]#2{% - \ifnum \c@secnumdepth >\m@ne - \refstepcounter{part}% - \addcontentsline{toc}{part}{\thepart\hspace{1em}\uppercase{#1}}% - \else - \addcontentsline{toc}{part}{\uppercase{#1}}% - \fi - {\parindent \z@ \raggedright - \interlinepenalty \@M - \normalfont - \ifnum \c@secnumdepth >\m@ne - \Large\bfseries \partname\nobreakspace\thepart - \par\nobreak - \fi - \huge \bfseries #2% - \markboth{}{}\par}% - \nobreak - \vskip 3ex - \@afterheading} - -\def\@sect#1#2#3#4#5#6[#7]#8{% - \ifnum #2>\c@secnumdepth - \let\@svsec\@empty - \else - \refstepcounter{#1}% - \protected@edef\@svsec{\@seccntformat{#1}\relax}% - \fi - \@tempskipa #5\relax - \ifdim \@tempskipa>\z@ - \begingroup - #6{% - \@hangfrom{\hskip #3\relax\@svsec}% - \interlinepenalty \@M #8\@@par}% - \endgroup - \csname #1mark\endcsname{\uppercase{#7}}% - \addcontentsline{toc}{#1}{% - \ifnum #2>\c@secnumdepth \else - \protect\numberline{\csname the#1\endcsname}% - \fi - \texorpdfstring{\uppercase{#7}}{#7}}% - \else - \def\@svsechd{% - #6{\hskip #3\relax - \@svsec #8}% - \csname #1mark\endcsname{\uppercase{#7}}% - \addcontentsline{toc}{#1}{% - \ifnum #2>\c@secnumdepth \else - \protect\numberline{\csname the#1\endcsname}% - \fi - \texorpdfstring{\uppercase{#7}}{#7}}}% - \fi - \@xsect{#5}} - -% \addcontentsline{toc} expands to \contentsline{NAME} -% which in turn expands to \l@NAME. So, to specify -% the table of contents, we must define \l@chapter, \l@section, -% \l@subsection, ... ; to specify the list of figures, we must define -% \l@figure; and so on. Most of these can be defined with the -% \@dottedtocline command, which produces a contents line with dots -% between the title and the page number. It works as follows: -% -% \@dottedtocline{LEVEL}{INDENT}{NUMWIDTH} -% LEVEL : An entry is produced only if LEVEL < or = value of -% 'tocdepth' counter. Note, \chapter is level 0, \section -% is level 1, etc. -% INDENT : The indentation from the outer left margin of the start of -% the contents line. -% NUMWIDTH : The width of a box in which the section number is to go, -% if TITLE includes a \numberline command. -% - -\def\l@part{\@dottedtocline{1}{4em}{2.0em}} -\def\l@subsection{\@dottedtocline{2}{1.5em}{2.3em}} -\def\l@subsubsection{\@dottedtocline{3}{3.8em}{3.2em}} -\def\l@paragraph{\@dottedtocline{4}{7.0em}{4.1em}} -\def\l@subparagraph{\@dottedtocline{5}{10em}{5em}} - diff --git a/org.glite.jp.doc/src/frontmatter.tex b/org.glite.jp.doc/src/frontmatter.tex deleted file mode 100644 index 732dcec..0000000 --- a/org.glite.jp.doc/src/frontmatter.tex +++ /dev/null @@ -1,40 +0,0 @@ -\begin{center} -{\bf Delivery Slip} -\end{center} -\begin{tabularx}{\textwidth}{|l|l|l|X|X|} -\hline - & {\bf Name} & {\bf Partner} & {\bf Date} & {\bf Signature} \\ -\hline -{\bf From} & & & & \\ -\hline -{\bf Reviewed by} & & & & \\ - -\hline -{\bf Approved by} & & & & \\ -\hline -\end{tabularx} - -\begin{center} -{\bf Document Change Log} -\end{center} - -\begin{tabularx}{\textwidth}{|l|l|X|X|} -\hline -{\bf Issue } & {\bf Date } & {\bf Comment } & {\bf Author } \\ \hline - -\hline -\end{tabularx} - -\begin{center} -{\bf Document Change Record} -\end{center} - -\begin{tabularx}{\textwidth}{|l|l|X|} -\hline -{\bf Issue } & {\bf Item } & {\bf Reason for Change } \\ \hline - -\hline -\end{tabularx} - -\input{copyright} -\clearpage diff --git a/org.glite.jp.doc/src/glite-jpis-client.tex b/org.glite.jp.doc/src/glite-jpis-client.tex deleted file mode 100644 index 7f6ba81..0000000 --- a/org.glite.jp.doc/src/glite-jpis-client.tex +++ /dev/null @@ -1,93 +0,0 @@ -% -% ------------------------------------------------------------- -% Refentry -% ------------------------------------------------------------- -\section{glite-jpis-client} -\label{glitejpisclient}\hypertarget{glitejpisclient}{}% -\label{name} - -%\section*{Nom} -glite-jpis-client --- client interface for JP IS\label{synopsis} -\subsection*{Synopsis} -\label{id2455104} -\begin{list}{}{\setlength{\itemindent}{-\leftmargin}\setlength{\parsep}{0mm}} -\item\raggedright\texttt{glite-jpis-client [ -h | --help ] [ -i | --index-server \textit{JPIS:PORT}] [ -q | --query-file \textit{IN\_FILE.XML}] [ -t | --test-file \textit{IN\_FILE.XML}] [ -e | --example-file \textit{OUT\_FILE.XML}] [ -f | --format {xml | human}]} -\end{list} - -\subsection*{DESCRIPTION} -\label{id2417458} - -{\bfseries{glite-jpis-client}} is command line interface for querying the Job Provenance Index Server. It takes the XML input, process the QueryJobs operation and returns the result in specified format. - -\subsection*{OPTIONS} -\label{id2417597} - -With no options you get simple usage message as with {\texttt{{-h}}}. - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\texttt{{-h}}}\docbooktolatexpipe{}{\texttt{{--help}}}}]\null{} -Displays usage message. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\texttt{{-i}}}\docbooktolatexpipe{}{\texttt{{--index-server}}}}]\null{} -Specifies Job Provenance Index Server as {\ttfamily\itshape{{HOST:PORT}}}. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\texttt{{-q}}}\docbooktolatexpipe{}{\texttt{{--query-file}}}}]\null{} -Process the QueryJobs operation. Requires input data in file {\ttfamily\itshape{{IN\_FILE.XML}}}, for using stdin specify {\texttt{{-}}}. - -The input and output data are in XML format with XSD schema, which can be found in {\texttt{{JobProvenanceISClient.\dbz{}xsd}}} (element QueryJobs for input and QueryJobsResponse for output). -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\texttt{{-t}}}\docbooktolatexpipe{}{\texttt{{--test-file}}}}]\null{} -Test the input data from {\ttfamily\itshape{{IN\_FILE.XML}}} (or from stdin if {\texttt{{-}}} is specified) and prints the found content. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\texttt{{-e}}}\docbooktolatexpipe{}{\texttt{{--example-file}}}}]\null{} -Write the example input data to file {\ttfamily\itshape{{OUT\_FILE.XML}}} (or to stdout if {\texttt{{-}}} is specified). The XML is valid against XSD schema in {\texttt{{JobProvananceISClient.\dbz{}xsd}}}, formating may vary according to used gsoap version. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\texttt{{-f}}}\docbooktolatexpipe{}{\texttt{{--format}}}}]\null{} -Use {\ttfamily\itshape{{FORMAT}}} as output format type. You can specify {\texttt{{xml}}} for interchangeable XML output or {\texttt{{human}}} for nice looking human readable output. -\end{description} -\noindent -\subsection*{RETURN VALUE} -\label{id2417767} - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{0}]\null{} -Success. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{-1}]\null{} -Communication error or error from the remote server. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{EINVAL}]\null{} -In most cases XML parsing error. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{other error}]\null{} -Other error from errno. -\end{description} -\noindent -\subsection*{EXAMPLES} -\label{id2417822} - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\bfseries{glite-jpis-client --example-file query.xml}}}]\null{} -Save the example query parameters to file {\texttt{{query.\dbz{}xml}}}. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\bfseries{glite-jpis-client --query-file query.xml}}}]\null{} -Queries the local index server running on default port with the query parameters specified in the file {\texttt{{query.\dbz{}xml}}}. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\bfseries{glite-jpis-client -i localhost:8902 -q - -f human}}}]\null{} -Queries the index server running on local host on the port 8902 with the query parameters from stdin and show results in non-XML form. -\end{description} -\noindent - - -\subsection*{SEE ALSO} -\label{id2418102} - -glite-jp-indexd(8) - -\subsection*{AUTHOR} -\label{id2418112} - -EU DataGrid Work Package 1, CESNET group. diff --git a/org.glite.jp.doc/src/glite_installation_guide_JP.doc b/org.glite.jp.doc/src/glite_installation_guide_JP.doc deleted file mode 100644 index a69f348fed7878f61698927cb17da7abf62fdbb4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 349184 zcmeF42S60Z`}dcQAXc!KRWV`#dp8OySYpL)jC#NUr@-OeAz@A4uoTpPc)6bpR)=$6SL6#~6@uh5kH^nEKRmv5 z{ql11>*U{q`gnozP*vK4+eUljzqKDNRoCqZzB-c`UYq^hu1J5(`ddu$Tg%hh&u{ICblh`Tp2Nerehv82Rv3ypTQEpq`8$ns zaYW+sN`=1={P_k8!UcZwE6#(_J|;RqMgvh_Hb@KiQ)}n?$j{31G^~v{UC_h0TN2)j zn?m4K#-pngj}BYG2C08KKGndd8pyZ?+$=|Ku}O;t&Du5eZ`Gth+jfEeV)1a3DY{nq z@?jA=lh!9z8{`wLHAMLYhf5*lb&;Adtx@uHGwMRLK0Tttii=&!h|T>28~F#c3~cV# zwn+>BwxYX@2YXJFD5FUe5uq{Z^iiTFDnx9cj|$a=#TcZJMlndl&8{C%JFE-T&wKC{?Yojz#!CEm`9~rHW(ngt#ZfOv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gaM6Spa`JzBbqY_C= zZHh#(kj5R7n%a~JX<#8~tSu$0w&W9SNo#GnRVYoTMV+V@4WdyriDuCvTE%EFMvN70 zqFr=|abmo9MNAMA#UwFVOc7JXtKv2Bx|k;35Yt7cm?370Sz@-BBj$>EV!l`)7K%mU zO|e)k5lh7~@s?OF-WDswf3L1?RCskk_vuw?b=@d8`OsKdSk>U>%YDC1|M)q_f3J=D LpSArD?}7gXNC0X* diff --git a/org.glite.jp.doc/src/glite_installation_guide_LB.doc b/org.glite.jp.doc/src/glite_installation_guide_LB.doc deleted file mode 100644 index 8dcc46478bdbdd959e2078be3b1d0c79a8868be9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 174080 zcmeFa2|QL`*EfDH^E?x!j8Q@v%RCQ>GGvxAm3byAQHhd>G$%AlB9%f>C`v`<(uimf z86p|qwXZ`_*VV84d7k&a-~Z?ToIc;{9OtaP*4k^Yz4zMt?0tG#!~QlSZ*D90%b|i% zViS|}7|o3PlyGfEn7YA+VH9wQ{+yVcoSeFgMWGA03Ag_D`2T04{*B12_Pj04@MGfCn%Kzzg65%mvH?@B`)p761eQf&d|a zFhB$#3Rnmb1Be3_0Tu%!080Rp04abp0O`66&N2X5fE+*`pa4(=EC;LrC;^lKDgaf0 z8bBSO0nh|!0ki=+09}9{Kp$WLFa)dw7y(uRi~%Nq)qphsQ-B%39AE)h3$O%O0jvQw z09$|^z#iZLSO;(ftOslWI02jiE&!A#H#lzuYy!9gJOG{mFMv0|2jC0v1NZ|10D*uY zKrkQ#5DM4~2m^!zwg9#QwgDml+X0b)9RPFSZQi1n62C{vbY=UV(j8x{4a7e>lMZ zaH0P|_rH(-?^u8X6Cp4_z-A9U`gB1+f5X-{NkQy)XrVV7hu+B@dWkJqHzOz-S<*VTLN2SM1`3Fbc}c~A47V&Ab_b6CFW>EjXA-+^@aqh zV1Tb7^a9QpfsFu?Q6ESLJ*yMu3jLY~^k;&^zFiS?(-gxP#4tvE!t{wX`U=4jz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W%0=y_am^WSf~h&txML)%B>!ZKYsp zb}PXb_#G4LkGV~dTbP5We2~w|a%LSGEH)dhfVJD0J3nc=G2sT!e&et9?&SCi6D6Nk zj#V^w`%WxMsX zR~to+s9Dm5yK}bBDZ3GSyMYD3LO|?5ZUasvFKWy&CYzY3cJnC5{D?^-ldm%A@OSea zrnSi4BFTc3LytyGOyn!JKFr5>wK>VrhUIuyF|pU21c=S%6hQ1YTLEjk`7&pwWdCc9QL@LdG3kP3pG=dzFJ1oW zA^&fQWxRf#vKik4Jx(97&)o}%jV{~fTANTmThKALYFp5c!Ihr;g$25k$yO$6Q@?sS zdzzCan5c2(BOJ4u$#0k_P5l+e{E~^9rT#g`cz(aPxFS3AKzr&XonN?LSWsFC?+N)2 z64{*qsxd}CCFAtll6Jid;kUNEC%roG{;PfeuXD_6OkQEKoyomS)P%5lRp3zpgICIOWed4Sj0qK zfFrW^TY1Hfb*vJ0uDnUiWIO&gv+$+1)_0@PiB7B?Rz6q}?bABae-64SWGPZd1yj@P zj;6xysK~+2=4d=JCmwOv6mEsp9|mjXM`bR;TiE2ahJf&XGDww0!SQj2mJu(G<4V=$ zbBQ~~jZW;i`16US#bbcVmZimUV8TocL0cM}^Kq=2VEWgX36ypT(k>|;o@k3ywk#uL8f!~dT3wyfF$w9vJ@pZ{uT^VwheC3|P z<}c+P(vjhKdP;<<-*!v#9k(5Lv6=sm?2vyp`M2Y;b=~+Fvw6!gbBXbuPwD;#UHBD= diff --git a/org.glite.jp.doc/src/gui.tex b/org.glite.jp.doc/src/gui.tex deleted file mode 100644 index dae3aec..0000000 --- a/org.glite.jp.doc/src/gui.tex +++ /dev/null @@ -1,3 +0,0 @@ -\subsection{GUI} - -\TODO{GUI description} diff --git a/org.glite.jp.doc/src/images/JP-interactions.cdr b/org.glite.jp.doc/src/images/JP-interactions.cdr deleted file mode 100644 index 80db3f8bf5a2bf193412d82c2e2ed043b4527ad1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 49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B5mbzXQYXn6DQL0n+iQ6?c;|BzFR=q!p z{P+RG>SncDfL9V7J5jrGyzi^uI5STi|8kai{N8*qd#RPh+;n$c$JYNQP;9MV;f$@K zTN5X?&U@c`Cn}hxve+8CHhi@fHP0U8iV|fJjL}He?aL_9&@W(nrf@BtM+F#Ra|e+Y;CS+oR{I9**32B ziH|nti^*rCi~BCfH>1%_ch_|^?n#hn@C@qIMG=0L+|~bA689~(YOUs z(cfsKFI5mZqcPSPe0OOQK}OtX`jZeoUTt3;T{k zCt6RgZo0d!WT84aL%pXaoD_GJ-O~hIP^CT=}Q$o&Nz%U2KgOv zI2r`*JsyUm+%3};pjp8t{O-Eke2lyMn6k(x?s_Co+*g$@ZfmgKC3Dl)EcA)ApXQ0I znsjkoo%Jpmf3cq5Px&!<{qF6NcqhI62hJU@MA?1x=MI~u-J^FO`A+&>kHmi`{g~T) z;t6) z#qU~q+f5(+J^0D^)hY66U+gt}(Scyl*F_P^1e*Hw>o?_h4)lG~eaX`)TprHc)&7-F zN{j~Mq}s=wks9|sXg%kX)(jW>a4*yEIJ)WD7OU?bE^Zl>XWHUdgA|wBV86kB-&E%S zyX}XcG|4kZL@rmqeiiHc<$IpW5mU#iUqiFUrJL@q>$rS+kbF^cx6>DikR$j``svFo zU+8Zrm?O>|t9-$Kp=bZqIQ<)r^GG*-!|_6t30`{q7k|9Q@kUsmqZpKP0P=eMY8-#N zk@r&fnEKZm(AHsU!dZ diff --git a/org.glite.jp.doc/src/images/JP-query.pdf b/org.glite.jp.doc/src/images/JP-query.pdf deleted file mode 100644 index e2f5c791970283b6d7d423789dabc324e4715114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 41756 zcmV(zK<2+CP((&8F)lL-CCBWKq6#%2Fd%PYY6?6&FHB`_XLM*FHXtw{QZGhnY;RCu$`1Q^20%lfqE2KDaqK7DECJEw300jTr>-tKs3;+4=-+zDp)BibM|KH)SN z157P_^=rSs*79}b|G@zN7kd528T6iY-ydD`mHH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>8(Vqj!Sz z#2d+$PTm-;59y7hC+?Pg;*I8B$xMAwQF!ALq*K)F@lQ%}|!|+D= z1kfO0oL&Pa7(0Js0kOP3P*WR}@2XL~Y;!kWHgfhU?eIOBth1k{9Xe@xnTl7-(#!5j zA}{Oux!ubG+mpx3X1|f@=w&~+Qmi5N#LLK*!VTv6T4aWEDyw%y9WDuH!bayYujnxot224a&ot0rW8MYYpFEba8n`GL;`Yh?L zn_|CpZ0xoUtqZ#jH$Kp*P57!ABUJoLTk+PxCrvtO3wj6n8OMm%dM`$>8Lu}x#fZS; z88Kso9CL7Pr*^a?QWp|0b#ds%PVFC-3^aBK-ku=8ta#n-mx-81IK_yq&*nMCi1w?# z%6GR#ixJnn+o4VIoBk$ago;=eCG8 zk7#(ZL;K~yY}U29Q~TsD^KQI~_iXCWM*q#EleS3fg%}ZdvlnATL)bA!u*sdiSn~)u z=6%<6YR_+t)P=-LUCf@|sa=h?HA-E~OORi-L4S#U>zGrF*xzjWrJP65lY75B82ib+ zEqgk&&$pTWCS!z(SIg2C^Alu?qPOg}NR}A!aw@-Q^%{or` zUmj)=ULPm%BA{{7%?=NM{>wuiU@U;@?Bk+$1n^Wwdxa*f> diff --git a/org.glite.jp.doc/src/images/LB-JP-interaction-details.pdf b/org.glite.jp.doc/src/images/LB-JP-interaction-details.pdf deleted file mode 100644 index 3241d856dca9bb163dde0ad68d95179d08ab0e80..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72334 zcmV(@K-Rw{P((&8F)lL-CCBWKq6#%2Fd%PYY6?6&FHB`_XLM*FHXtw{QZGhnY;M|TModQS>f z8G*RTKQfB)yd{ZFe=o!_afM(Mkc_@mWy ztC+`k40W|C<-519HuCpK<3}rZ0G|)zI|qDvl!*|aAg&xNKU26YoGkk|y|C1j67h3)3Mq91= z1fU-Lr1#T>{9dyk zM_MEJ&tCLDX!9Ru9@ijyoD2UIL+al>fBm~KX{@mTGrs57Zy`zsBJ%^$J=5NLGP^Ji>?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1P~hpO*b_RV>kQKXFnlG4%*& zVps38t1eyarC!gfms}4eSbPgjN32d;mxMT^CK$*1>%8Occ3VhIP|@9nyWBp2+2Bim z-Ol2?w!9dK-uAWFU6s!dG`fEbT&_u!N#3pxD~Iq&vX{3ukNPLBqmi1q$T^I^k+I2q znXS%`%ZQ&B5gRRLhHxJjB+4HS^9JCq5Kf)|84wus`z$LiB`NtgDD@Ypq$CCj@r8?- zz}( zlL_cgDoBu+zK07EWDEFB)C^z`!g&b5jV=zrdHc&${2$Z5EHz*#m>0tBZx{b!`fq*N z|EvFRo&Ygp6GM==ippP(f7AXKCowZwz;83Ne|wSmw-7gPmjGwDzkrsx2}s)=fkYvl z{XKk9AUSbqQLwlmZrZp+pga&hnz(2PXevm6!7^Y;aXE2$X&EVLoZJxM^8bncG)4Fe zXdwLIUYcfVmbgEC0Adgilown;L&44t1^4!~volZ^(K8Y8zy;SI=KOmk5f?ZL=HZ1D zh5I4}|Cv#+Kim}n2FU}!{~RD0X=zDmkSpk4n5?)g?(R=1$mbtSP8t`)-^c&LWMpv_ z^&gnDr2KziI0ans{Fk0MF1G(+D=YWkW5`M1^8U9T${#l&xc{FeV(t+N2g!rP%n%4% zG5pR9NKDtq6#@F47F=2CYJzM9+7}pk_f>lN^6x&c$Q+K$7yNI;{&yWAQ80hhpP`YJ P082^%czLyq?*je@toEPF diff --git a/org.glite.jp.doc/src/images/LB-JP-interaction-drawing.pdf b/org.glite.jp.doc/src/images/LB-JP-interaction-drawing.pdf deleted file mode 100644 index c5826e1bf32a384ae3df94d8d3cfe189377e2f3f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 167722 zcmZ^~cUV(d*9ZCz20S1o2Lgg5kembz(h)I$B58!Gp@>v9Kok&=U??g&5&}82kRTuy z91^N13J8ek=tq-?4ikbpfMuv7AlQacM@Q!#-|xGB+&?Z4PXft4Ywx}GD!)~>1)Jez z>u9%G$6{vo*D)O(N4x|6a7?1swryJWAxBfWczZVIAXm#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7?s0vjdi=J%78g)5l^2 zZ*_sp0p;QLPdke6HWrZ;Gy6xSLK0nxK&Vd&s{ei`jO%qo0C7HH9m}=T0># zkyg0EuTV(um(tJvlcz@+@A{$>izi<1sm6!76ROG8Q1b`fucE5qPP-;3-X&OmIo$qv zw-@o3Uq25x0_~&ZGXxzXYdAQ`n!lugw;)fSkTpI;7#Sa*@jEVx#>ack)rcdcOym;s zc@aD(WnE_XZw&E>TKcHu_5x_0A0> z_eW~6QR6hyS>f;S=bd9we$wOe(S}s59)aS@W8Y77>t>$B%Hkf2JEk9P7YoG2PeA`>Z=h9a)JPW zf4lyuY#JapXLqm#$n8}Rpayof&;&sY*j^O_ua44Q5Lr#gs~P~n_YdD!IRKlavlHYs z+70kmMxcTE3jMQ$zv=#4Rsdl8TLa)9MYsXj6m2ct00yXkOVmI$0=#B$e;u9U{|V*z zSLi<@CCwma4$jv9lj6TC{r6D3|J(oHb)vGVswo3FME;WY4~qWnsKJZ+H%#N-Svdb~ ze4V$Yy9Ef$AgiVXkhO7kgSc6MZCxM$K2{EH#@9)|Y9JuC&Q4OVTrfxpaI&*=bG-7& z!Nc=LaQYX<#rw+R|G_xv zKRzz@{~Uvh>y^p>iG_g8Y#l)0S8)k|P1Du~1mFj-X*fH-uJ>Q^0c`S4R?dLG%)jnD zc`1MaLyX_$I&ehkM*pcUZW})=p7B2sqrY3l4Ppj{{DT@k9?n-O3$3)O4C;RYb;Q;% diff --git a/org.glite.jp.doc/src/images/isi.pdf b/org.glite.jp.doc/src/images/isi.pdf deleted file mode 100644 index 4ff331cbe7bf18fb7ded3fc20ca7e25c9d9ca6ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 19672 zcmX7uQ*>or*R7)++s=+{R8+BzH@0o3V%xTD+qP}nu1fOfJLhJ$w&ob4_hg}`1oL*oE=RJY+&89T)eGf$hqvUzIBH+1a-na83*0q08?h*?EKc?y1h6kNlNRB zBOuDM1k}pqP?7+mk6HPTiQJ&?gWK2L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gEQYAC97(Cfq(KVDS36^!oF9R*+QS4&&o z;JGM|08lM!kfjQg0LaUgH^}H7Pyk!COe3SW!^t;Pu94;10umYpE(Imvq7P`2+i4wJ zuHva}3VN}Q!0Q^>ZS+Vlw%`S5r!E2AQd&3OnKVG57CnI?rpA^^_DkwI)sIDhxf}%H zqGaI;$^MYg!3Sxp4hZRkIw!PDsY~!SgHjmQowI;EHpLCHCn?tQ0fRLb@`1Yd*Z&+7 zbW5{{i-iv@3W5{9TnJw&g#RVe>>ce0Lq_WG=Apn?J{R?4M{-dHH#~~%#@mX7kl@;m zW`|Hn_ACNi3b~jVvBP&05l|*q#M><7a7D1S$WO@Q1aQS6DC{)?$E91vo&jRmS%i>r z1SSEt7NPDuObp>71mAX~H4SmV@dmdaAt+7)(XtRBs83Y52niwJ9GL_b0tlNSJsC$E z3MGFE9g1{ki`mh<$d3?%REPZ?zw{p_imqhGa8afs8puSKhXc(haV+ZQiP+=0(I9sw z;-EeG`Y{kP8o)qEwj|0hu2$xt1^^-8X_&*ec<9jO;6|s<7djEpWt%aMIEsg9wUY>_ z2QP*lg@up^WGE$*jYV=p7Lc_MZc$>9A6FQ_j^Rgh5gGvvh>GLFcVrz|ANNL)fz+q{ zP@6UwKN&H?ET2nksL^NBnp}8;Al^Rdj>E3zg=lVdH(^K zL`Fg_xqOjC7$xS0T3NZc3=P>C*>sba1e9Kq8Pq8<|FRgh|Ig2=>uN zr%+%%zqHY)kmf5JokWFheC0={zz}_9qmkg%`O45S(;V#o9!sNt zmP0ILM@4gmu!9WIjuq%dP$rKDFC0G22)Z1L;30UAwC}D+%od8Zl_AsZsIbV)e5vm; F!e4Asw7LKQ diff --git a/org.glite.jp.doc/src/jpimporter.tex b/org.glite.jp.doc/src/jpimporter.tex deleted file mode 100644 index cdc1945..0000000 --- a/org.glite.jp.doc/src/jpimporter.tex +++ /dev/null @@ -1,4 +0,0 @@ -\subsection{glite-jp-importer} - -\TODO{glite-jp-importer description} - diff --git a/org.glite.jp.doc/src/jpws.tex b/org.glite.jp.doc/src/jpws.tex deleted file mode 100644 index 7d36708..0000000 --- a/org.glite.jp.doc/src/jpws.tex +++ /dev/null @@ -1,599 +0,0 @@ - -% ------------------------------------------------------------- -% Chapter Job Provenance -% ------------------------------------------------------------- -\chapter{Job Provenance} -\label{id271738}\hypertarget{id271738}{}% - -% ------------------------ -% Section -\section{Primary Storage -- Overview} -\label{id271094}\hypertarget{id271094}{}% - -The Job Provenance (JP) Primary Storage Service is responsible to keep the JP data (definition of submitted jobs, execution conditions and environment, and important points of the job life cycle) in a compact and economic form. - -The JP Primary storage, as described in section 8.4 of the Architecture deliverable DJRA1.1 {\textless}\url{https://edms.cern.ch/document/594698/}{\textgreater} provides public interfaces for data storing, retrieval based on basic metadata, and registration of Index servers for incremental feed. - -Command interface to JP is completely covered by the WS interface covered here. Bulk file transfers are done via specialised protocols, currently gsiftp only. - -% ------------------------ -% Section -\section{Primary Storage -- Operations} -\label{id271756}\hypertarget{id271756}{}% - -{ -\let\dollar=\$ -\catcode`\$=\active -\let$=\dollar -\em{CVS revision: $Header$}} -\subsection{CommitUpload} -\label{op:CommitUpload}\hypertarget{op:CommitUpload}{}% - -Confirm a successfully finished file apload. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{destination}}}}]\null{} -Destination URL returned by StartUpload before. -\end{description} -\noindent - -Outputs: N/A -\subsection{FeedIndex} -\label{op:FeedIndex}\hypertarget{op:FeedIndex}{}% - -Request for feeding a JP Index server (issued by this server). - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{destination}}}}]\null{} -Endpoint of the listening index server. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of xsd:string{\ttfamily\itshape{{attributes}}}}]\null{} -Which attributes of jobs is the index server interested in. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:primaryQuery}{primaryQuery}{\ttfamily\itshape{{conditions}}}}]\null{} -Which jobs is the server interested in. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:boolean{\ttfamily\itshape{{history}}}}]\null{} -Data on jobs stored at PS in the past are required. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:boolean{\ttfamily\itshape{{continuous}}}}]\null{} -Data on jobs that will arrive in future are required. -\end{description} -\noindent - -Outputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{feedId}}}}]\null{} -Unique ID of the created feed session. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:dateTime{\ttfamily\itshape{{feedExpires}}}}]\null{} -When the session expires. -\end{description} -\noindent -\subsection{FeedIndexRefresh} -\label{op:FeedIndexRefresh}\hypertarget{op:FeedIndexRefresh}{}% - -Refresh an existing feed session. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{feedId}}}}]\null{} -Existing feed session ID to be refreshed. -\end{description} -\noindent - -Outputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:dateTime{\ttfamily\itshape{{feedExpires}}}}]\null{} -New session expiration time. -\end{description} -\noindent -\subsection{GetJobAttributes} -\label{op:GetJobAttributes}\hypertarget{op:GetJobAttributes}{}% - -Query concrete attributes of a given job. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{jobid}}}}]\null{} -The job. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of xsd:string{\ttfamily\itshape{{attributes}}}}]\null{} -Which attributes should be retrieved. -\end{description} -\noindent - -Outputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:attrValue}{attrValue}{\ttfamily\itshape{{attrValues}}}}]\null{} -Values of the queried attributes. -\end{description} -\noindent -\subsection{GetJobFiles} -\label{op:GetJobFiles}\hypertarget{op:GetJobFiles}{}% - -Return URL's of files for a given single job. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{jobid}}}}]\null{} -The job. -\end{description} -\noindent - -Outputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:jppsFile}{jppsFile}{\ttfamily\itshape{{files}}}}]\null{} -List of the stored files. -\end{description} -\noindent -\subsection{RecordTag} -\label{op:RecordTag}\hypertarget{op:RecordTag}{}% - -Record an additional user tag. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{jobid}}}}]\null{} -Job to which the tag is added. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:tagValue}{tagValue}{\ttfamily\itshape{{tag}}}}]\null{} -Name and value of the tag. -\end{description} -\noindent - -Outputs: N/A -\subsection{RegisterJob} -\label{op:RegisterJob}\hypertarget{op:RegisterJob}{}% - -Register job with the JP primary storage. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{job}}}}]\null{} -Jobid of the registered job. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{owner}}}}]\null{} -Owner of the job (DN of X509 certificate). -\end{description} -\noindent - -Outputs: N/A -\subsection{StartUpload} -\label{op:StartUpload}\hypertarget{op:StartUpload}{}% - -Start uploading a file. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{job}}}}]\null{} -Jobid to which this file is related. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{class}}}}]\null{} -Type of the file (URI). The server must have a plugin handing this type. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{name}}}}]\null{} -Name of the file (used to distinguish among more files of the same type). -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:dateTime{\ttfamily\itshape{{commitBefore}}}}]\null{} -The client promisses to finish the upload before this time. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{contentType}}}}]\null{} -MIME type of the file. -\end{description} -\noindent - -Outputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{destination}}}}]\null{} -URL where the client should upload the file. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:dateTime{\ttfamily\itshape{{commitBefore}}}}]\null{} -Server's view on when the upload must be finished. -\end{description} -\noindent - -% ------------------------ -% Section -\section{Index Server -- Overview} -\label{id214261}\hypertarget{id214261}{}% - -The Job Provenance (JP) Index Server is a volatile counterpart to the permanent JP Primary Storage. Index servers are populated with subsets of data from Primary storage(s) and indexed according to particular user needs. - -The interface to Index server contains three logical parts: administraive (control), system and user. The administrative part is used by run-time index server configuration tool, the system one allows Primary storage(s) to feed data into the Index server, and the user one is available to users for queries. - -% ------------------------ -% Section -\section{Index Server -- Operations} -\label{id214279}\hypertarget{id214279}{}% - -{ -\let\dollar=\$ -\catcode`\$=\active -\let$=\dollar -\em{CVS revision: $Header$}} -\subsection{AddFeed} -\label{op:AddFeed}\hypertarget{op:AddFeed}{}% - -Called by JP index serve admin tool to ask new primary storage server to feed it. Updates information on PS in index server, according to what JPPS currently knows. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:feedSession}{feedSession}{\ttfamily\itshape{{feed}}}}]\null{} -New feed IS URL, filter and query type. -\end{description} -\noindent - -Outputs: N/A -\subsection{DeleteFeed} -\label{op:DeleteFeed}\hypertarget{op:DeleteFeed}{}% - -Called by JP index serve admin tool to remove one feed session. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{feedId}}}}]\null{} -ID of feed to be removed. -\end{description} -\noindent - -Outputs: N/A -\subsection{GetFeedIDs} -\label{op:GetFeedIDs}\hypertarget{op:GetFeedIDs}{}% - -Called by JP index serve admin tool to find out IS open feeds - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:feedSession}{feedSession}{\ttfamily\itshape{{feeds}}}}]\null{} -List of active feeds on IS. -\end{description} -\noindent - -Outputs: N/A -\subsection{QueryJobs} -\label{op:QueryJobs}\hypertarget{op:QueryJobs}{}% - -User query to index server. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:indexQuery}{indexQuery}{\ttfamily\itshape{{conditions}}}}]\null{} -Query conditions, similar to LB. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of xsd:string{\ttfamily\itshape{{attributes}}}}]\null{} -Set of attributes to be retrieved directly from index server (if any). -\end{description} -\noindent - -Outputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:jobRecord}{jobRecord}{\ttfamily\itshape{{jobs}}}}]\null{} -List of jobs matching the query. -\end{description} -\noindent -\subsection{UpdateJobs} -\label{op:UpdateJobs}\hypertarget{op:UpdateJobs}{}% - -Called by JP primary storage as a response to FeedIndex request. Updates information on jobs in index server, according to what JPPS currently knows. - -Inputs: -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string{\ttfamily\itshape{{feedId}}}}]\null{} -Id of the feed, as returned by JPPS FeedIndex operation. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:boolean{\ttfamily\itshape{{feedDone}}}}]\null{} -Flag of completed batch feed. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:jobRecord}{jobRecord}{\ttfamily\itshape{{jobAttributes}}}}]\null{} -Attributes per job. -\end{description} -\noindent - -Outputs: N/A - -% ------------------------ -% Section -\section{JP Common Types} -\label{id214548}\hypertarget{id214548}{}% - -{ -\let\dollar=\$ -\catcode`\$=\active -\let$=\dollar -\em{CVS revision: $Header$}} -\subsection{attrOrig} -\label{type:attrOrig}\hypertarget{type:attrOrig}{}% - -Specification of attribute origin. - -{\em{Enumeration}} (restriction of xsd:string in WSDL), exactly one of the values must be specified. - -Values: - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{SYSTEM}}}}]\null{} -JP system value, e.g. job owner. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{USER}}}}]\null{} -Explicitely stored by the user via RecordTag operation. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{FILE}}}}]\null{} -Coming from uploaded file. -\end{description} -\noindent \subsection{attrValue} -\label{type:attrValue}\hypertarget{type:attrValue}{}% - -Single value of an attribute. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{name}}}}]\null{} -Name of the attribute, including namespace. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:stringOrBlob}{stringOrBlob} {\ttfamily\itshape{{value}}}}]\null{} -(optional) String value. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:dateTime {\ttfamily\itshape{{timestamp}}}}]\null{} -When this value was recorded. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:attrOrig}{attrOrig} {\ttfamily\itshape{{origin}}}}]\null{} -Where this value came from. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{originDetail}}}}]\null{} -(optional) -\end{description} -\noindent \subsection{feedSession} -\label{type:feedSession}\hypertarget{type:feedSession}{}% - -One session between IS and PS (aka feed) charactetristics. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{primaryServer}}}}]\null{} -URL of primary server. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:primaryQuery}{primaryQuery} {\ttfamily\itshape{{condition}}}}]\null{} -Filter conditions. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:int {\ttfamily\itshape{{history}}}}]\null{} -Query type. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:int {\ttfamily\itshape{{continuous}}}}]\null{} -Query type -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{feedId}}}}]\null{} -(optional) Unique ID of the feed session. -\end{description} -\noindent \subsection{genericFault} -\label{type:genericFault}\hypertarget{type:genericFault}{}% - - - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{source}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:int {\ttfamily\itshape{{code}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{text}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{description}}}}]\null{} -(optional) -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:genericFault}{genericFault} {\ttfamily\itshape{{reason}}}}]\null{} -(optional) -\end{description} -\noindent \subsection{indexQuery} -\label{type:indexQuery}\hypertarget{type:indexQuery}{}% - -Single query condition on a job. Similarly to LB, these outer conditions are logically ANDed. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{attr}}}}]\null{} -Which attribute the condition refers to. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:attrOrig}{attrOrig} {\ttfamily\itshape{{origin}}}}]\null{} -(optional) Specific attribute origin (if we do care). -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:indexQueryRecord}{indexQueryRecord} {\ttfamily\itshape{{record}}}}]\null{} -List of conditions on attribute attr. These conditions are logically ORed. -\end{description} -\noindent \subsection{indexQueryRecord} -\label{type:indexQueryRecord}\hypertarget{type:indexQueryRecord}{}% - -Single condition on an attribute. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:queryOp}{queryOp} {\ttfamily\itshape{{op}}}}]\null{} -Query operation. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:stringOrBlob}{stringOrBlob} {\ttfamily\itshape{{value}}}}]\null{} -(optional) Value to compare attribute with. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:stringOrBlob}{stringOrBlob} {\ttfamily\itshape{{value2}}}}]\null{} -(optional) Value to compare attribute with. -\end{description} -\noindent \subsection{jobRecord} -\label{type:jobRecord}\hypertarget{type:jobRecord}{}% - -Information on a single job. Used for both feeding JP index server from primary storage and to answer user queries on index server. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{jobid}}}}]\null{} -ID of the job. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{owner}}}}]\null{} -Job owner. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of \hyperlink{type:attrValue}{attrValue} {\ttfamily\itshape{{attributes}}}}]\null{} -(optional) Attribute values, required by query/feed and available right now. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{list of xsd:string {\ttfamily\itshape{{primaryStorage}}}}]\null{} -(optional) User query only: which primary storage(s) have data on this job. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:boolean {\ttfamily\itshape{{remove}}}}]\null{} -(optional) UpdateJobs only: this job no longer belongs to the feed. Attribute values are those which caused the change. -\end{description} -\noindent \subsection{jppsFile} -\label{type:jppsFile}\hypertarget{type:jppsFile}{}% - -JP primary storage file identification. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{class}}}}]\null{} -Type of the file (as set on StartUpload). -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{name}}}}]\null{} -Name of the file (if there are more of the same type per job). -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{url}}}}]\null{} -Where the file is stored on JP primary storage. -\end{description} -\noindent \subsection{primaryQuery} -\label{type:primaryQuery}\hypertarget{type:primaryQuery}{}% - -A single condition on job. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{attr}}}}]\null{} -Attribute name to query. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:queryOp}{queryOp} {\ttfamily\itshape{{op}}}}]\null{} -Operation. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:attrOrig}{attrOrig} {\ttfamily\itshape{{origin}}}}]\null{} -(optional) Where the attribute value came from. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:stringOrBlob}{stringOrBlob} {\ttfamily\itshape{{value}}}}]\null{} -Value to compare the job attribute with. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:stringOrBlob}{stringOrBlob} {\ttfamily\itshape{{value2}}}}]\null{} -(optional) Another value (for op = WITHIN). -\end{description} -\noindent \subsection{queryOp} -\label{type:queryOp}\hypertarget{type:queryOp}{}% - -Operators used in queries. Most are self-explanatory. - -{\em{Enumeration}} (restriction of xsd:string in WSDL), exactly one of the values must be specified. - -Values: - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{EQUAL}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{UNEQUAL}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{LESS}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{GREATER}}}}]\null{} - -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{WITHIN}}}}]\null{} -The attribute is between two specified values. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{{\frenchspacing\texttt{{EXISTS}}}}]\null{} -The attribute exists (even having a NULL value). -\end{description} -\noindent \subsection{stringOrBlob} -\label{type:stringOrBlob}\hypertarget{type:stringOrBlob}{}% - - - -{\em{Union}} (choice complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{string}}}}]\null{} -String value. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:base64Binary {\ttfamily\itshape{{blob}}}}]\null{} -Binary value. -\end{description} -\noindent \subsection{tagValue} -\label{type:tagValue}\hypertarget{type:tagValue}{}% - -A single user-recorded value for a job attribute. - -{\em{Structure}} (sequence complex type in WSDL) - -Fields: ( type{\ttfamily\itshape{{name}}} description ) - -\begin{description} -% \null and \mbox are tricks to induce different typesetting decisions -\item[{xsd:string {\ttfamily\itshape{{name}}}}]\null{} -Name of the attribute, including namespace. -% \null and \mbox are tricks to induce different typesetting decisions -\item[{\hyperlink{type:stringOrBlob}{stringOrBlob} {\ttfamily\itshape{{value}}}}]\null{} -(optional) Value. -\end{description} -\noindent diff --git a/org.glite.jp.doc/src/lbjp.bib b/org.glite.jp.doc/src/lbjp.bib deleted file mode 100644 index dd164b4..0000000 --- a/org.glite.jp.doc/src/lbjp.bib +++ /dev/null @@ -1,709 +0,0 @@ - -@InProceedings{ condor, - author = "Michael Litzkow and Miron Livny and Matthew Mutka", - title = "{C}ondor - A Hunter of Idle Workstations", - booktitle = "Proceedings of the 8th International Conference of - Distributed Computing Systems", - year = "1988", - month = "June" -} - -@InProceedings{ gram, - author = "K. Czajkowski and I. Foster and N. Karonis and C. - Kesselman and Martin S. Smith and S. Tuecke", - title = "A resource management architecture for metacomputing - systems.", - booktitle = "Proceedings of the IPPS/SPDP Workshop on Job Scheduling - Strategies for Parallel Processing", - year = "1988", - pages = "62-82" -} - -@InProceedings{ lsf, - author = "S. Zhou", - title = "LSF: Load sharing in large-scale heterogenous distributed - systems", - booktitle = "Proceedings of the Workshop on Cluster Computing", - year = "1992" -} - -@Misc{ dce, - author = "Open Group CAE Specification", - title = "DCE: Remote Procedure Call", - howpublished = "ISBN 1-85912-041-5", - year = "1994" -} - -@Misc{ pbs, - author = "Henderson, R. and Tweten, D", - title = "Portable Batch System: External reference Specification", - howpublished = "NASA, Ames Research Center", - year = "1996" -} - -@Article{ globus, - author = "I. Foster and C. Kesselman", - title = "Globus: a metacomputing infrastructure toolkit.", - journal = "International Journal of Supercomputer Applications", - year = "1997", - volume = "11", - number = "2", - pages = "115-128" -} - -@Misc{ ulm, - author = "J. Abela and T. Debeaupuis", - title = "Universal Format for Logger Messages", - howpublished = "IETF Internet Draft", - year = "1997" -} - -@InProceedings{ autopilot, - author = "R.L. Ribler and J.S. Vetter and H. Simitci and D.A. Reed", - title = "Autopilot: adaptive control of distributed applications", - booktitle = "Proceedings of the Seventh IEEE Symposium on - High-Performance Distributed Computing", - year = "1998", - pages = "172-179" -} - -@InProceedings{ gsi, - author = "I. Foster and C. Kesselman and G. Tsudik and S. Tuecke", - title = "{A Security Architecture for Computational Grids}", - booktitle = "Proceedings of the 5th ACM Conference on Computer and - Communications Security Conference", - year = 1998, - pages = "83-92" -} - -@InProceedings{ classad, - author = "Rajesh Raman and Miron Livny and Marvin Solomon", - title = "Matchmaking: Distributed Resource Management for High - Throughput Computing", - booktitle = "Proceedings of the Seventh IEEE International Symposium on - High Performance Distributed Computing", - year = "1998" -} - -@Article{ nws, - author = "R.Wolski and N. Spring and J. Hayes", - title = "The network weather service: a distributed resource - performance forecasting service for metacomputing", - journal = "J. Future Generation Comput. Syst.", - year = "1999", - volume = "15", - number = "(5/6)", - pages = "757-768" -} - -@Misc{ tls, - author = "T. Dierks and C. Allen", - title = "The {TLS} {P}rotocol {V}ersion 1.0", - howpublished = "IETF RFC 2246 (Standards Track)", - year = 1999, - month = "January" -} - -@Misc{ gssapi, - author = "{J. Linn}", - title = "{Generic Security Service Application Program Interface - Version 2, Update 1}", - howpublished = "IETF RFC 2743", - year = "2000", - month = "January" -} - -@TechReport{ lbdraft, - author = {M. Ruda and A. Krenek and L. Matyska and J. Pospisil and - M. Vocu and J. Sitera}, - title = {Logging and bookkeeping architecture}, - institution = {EU DataGrid}, - year = {2001}, - note = {Part of Deliverable D1.1 WP1 Report on current - technology} -} - -@InProceedings{ mds2, - author = "K. Czajkowski and S. Fitzgerald and I. Foster and C. - Kesselman.", - title = "Grid Information Services for Distributed Resource - Sharing.", - booktitle = " Proceedings of the Tenth IEEE International Symposium on - High-Performance Distributed Computing (HPDC-10)", - year = "2001", - month = "August", - publisher = "IEEE Press" -} - -@Misc{ gma, - author = "B. Tierney and R. Aydt and D. Gunter and W. Smith and - Valerie Taylor and R. Wolski and M. Swany.", - title = "A Grid Monitoring Service Architecture.", - howpublished = "Global Grid Forum Performance Working Group", - year = "2001" -} - -@Misc{ rgma, - author = "S. Fisher", - title = "Relational Model for Information and Monitoring", - howpublished = "Technical Report GWD-Perf-7-1, GGF", - year = "2001" -} - -@InProceedings{ mercury, - author = "Zoltan Balaton and Peter Kacsuk and Norbert Podhorszki and - Ferenc Vajda.", - title = "From Cluster Monitoring to Grid Monitoring Based on GRM", - booktitle = "In proceedings 7th EuroPar2001 Parallel Processings, - Manchester, UK.", - year = "2001", - pages = "874-881" -} - -@Article{ siena, - author = "Antonio Carzaniga and others", - title = "Design and evaluation of a wide-area event notification - service", - journal = "ACM Transactions on Computer Systems", - year = "2001", - volume = "19", - number = "3", - pages = "332-383" -} - -@InProceedings{ maui, - author = "D. Jackson and Q. Snell and M. Clement", - title = "Core algorithms of the Maui scheduler", - booktitle = "Proceedings of the 7th Workshop on Job Scheduling - Strategies for Parallel Processing", - year = "2001" -} - -@Misc{ ggfxml, - author = "W. Smith and D. Gunther and D. Quesnel", - title = "A simple xml producer-consumer protocol", - howpublished = "Grid Working Document GWD-Perf-8-2, Global Grid Forum, - Performance Working Group", - year = "2001" -} - -@TechReport{ lbdraft2, - author = {M. Ruda and A. Krenek and L. Matyska and J. Pospisil and - M. Vocu and J. Sitera}, - title = {Logging and bookkeeping architecture for {D}ata{G}rid - {R}elease 2}, - institution = {EU DataGrid}, - year = {2002}, - note = {Part of Deliverable D1.2 Definition of architecture, - technical plan and evaluation criteria for scheduling, - resource management, security and job description} -} - -@InProceedings{ code, - author = "W. Smith", - title = "A System for Monitoring and Management of Computational - Grids.", - booktitle = "In Proceedings of the 2002 International Conference on - Parallel Processing", - year = "2002" -} - -@Misc{ hawkeye, - title = "HawkEye: A Monitoring and Management Tool for Distributed - Systems", - howpublished = "\url{http://www.cs.wisc.edu/condor/hawkeye}", - year = "2002" -} - -@InProceedings{ chep03, - author = {G. Avellino et.al.}, - title = {{The first deployment of workload management services on - the EU DataGrid testbed: feedback on design and - implementation}}, - booktitle = {Computing in High Energy and Nuclear Physics (CHEP03)}, - year = {2003}, - note = {La Jolla, Ca, USA, March 2003}, - fauthor = {G. Avellino, S. Beco, B. Cantalupo, F. Pacini, A. - Terracina, A. Maraschini, D. Colling, S. Monforte, M. - Pappalardo, L. Salconi, F. Giacomini, E. Ronchieri, D. - Kouril, A. Krenek, L. Matyska, M. Mulac, J. Pospisil, M. - Ruda, Z. Salvet, J. Sitera, M. Vocu, M. Mezzadri, F. Prelz, - A. Gianelle, R. Peluso, M. Sgaravatto, S. Barale, A. - Guarise, A. Werbrouck} -} - -@Article{ alien, - author = "P. Saiz and others", - title = "{AliEn - ALICE environment on the GRID}", - journal = "{Nuclear Instruments and Methods in Physics Research, - Section A}", - year = "2003", - volume = "502", - number = "2-3", - pages = "437-440", - fauthor = { P. Saiz, L. Aphecetche, P. Buncic, R. Piskac, J.E. - Revsbech, V. Sego} -} - -@InProceedings{ rgma2, - author = "A. Cooke and others", - title = "R-GMA: An information integration system for grid - monitoring", - booktitle = "Proc. of the 11th International Conference on Cooperative - Information Systems", - year = "2003" -} - -@InProceedings{ netlogger, - author = "B. Tierney and D. Gunter", - title = "NetLogger: a toolkit for distributed system performance - tuning and debugging", - booktitle = "Proceedings of the IFIP/IEEE Eighth International - Symposium on Integrated Network Management (IM 2003)", - year = "2003", - pages = "97-100", - publisher = "Kluwer", - bolume = "246 of IFIP Conference Proceedings" -} - -@InProceedings{ monalisa, - author = "H.B. Newman and I.C. Legrand and P. Galvez and R. Voicu - and C. Cirstoiu", - title = "MonALISA: a distributed monitoring service architecture", - booktitle = "Computing in High Energy and Nuclear Physics (CHEP03), La - Jolla, CA", - year = "2003" -} - -@InProceedings{ gridrm, - author = "M.A. Baker and G.C. Smith", - title = "GridRM: an extensible resource monitoring system", - booktitle = "Proceedings of the IEEE International Cluster Computing - Conference", - year = "2003", - pages = "207-214" -} - -@InProceedings{ gridlab, - author = "Zoltan Balaton and Gabor Gombas", - title = "Resource and Job Monitoring in the Grid", - booktitle = "Proc. of the Euro-Par 2003 International Conference, - Klagenfurt", - year = 2003 -} - -@Misc{ rgmacms, - author = "D. Bonacorsi and D. Colling and L. Field and S. Fisher and - C. Grandi and P. R. Hobson and P. Kyberd and B. MacEvoy and - J. J. Nebrensky and H. Tallini and S. Traylen", - title = "Scalability Tests of R-GMA Based Grid Job Monitoring - System for CMS Monte Carlo Data Production", - howpublished = "IEEE NSS Conference, Oregon, USA", - year = "2003", - month = "21-24 October" -} - -@Misc{ xacml, - author = "{OASIS Standard}", - title = "{eXtensible Access Control Markup Language (XACML), - Version 1.0}", - year = 2003, - month = "February" -} - -@InProceedings{ gacl1, - author = "L. Cornwall and J. Jensen and D. Kelsey and A. McNab", - title = "{EU DataGrid and GridPP authorization and access control}", - booktitle = "Proceedings of the UK e-Science All Hands Meeting", - year = "2003", - pages = "382--384" -} - -@Misc{ glue, - author = "S. Andreozzi and M. Sgaravatto and C. Vistoli", - title = "Sharing a conceptual model of Grid resources and services", - howpublished = "Proceedings of the Conference for Computing in High Energy - and Nuclear Physics (CHEP03)", - year = "2003" -} - -@InProceedings{ perf, - author = "Xuehai Zhang and Jeffrey L. Freschl and Jennifer M. - Schopf", - title = "A Performance Study of Monitoring and Information Services - for Distributed Systems", - booktitle = "12th IEEE International Symposium on High Performance - Distributed Computing (HPDC-12 '03)", - year = "2003" -} - -@InProceedings{ glite, - author = "E. Laure and F. Hemmer and F. Prelz and S. Beco and S. - Fisher and M. Livny and L. Guy and M. Barroso and P. Buncic - and P. Kunszt and A. {Di Meglio} and A. Aimar and A. Edlund - and D. Groep and F. Pacini and M. Sgaravatto and O. Mulmo", - title = "Middleware for the next generation Grid infrastructure", - booktitle = "Computing in High Energy Physics and Nuclear Physics (CHEP - 2004)", - year = 2004 -} - -@Article{ jgc, - author = {G. Avellino and others}, - title = {{The DataGrid Workload Management System: Challenges and - Results}}, - journal = {Journal of Grid Computing}, - year = {Dec 2004}, - volume = {2}, - number = {4}, - pages = {353--367}, - fauthor = { G. Avellino, S. Beco, B. Cantalupo, A. Maraschini, F. - Pacini, M. Sottilaro, A. Terracina, D. Colling, F. - Giacomini, E. Ronchieri, A. Gianelle, M. Mazzucato, R. - Peluso, M. Sgaravatto, A. Guarise, R. Piro, A. Werbrouck, - D. Kouøil, A. Køenek, L. Matyska, M. Mulaè, J. Pospí¹il, M. - Ruda, Z. Salvet, J. Sitera, J. ©krabal, M. Vocù, M. - Mezzadri, F. Prelz, S. Monforte, M. Pappalardo} -} - -@Misc{ apart, - author = "M. Gerndt and others", - title = "Performance Tools for the {Grid}: State of the Art and - Future", - howpublished = "Tech. Rep. Lehrstuhl fuer Rechnertechnik und - Rechnerorganisation, Technische Universitaet Muenchen - (LRR-TUM). - \url{http://www.lpds.sztaki.hu/~zsnemeth/apart/}", - year = "2004" -} - -@InProceedings{ ahm04194, - author = {Shrija Rajbhandari and David W. Walker}, - title = "{Support for Provenance in a Service-based Computing - Grid}", - booktitle = "{Proceedings of the third UK e-Science All Hands Meeting, - Nottingham, UK}", - year = {2004} -} - -@TechReport{ gro04, - author = {Paul T. Groth}, - title = "{Recording provenance in service-oriented architectures}", - institution = "{University of Southampton; Faculty of Engineering, - Science and Mathematics; School of Electronics and Computer - Science}", - year = {2004} -} - -@InProceedings{ glm04b, - author = {Paul Groth and Michael Luck and Luc Moreau}, - title = "{A protocol for recording provenance in service-oriented - grids}", - booktitle = "{Proceedings of the 8th International Conference on - Principles of Distributed Systems (OPODIS04)}", - year = {2004} -} - -@Article{ ganglia, - author = "M.L. Massie and B.N. Chun and D.E. Culler", - title = "Ganglia Distributed Monitoring System: Design, - Implementation, and Experience", - journal = "Parallel Computing", - year = "2004", - volume = "30", - pages = "817-840" -} - -@Misc{ gae, - author = "Arshad Ali and Ashiq Anjum and Julian Bunn and Richard - Cavanaugh and Frank van Lingen and Richard McClatchey and - Harvey Newman and Waqas ur Rehman and Conrad Steenberg and - Michael Thomas and Ian Willers", - title = "Job Monitoring in an Interactive Grid Analysis - Environment", - howpublished = "Computing in High Energy Physics 2004", - year = "2004" -} - -@InProceedings{ voms1, - author = "R. Alfieri and R. Cecchini and V. Ciaschini and L. - dell'Agnello and \'{A}. Frohner and A. Gianoli and K. - L\H{o}rentey and F. Spataro", - title = "{VOMS}, an {A}uthorization {S}ystem for {V}irtual - {O}rganizations", - booktitle = "Grid Computing: First European Across Grids Conference", - year = "2004" -} - -@InProceedings{ delegation, - author = "V. Welch and I. Foster and C. Kesselman and O. Mulmo and - L. Pearlman and S. Tuecke and J. Gawor and S. Meder and F. - Siebenlist", - title = "{X.509 Proxy Certificates for Dynamic Delegation}", - booktitle = "Proceedings of the 3rd Annual PKI R\&D Workshop", - year = 2004, - month = "April" -} - -@Misc{ proxycert, - author = "S. Tuecke and V. Welch and D. Engert and L. Pearlman and - M. Thompson", - title = "Internet {X}.509 {P}ublic {K}ey {I}nfrastructure ({PKI}) - proxy certificate profile", - howpublished = "IETF RFC 3820", - year = 2004, - month = "June" -} - -@InProceedings{ chep, - author = "D. Kouøil and others", - title = "Distributed Tracking, Storage, and Re-use of Job State - Information on the Grid", - booktitle = "Computing in High Energy and Nuclear Physics (CHEP04)", - year = "2004" -} - -@Misc{ genericlb, - author = "{CESNET JRA1 team}", - title = "Current and Foreseen {\LB}\ Design", - howpublished = "3rd EGEE Conference, Athens, - \url{http://indico.cern.ch/contributionDisplay.py?contribId=201&sessionId=73&confId=0513}" - , - year = 2005 -} - -@InProceedings{ eup1, - author = "Liming Chen and Victor Tan and Fenglian Xu and Alexis - Biller and Paul Groth and Simon Miles and John Ibbotson and - Michael Luck and Luc Moreau", - title = "{A proof of concept: Provenance in a Service Oriented - Architecture}", - booktitle = "{Proceedings of the fourth UK e-Science All Hands Meeting, - Nottingham, UK}", - year = {2005} -} - -@InProceedings{ tgx05, - author = {Paul Townend and Paul Groth and Jie Xu}, - title = "{A provenance-aware weighted fault tolerance scheme for - service-based applications}", - booktitle = "{Proceedings of the $8^{th}$ IEEE International Symposium - on Object-oriented Real-time distributed Computing (ISORC - 2005)}", - year = {2005} -} - -@InProceedings{ mygrid, - author = "M. Nedim Alpdemir and Arijit Mukherjee and Norman W. Paton - and Alvaro A.A. Fernandes and Paul Watson and Kevin Glover - and Chris Greenhalgh and Tom Oinn and Hannah Tipney", - title = "Contextualised Workflow Execution in myGrid", - booktitle = " Proc European Grid Conference , Springer-Verlag LNCS - 3470", - year = 2005, - pages = "444-453" -} - -@Article{ condor2, - author = "Douglas Thain and Todd Tannenbaum and Miron Livny", - title = "Distributed computing in practice: the Condor experience.", - journal = "Concurrency - Practice and Experience", - year = "2005", - volume = "17", - number = "2-4", - pages = "323-356" -} - -@InProceedings{ globus4, - author = "I. Foster", - title = "Globus Toolkit Version 4: Software for Service-Oriented - Systems.", - booktitle = "IFIP International Conference on Network and Parallel - Computing, Springer-Verlag LNCS 3779,", - year = "2005", - pages = "2-13" -} - -@InProceedings{ cgmapisa, - author = "Andrea Ceccanti and Ond\v{r}ej Kraj\'{\i}\v{c}ek and - Ale\v{s} K\v{r}enek and Lud\v{e}k Matyska and Miroslav - Ruda.", - title = "Towards Scalable and Interoperable Grid Monitoring - Infrastructure.", - booktitle = "Proceedings of the first CoreGRID Integration Workshop", - year = "2005", - pages = "10-18" -} - -@InProceedings{ cgma, - author = "Ondøej Krajíèek and Ale¹ Køenek and Ludìk Matyska and - Miroslav Ruda and Jiøí Sitera", - title = "Capability Languages in C-GMA", - booktitle = "Proceedings of Cracow Grid Workshop (CGW05)", - year = "2005" -} - -@Article{ taxonomy, - author = {Serafeim Zanikolas and Rizos Sakellariou}, - title = {A taxonomy of grid monitoring systems}, - journal = {Future Gener. Comput. Syst.}, - year = {2005}, - volume = {21}, - number = {1}, - pages = {163--188}, - issn = {0167-739X}, - doi = {http://dx.doi.org/10.1016/j.future.2004.07.002}, - publisher = {Elsevier Science Publishers B. V.}, - address = {Amsterdam, The Netherlands, The Netherlands} -} - -@Article{ unicore, - author = "Achim Streit and Dietmar Erwin and Thomas Lippert and - Daniel Mallmann and Roger Menday and Michael Rambadt and - Morris Riedel and Mathilde Romberg and Bernd Schuller and - Philipp Wieder", - title = "UNICORE - From Project Results to Production Grids", - journal = "Grid Computing : New Frontiers of High Performance - Computing", - year = "2005", - pages = "357 - 376" -} - -@Article{ voms2, - author = "R. Alfieri and R. Cecchini and V. Ciaschini and L. - dell'Agnello and \'{A}. Frohner and K. L\H{o}rentey and F. - Spataro", - title = "{From gridmap-file to VOMS: managing authorization in a - Grid environment}", - journal = "Future Generation Computer Systems", - year = "2005", - pages = "549-558", - month = "April" -} - -@InProceedings{ cgw05, - author = "F. Dvoøák and D. Kouøil and A. Køenek and L. Matyska and - M. Mulaè and J.Pospi¹il and M. Ruda and Z. Salvet and J. - Sitera and J. ©krabal and M. Vocù ", - title = "Services for Tracking and Archival of Grid Job - Information", - booktitle = "Proceeding of Cracow Grid Workshop", - year = "2005" -} - -@Misc{ rfc4122, - author = "P. Leach and M. Mealling and R. Salz", - title = "A Universally Unique IDentifier (UUID) URN Namespace", - howpublished = "IETF RFC 4122", - year = "2005" -} - -@Misc{ euprovenance, - title = "{EU FP6 Programme Enabling and Supporting Provenance in - Grids for Complex Problems}", - howpublished = "\url{http://twiki.gridprovenance.org/bin/view/Provenance/ProjectInformation}" - , - year = 2006 -} - -@Misc{ atlas, - author = "TODO - predelat na neco poradneho", - title = "{The ATLAS Experiment}", - howpublished = "\url{http://atlas.ch/}", - year = 2006 -} - -@Misc{ ami, - author = "TODO - predelat na neco poradneho", - title = "{The Atlas Metadata Interface}", - howpublished = "\url{https://atlastagcollector.in2p3.fr:8443/AMI/}", - year = 2006 -} - -@Misc{ alice, - author = "TODO - predelat na neco poradneho", - title = "{A Large Ion Collider Experiment}", - howpublished = "\url{http://aliceinfo.cern.ch/Public}", - year = 2006 -} - -@Misc{ sam, - author = "TODO - predelat na neco poradneho", - title = "{SAM (Sequential data Access via Meta-data)}", - howpublished = "\url{http://d0db.fnal.gov/sam/}", - year = 2006 -} - -@InProceedings{ gacl2, - author = "A. McNab and S. Kaushal", - title = "Web services with gridsite and C/C++/scripts", - booktitle = "Computing in High Energy and Nuclear Physics (CHEP 2006)", - year = "2006" -} - -@Misc{ crossgrid, - author = "CrossGrid", - title = "{CrossGrid Project}", - howpublished = "\url{http://www.crossgrid.org}" -} - -@Misc{ dgas, - author = "DGAS", - title = "{The Distributed Grid Accounting System}", - howpublished = "\url{http://www.to.infn.it/grid/accounting/main.html}" -} - -@Misc{ egee, - author = "EGEE", - title = "{Enabling Grids for E-sciencE (EGEE) Project}", - howpublished = "\url{http://lcg.web.cern.ch/LCG/}" -} - -@Misc{ gridice, - author = "EGEE", - title = "{GridIce, the eyes of the Grid}", - howpublished = "\url{http://gridice2.cnaf.infn.it:50080/gridice/}" -} - -@Misc{ djra1.2, - author = {{EGEE JRA1}}, - title = {{EGEE Middleware Design---Release 1}}, - howpublished = {\url{https://edms.cern.ch/document/487871/}} -} - -@Misc{ djra1.3, - author = {{EGEE JRA1}}, - title = {{EGEE Middleware Release 1}}, - howpublished = {\url{https://edms.cern.ch/document/567624/}} -} - -@Misc{ djra1.4, - author = {{EGEE JRA1}}, - title = {{EGEE Middleware Architecture---Release 2}}, - howpublished = {\url{https://edms.cern.ch/document/594698/}} -} - -@Misc{ jra2jobmetrics, - author = "EGEE JRA2", - title = "{Job Metrics}", - howpublished = "\url{http://egee-jra2.web.cern.ch/EGEE-JRA2/QoS/JobsMetrics/JobMetrics.htm}" - -} - -@Misc{ lbug, - author = "A. K\v{r}enek and others", - title = "{L\&B Users Guide}", - howpublished = "\url{https://edms.cern.ch/file/571273/1/LB-guide.pdf}" -} - -@Misc{ lcg, - author = "LCG", - title = "{LHC Computing Project (LCG)}", - howpublished = "\url{http://lcg.web.cern.ch/LCG/}" -} - -@Misc{ pasoa, - title = "{PASOA: Provenance Aware Service Oriented Architecture}", - howpublished = "\url{http://twiki.pasoa.ecs.soton.ac.uk/bin/view/PASOA/AboutPasoa}" - -} diff --git a/org.glite.jp.index/.cvsignore b/org.glite.jp.index/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.jp.index/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.jp.index/Makefile b/org.glite.jp.index/Makefile deleted file mode 100644 index ce2b8f0..0000000 --- a/org.glite.jp.index/Makefile +++ /dev/null @@ -1,178 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -jpprefix=jp -package=glite-jp-index -version=0.0.0 -PREFIX=/opt/glite - -glite_location=/opt/glite -nothrflavour=gcc32 -thrflavour=gcc32pthr -gsoap_prefix=/software/gsoap-2.6 - -CC=gcc - --include Makefile.inc - - -VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/project:${top_srcdir}/doc:${jpproject}:${stagedir}/interface - -DEBUG:=-W -Wall -g -O0 -CPPFLAGS:=-DDEBUG -D_GNU_SOURCE -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include -I${gsoap_prefix}/include -CFLAGS:=${DEBUG} ${CFLAGS} -LDFLAGS:=-L${stagedir}/lib - -dotless_gsoap_ver:=${shell echo ${gsoap_default_version} | tr -d . } -ifeq ($(shell test -f ${stagedir}/lib/libglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}_c.so && echo ok),ok) - langflavour:=_c -endif -GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}${langflavour} - -gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi } - - -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} -INSTALL:=libtool --mode=install install - - -daemon:=glite-jp-indexd -examples:=glite-jpis-test glite-jpis-client -test:=run-test.sh -test_files:=dump1.sql simple_query.in simple_query.out complex_query.in complex_query.out authz.out jobid_query.in jobid_query.out origin_query.in origin_query.out exists_query.in exists_query.out within_query.in within_query.out - -MANS1:=glite-jpis-client.1 -MANS8:=glite-jp-indexd.8 -MANS:=${MANS1} ${MANS8} -HTMLS:=glite-jpis-client.html glite-jp-indexd.html -ws_prefix:=jp_ -is_prefix:=${ws_prefix} -ps_prefix:=${ws_prefix} - -SRCS:= conf.c bones_server.c soap_ops.c soap_ps_calls.c common.c \ - ${is_prefix}Server.c ${ps_prefix}Client.c ${ws_prefix}C.c \ - ws_ps_typeref.c ws_is_typeref.c db_ops.c context.c type_plugin.c - -EXA_TEST_SRCS:=jpis-test.c ${is_prefix}Client.c ${is_prefix}C.c context.c db_ops.c conf.c ws_is_typeref.c common.c -EXA_DB_SRCS:=jpis-db-internal.c db_ops.c conf.c context.c ws_is_typeref.c common.c -EXA_CLIENT_SRCS:=jpis-client.c ${is_prefix}Client.c ${is_prefix}C.c common.c - -OBJS:=${SRCS:.c=.o} -EXA_TEST_OBJS:=${EXA_TEST_SRCS:.c=.o} -EXA_DB_OBJS:=${EXA_DB_SRCS:.c=.o} -EXA_CLIENT_OBJS:=${EXA_CLIENT_SRCS:.c=.o} - - -COMMONLIB:=-lglite_jp_common_${nothrflavour} -SRVCOMMONLIB:=-lglite_jp_server_common -BONESLIB:=-lglite_lbu_server_bones -TRIOLIB:=-lglite_lbu_trio -GSSLIB:=-lglite_security_gss_${nothrflavour} - -default all: compile doc - -compile: ${daemon} ${examples} - -${daemon}: ${OBJS} - ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${SRVCOMMONLIB} ${GSSLIB} - -glite-jpis-test: ${EXA_TEST_OBJS} - ${LINK} -o $@ $+ ${GSOAPLIB} ${COMMONLIB} ${TRIOLIB} ${SRVCOMMONLIB} - -jpis-db-internal: ${EXA_DB_OBJS} - ${LINK} -o $@ $+ ${COMMONLIB} ${SRVCOMMONLIB} - -glite-jpis-client: ${EXA_CLIENT_OBJS} - ${LINK} -o $@ $+ ${GSOAPLIB} ${COMMONLIB} ${TRIOLIB} - -${ws_prefix}Client.c ${ws_prefix}Server.c \ -${ws_prefix}C.c ${ws_prefix}H.h ${ws_prefix}Stub.h: JobProvenance.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ws_prefix} $< - -JobProvenance.xh: jpdev.wsdl - cp ${stagedir}/interface/JobProvenanceTypes.wsdl . - ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< - rm -f JobProvenanceTypes.wsdl - -check: - # ../test/run-test.sh - -doc: ${MANS} ${HTMLS} - -stage: compile doc - ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install - -install: - -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/init.d - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - -mkdir -p ${PREFIX}/examples ${PREFIX}/examples/query-tests - -mkdir -p ${PREFIX}/interface - -mkdir -p ${PREFIX}/share/man/man1 - -mkdir -p ${PREFIX}/share/man/man8 - ${INSTALL} -m 755 ${daemon} ${PREFIX}/bin - ${INSTALL} -m 755 ${examples} ${PREFIX}/examples - ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-indexd - ${INSTALL} -m 755 ${top_srcdir}/config/glite-jp-index-dbsetup.sql ${PREFIX}/etc - ${INSTALL} -m 755 ${top_srcdir}/config/glite-jpis-config.xml ${PREFIX}/etc - ${INSTALL} -m 755 ${top_srcdir}/config/glite-jpis-test-config.xml ${PREFIX}/etc - ${INSTALL} -m 644 ${top_srcdir}/doc/README ${HTMLS} ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${MANS1} ${PREFIX}/share/man/man1 - ${INSTALL} -m 644 ${MANS8} ${PREFIX}/share/man/man8 - ${INSTALL} -m 755 ../examples/query-tests/${test} ${PREFIX}/examples/query-tests - for i in ${test_files}; do \ - ${INSTALL} -m 644 ../examples/query-tests/$$i ${PREFIX}/examples/query-tests; \ - done - ${INSTALL} -m 644 ${top_srcdir}/interface/JobProvenanceISClient.xsd ${PREFIX}/interface - -mkdir -p ${PREFIX}/yaim/functions/ - -mkdir -p ${PREFIX}/yaim/node-info.d - -mkdir -p ${PREFIX}/yaim/defaults - -mkdir -m 0700 -p ${PREFIX}/yaim/examples/siteinfo/services - ${INSTALL} -m 0644 ${top_srcdir}/config/functions/config* ${PREFIX}/yaim/functions - ${INSTALL} -m 0644 ${top_srcdir}/config/node-info.d/glite* ${PREFIX}/yaim/node-info.d - ${INSTALL} -m 0644 ${top_srcdir}/config/defaults/glite* ${PREFIX}/yaim/defaults - ${INSTALL} -m 0600 ${top_srcdir}/config/site-info.def.example ${PREFIX}/yaim/examples/siteinfo/services/glite_jpis - -clean: - rm -rvf *.c *.h *.ch *.xh *.xml *.nsmap *.o *.lo .libs glite-jp* - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ - -soap_ops.o bones_server.o simple_server.o: ${is_prefix}H.h ${ps_prefix}H.h - -soap_ops.o bones_server.o: soap_version.h - -soap_version.h: - ${gsoap_bin_prefix}/soapcpp2 /dev/null - perl -ne '$$. == 2 && /.*([0-9]+)\.([0-9]+)\.([0-9]+)([a-z])?.*/ && printf "#define GSOAP_VERSION %d%02d%02d\n#define GSOAP_VERSION_LETTER '\''".($$4?$$4:"\\0")."'\''\n",$$1,$$2,$$3' soapH.h >$@ - -rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp - -db_ops.h: context.h -context.h: conf.h -db_ops.o: db_ops.c conf.h context.h db_ops.h -context.o: context.c conf.h context.h -soap_ps_calls.o: soap_ps_calls.c ${ps_prefix}H.h ${ps_prefix}.nsmap soap_version.h conf.h db_ops.h ws_ps_typeref.h context.h -soap_ops.o: soap_ops.c jp_H.h ${is_prefix}.nsmap soap_version.h db_ops.h ws_ps_typeref.h ws_is_typeref.h context.h -ws_ps_typeref.o: ws_ps_typeref.c ${ps_prefix}H.h ws_typemap.h ws_ps_typeref.h soap_version.h -ws_is_typeref.o: ws_is_typeref.c ${is_prefix}H.h ws_typemap.h ws_is_typeref.h soap_version.h -jpis-client.o: jpis-client.c ${is_prefix}H.h soap_version.h -jpis-test.o: jpis-client.c ${is_prefix}H.h soap_version.h -conf.o: conf.c ${is_prefix}H.h soap_version.h -common.o: common.h common.c - -${ws_prefix}C.o: ${ws_prefix}C.c - $(CC) -c $(CPPFLAGS) $(CFLAGS) -Wno-unused-parameter $< - -%.1: %.sgml - docbook2man $< - -%.8: %.sgml - docbook2man $< - -%.html: %.sgml - docbook2html $< --nochunks - -.PHONY: default all compile check doc stage dist distsrc distbin install clean diff --git a/org.glite.jp.index/build.xml b/org.glite.jp.index/build.xml deleted file mode 100755 index 3a97943..0000000 --- a/org.glite.jp.index/build.xml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.index/config/dbsetup.sh b/org.glite.jp.index/config/dbsetup.sh deleted file mode 100755 index 3f7a1f9..0000000 --- a/org.glite.jp.index/config/dbsetup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Shell example of preparing the database for JP Index Server -# - -# database -mysqladmin -u root -p create jpis - -# user -mysql -u root -p -e 'GRANT ALL on jpis.* to jpis@localhost' - -# tables -mysql -u jpis jpis < `dirname $0`/glite-jp-index-dbsetup.sql diff --git a/org.glite.jp.index/config/defaults/glite-jpis.pre b/org.glite.jp.index/config/defaults/glite-jpis.pre deleted file mode 100644 index 0bb7e71..0000000 --- a/org.glite.jp.index/config/defaults/glite-jpis.pre +++ /dev/null @@ -1,2 +0,0 @@ -### Default values to some glite-JPIS variables -GLITE_USER=glite diff --git a/org.glite.jp.index/config/functions/config_glite_jpis b/org.glite.jp.index/config/functions/config_glite_jpis deleted file mode 100644 index 0735a32..0000000 --- a/org.glite.jp.index/config/functions/config_glite_jpis +++ /dev/null @@ -1,148 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_jpis -# -# DESCRIPTION : This function configures Job Provenance Index Server. -# -# AUTHORS : LB/JP team, heavily based on glite-yaim-lb -# -# NOTES : -# -# YAIM MODULE: glite-yaim-jpis -# -############################################################################## - - -function config_glite_jpis_check(){ - requires MYSQL_PASSWORD -} - -function config_glite_jpis_setenv(){ - - yaimgridenv_set GLITE_LOCATION ${INSTALL_ROOT:-opt}/glite - yaimgridenv_set GLITE_LOCATION_VAR ${GLITE_LOCATION_VAR:-/var/glite} - yaimgridenv_set GLITE_USER ${GLITE_USER:-glite} - yaimgridenv_set GLITE_HOST_CERT ${GLITE_USER_HOME:-/home/glite}/.certs/hostcert.pem - yaimgridenv_set GLITE_HOST_KEY ${GLITE_USER_HOME:-/home/glite}/.certs/hostkey.pem - yaimgridenv_set X509_CERT_DIR /etc/grid-security/certificates - yaimgridenv_set GLITE_JPIS_PIDFILE ${GLITE_JPIS_PIDFILE:-$GLITE_LOCATION_VAR/glite-jp-indexd.pid} - yaimgridenv_set GLITE_JPIS_LOGFILE ${GLITE_JPIS_LOGFILE:-$GLITE_LOCATION_VAR/glite-jp-indexd.log} - yaimgridenv_set GLITE_JPIS_CONFIG ${GLITE_JPIS_CONFIG:-$GLITE_LOCATION/etc/glite-jpis-config.xml} - yaimgridenv_set GLITE_JPIS_PORT ${GLITE_JPIS_PORT:-8902} - yaimgridenv_set GLITE_JPIS_DB ${GLITE_JPIS_DB:-jpis/@localhost:jpis} - yaimgridenv_set GLITE_JPIS_QT ${GLITE_JPIS_QT:-both} - yaimgridenv_set GLITE_JPIS_AUTH ${GLITE_JPIS_AUTH} - yaimgridenv_set GLITE_JPIS_DEBUG ${GLITE_JPIS_DEBUG} - - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/glite/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/globus/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/c-ares/lib -} - -function config_glite_jpis() { - - ################################################# - # Job Provenance Index Server configuration # - ################################################# - - HOSTNAME=`hostname -f` - - chmod og+rx /var/lib/mysql/ - chown mysql:mysql /var/run/mysqld/ - - # add option --max_allowed_packet=17M - if [ ! -f /etc/my.cnf ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - else - grep "^[mysqld]" /etc/my.cnf > /dev/null - if [ ! $? = 0 ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - fi - fi - - /sbin/chkconfig mysqld on - ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - /etc/init.d/mysqld start - sleep 1 - fi - - ls /tmp/mysql.sock > /dev/null 2>&1 - if [ ! $? = 0 ]; then - ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock - fi - - # set mysql password - set_mysql_passwd || return 1 # the function uses $MYSQL_PASSWORD - - # Check if database exist - mysqlshow --password="$MYSQL_PASSWORD" | grep "jpis" > /dev/null 2>&1 - - if [ ! $? = 0 ]; then - mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE jpis" - mysql --password="$MYSQL_PASSWORD" jpis < ${INSTALL_ROOT}/glite/etc/glite-jp-index-dbsetup.sql - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpis.* to jpis IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpis.* to jpis@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpis.* to jpis@localhost IDENTIFIED BY '' WITH GRANT OPTION;" - else - yaimlog "Database jpis already exists" - fi - - . /opt/glite/etc/profile.d/grid-env.sh - mkdir -p $GLITE_LOCATION_VAR # Needed to store PID of JP IS server - chown $GLITE_USER:$GLITE_USER $GLITE_LOCATION_VAR - chmod 0755 $GLITE_LOCATION_VAR - - mkdir -p $GLITE_USER_HOME/.certs - chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs - chmod 0755 $GLITE_USER_HOME/.certs - cp -f /etc/grid-security/hostcert.pem /etc/grid-security/hostkey.pem $GLITE_USER_HOME/.certs/ - if [ ! $? = 0 ] ; then - echo "Please copy host certificate and key into /etc/grid-security and" - echo " $GLITE_USER_HOME/.certs/, change the owner of the ones in" - echo " $GLITE_USER_HOME/.certs/ to $GLITE_USER" - fi - chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs/hostcert.pem $GLITE_USER_HOME/.certs/hostkey.pem - chmod 0644 $GLITE_USER_HOME/.certs/hostcert.pem - chmod 0400 $GLITE_USER_HOME/.certs/hostkey.pem - - # Start services - if [ ! -f ${GLITE_LOCATION}/etc/gLiteservices ] ; then - touch ${GLITE_LOCATION}/etc/gLiteservices - fi - - grep glite-jp-indexd ${GLITE_LOCATION}/etc/gLiteservices > /dev/null - if [ ! $? = 0 ] ; then - echo "${GLITE_LOCATION}/etc/init.d/glite-jp-indexd" >> ${GLITE_LOCATION}/etc/gLiteservices - fi - - ${GLITE_LOCATION}/etc/init.d/glite-jp-indexd stop - ${GLITE_LOCATION}/etc/init.d/glite-jp-indexd start - - if [ ! $? = 0 ] ; then - yaimlog ABORT "Service glite-jp-indexd failed to start!" - return 1 - fi - - return 0 - -} diff --git a/org.glite.jp.index/config/glite-jp-index-dbsetup.sql b/org.glite.jp.index/config/glite-jp-index-dbsetup.sql deleted file mode 100644 index 34e7565..0000000 --- a/org.glite.jp.index/config/glite-jp-index-dbsetup.sql +++ /dev/null @@ -1,96 +0,0 @@ -create table jobs ( - `jobid` char(32) binary not null, - `dg_jobid` varchar(255) binary not null, - `ownerid` char(32) binary not null, - `aclid` char(32) binary null, - `ps` varchar(255) not null, - - primary key (jobid), - unique (dg_jobid), - index (jobid), - index (dg_jobid) -) character set utf8 collate utf8_bin engine=innodb; - -create table attrs ( - `attrid` char(32) binary not null, - `name` varchar(255) binary not null, - `indexed` int not null, - `type` char(32) binary null, - - primary key (attrid), - index (attrid), - index (name) -) character set utf8 collate utf8_bin engine=innodb; - -create table feeds ( - `uniqueid` int auto_increment not null, - `feedid` char(32) binary unique, - `state` int not null, - `locked` int not null, - `source` varchar(255) not null, - `expires` datetime, - `condition` mediumblob null, - - primary key (uniqueid), - index (uniqueid), - index (feedid), - index (state) -) character set utf8 collate utf8_bin engine=innodb; - -create table acls ( - `aclid` char(32) binary not null, - `value` mediumblob not null, - `refcnt` int not null, - - primary key (aclid) -) character set utf8 collate utf8_bin engine=innodb; - -create table users ( - `userid` char(32) binary not null, - `cert_subj` varchar(255) binary not null, - - primary key (userid), - unique (cert_subj) -) character set utf8 collate utf8_bin engine=innodb; - -# data tables - created one for each configured and indexed attribute, -# in future values of the non-indexed attributes will be stored in attr_values -# -#create table attr_ ( -# `jobid` char(32) binary not null, -# `value` varchar(255) binary not null, -# `full_value` mediumblob not null, -# `origin` int not null, -# -# index (jobid), -# index (value) -#) character set utf8 collate utf8_bin engine=innodb; - - -# ---- future schema improvements ---- - -#create table attr_values ( -# `jobid` char(32), -# `attrid` char(32) binary not null, -# `value` varchar(255) binary not null, -# `full_value` mediumblob not null, -# `origin` int not null, -## `is_multival` int, -# -## primary key (jobid, attrid) -# index (jobid), -# index (attrid), -# index (value) -#) character set utf8 collate utf8_bin engine=innodb; - -#create table attr_multivalues ( -# `jobid` char(32), -# `attrid` char(32) binary not null, -# `value` varchar(255) binary not null, -# `full_value` mediumblob not null, -# `origin` int not null, -# -# index (jobid), -# index (attrid) -# index (value) -#) character set utf8 collate utf8_bin engine=innodb; diff --git a/org.glite.jp.index/config/glite-jpis-config.xml b/org.glite.jp.index/config/glite-jpis-config.xml deleted file mode 100644 index 4c679f5..0000000 --- a/org.glite.jp.index/config/glite-jpis-config.xml +++ /dev/null @@ -1,541 +0,0 @@ - - - - - - - - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:status - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:jobId - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:owner - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:jobtype - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:parentJob - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:seed - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:childrenNum - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:children - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:childrenHist - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:childrenStates - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorId - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:globusId - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:localId - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:jdl - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:matchedJdl - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:destination - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorJdl - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:rsl - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:reason - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:location - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:ceNode - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:networkServer - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:subjobFailed - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:doneCode - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:exitCode - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:resubmitted - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:cancelling - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:cancelReason - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:cpuTime - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:userTags - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:stateEnterTime - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:lastUpdateTime - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:stateEnterTimes - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:expectUpdate - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:expectFrom - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:acl - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:payloadRunning - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:possibleDestinations - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:possibleCeNodes - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:suspended - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:suspendReason - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:failureReasons - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:removeFromProxy - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:uiHost - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:userFqans - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:sandboxRetrieved - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsState - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsQueue - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsOwner - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsName - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsReason - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsScheduler - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsDestHost - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsPid - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsResourceUsage - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsExitStatus - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:pbsErrorDesc - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorStatus - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorUniverse - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorOwner - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorPreempting - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorShadowPid - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorShadowExitStatus - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorStarterPid - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorStarterExitStatus - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorJobPid - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorJobExitStatus - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorDestHost - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorReason - YES - YES - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:condorErrorDesc - YES - YES - - - - - - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:owner - http://egee.cesnet.cz/en/Schema/LB/Attributes:ceNode - http://egee.cesnet.cz/en/Schema/LB/Attributes:status - - - - - - - - - https://localhost:8901 - - - http://egee.cesnet.cz/en/Schema/JP/System:regtime - GREATER - - 0 - - - 1 - 1 - - diff --git a/org.glite.jp.index/config/glite-jpis-test-config.xml b/org.glite.jp.index/config/glite-jpis-test-config.xml deleted file mode 100644 index c5a4d78..0000000 --- a/org.glite.jp.index/config/glite-jpis-test-config.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - NO - YES - - - http://egee.cesnet.cz/en/Schema/JP/System:jobId - NO - YES - - - http://egee.cesnet.cz/en/Schema/JP/System:regtime - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:aTag - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:eNodes - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:RB - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:UIHost - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:CPUTime - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:NProc - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDate - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:retryCount - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:jobType - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:nsubjobs - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:lastStatusHistory - NO - YES - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:fullStatusHistory - NO - YES - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - - - - diff --git a/org.glite.jp.index/config/node-info.d/glite-jpis b/org.glite.jp.index/config/node-info.d/glite-jpis deleted file mode 100644 index 46e4052..0000000 --- a/org.glite.jp.index/config/node-info.d/glite-jpis +++ /dev/null @@ -1,8 +0,0 @@ -JPIS_FUNCTIONS=" -config_add_pool_env -config_crl -config_host_certs -config_edgusers -config_globus_clients -config_glite_jpis -config_glite_initd" diff --git a/org.glite.jp.index/config/site-info.def.example b/org.glite.jp.index/config/site-info.def.example deleted file mode 100644 index 69a571a..0000000 --- a/org.glite.jp.index/config/site-info.def.example +++ /dev/null @@ -1,77 +0,0 @@ -# -# site-info.def example, part for org.glite.jp.index -# -# options configured by YAIM can be overriden by: -# - /etc/glite.conf -# - $GLITE_LOCATION/etc/glite-wms.conf -# - $HOME/.glite.conf # of root user -# - - -# -# required minimum set of YAIM options given from -# /opt/glite/yaim/examples/siteinfo/site-info.def -# -YAIM_LOGGING_LEVEL=INFO -MY_DOMAIN=civ.zcu.cz -INSTALL_ROOT=/opt -CRON_DIR=/etc/cron.d -GLOBUS_TCP_PORT_RANGE="20000,25000" -MYSQL_PASSWORD=set_this_to_a_good_password - - -# -# default values of basic options -# - -#GLITE_LOCATION=${INSTALL_ROOT:-opt}/glite -#GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite} -#GLITE_USER=${GLITE_USER:-glite} -#GLITE_HOST_CERT=${GLITE_USER_HOME:-/home/glite}/.certs/hostcert.pem -#GLITE_HOST_KEY=${GLITE_USER_HOME:-/home/glite}/.certs/hostkey.pem -#X509_CERT_DIR=/etc/grid-security/certificates - - -# -# required external options -# - -#GLOBUS_LOCATION=/opt/globus - - -# -# JPIS configuration default values -# - -# pidfile -#GLITE_JPIS_PIDFILE=$GLITE_LOCATION_VAR/glite-jp-indexd.pid - -# logfile -#GLITE_JPIS_LOGFILE=$GLITE_LOCATION_VAR/glite-jp-indexd.log - -# configuration file -# -# Before launching YAIM you should configure there: -# - feeds (data streams) - contains primary storage and filter -# - attribute set -# - indices set -# -#GLITE_JPIS_CONFIG=$GLITE_LOCATION/etc/glite-jpis-config.xml - -# port -#GLITE_JPIS_PORT=8902 - -# connection string to database (USER/PASSWORD@HOST:DBNAME) -# If the default is changed, the database has to be created manually ! -#GLITE_JPIS_DB=jpis/@localhost:jpis - -# used types of feeds -#GLITE_JPIS_QT="both" - -# Index server returns only jobs owned by given user. -# Use '-n' value to force indexd not to check authentization. -#GLITE_JPIS_AUTH="" - -# Can have '-d' value to force indexd not to deamonize. -# Never use it here. -#GLITE_JPIS_DEBUG="" diff --git a/org.glite.jp.index/config/startup b/org.glite.jp.index/config/startup deleted file mode 100755 index 4680b41..0000000 --- a/org.glite.jp.index/config/startup +++ /dev/null @@ -1,135 +0,0 @@ -#! /bin/sh - -# -# startup script for JP index server -# - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -[ -f $GLITE_LOCATION/etc/jpis.conf ] && . $GLITE_LOCATION/etc/jpis.conf -[ -f $GLITE_LOCATION_VAR/etc/jpis.conf ] && . $GLITE_LOCATION_VAR/etc/jpis.conf - -[ -n "$GLITE_JPIS_PIDFILE" ] || export GLITE_JPIS_PIDFILE=$GLITE_LOCATION_VAR/glite-jp-indexd.pid -[ -n "$GLITE_JPIS_LOGFILE" ] || export GLITE_JPIS_LOGFILE=$GLITE_LOCATION_VAR/glite-jp-indexd.log -pidfile="$GLITE_JPIS_PIDFILE" - -test -n "$GLITE_JPIS_CONFIG" || GLITE_JPIS_CONFIG="$GLITE_LOCATION/etc/glite-jpis-config.xml" -test -n "$GLITE_JPIS_PORT" || GLITE_JPIS_PORT=8902 -test -n "$GLITE_JPIS_DB" || GLITE_JPIS_DB=jpis/@localhost:jpis -test -n "$GLITE_JPIS_QT" || GLITE_JPIS_QT="both" -#GLITE_JPIS_AUTH can have '-n' value to force indexd not to check auth -#GLITE_JPIS_DEBUG can have '-d' value to force indexd not to deamonize - -unset creds port - -start() -{ - if test -z "$GLITE_USER" ;then - echo 'Error: GLITE_USER is not set' - echo FAILED - return 1 - fi - if test -z "$GLOBUS_LOCATION" ;then - echo 'Error: GLOBUS_LOCATION is not set' - echo FAILED - return 1 - fi - if [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] ;then - creds="-c '$GLITE_HOST_CERT' -k '$GLITE_HOST_KEY'" - X509_USER_CERT="$GLITE_HOST_CERT" - X509_USER_KEY="$GLITE_HOST_KEY" - fi - if test -z "$creds"; then - if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then - echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER" - creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem" - X509_USER_CERT=/etc/grid-security/hostcert.pem - X509_USER_KEY=/etc/grid-security/hostkey.pem - fi - fi - - - [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2 - - if [ ! -d "`dirname $GLITE_JPIS_PIDFILE`" ] - then - echo "Directory `dirname $GLITE_JPIS_PIDFILE` does not exist!" - exit 1 - fi - if [ ! -d "`dirname $GLITE_JPIS_LOGFILE`" ] - then - echo "Directory `dirname $GLITE_JPIS_LOGFILE` does not exist!" - exit 1 - fi - - - echo -n Starting glite-jp-indexd ... - #su " $GLITE_LOCATION/bin/glite-jp-indexd \ - su - $GLITE_USER -c " $GLITE_LOCATION/bin/glite-jp-indexd \ - $GLITE_JPIS_DEBUG \ - -q $GLITE_JPIS_QT $creds $GLITE_JPIS_AUTH \ - -m $GLITE_JPIS_DB -p $GLITE_JPIS_PORT \ - -i $GLITE_JPIS_PIDFILE -o $GLITE_JPIS_LOGFILE \ - -x $GLITE_JPIS_CONFIG - " && echo " done" || echo " FAILED" -} - -stop() -{ - if [ -f $pidfile ]; then - pid=`cat $pidfile` - kill $pid - echo -n Stopping glite-jp-indexd \($pid\) ... - try=0 - while ps p $pid >/dev/null 2>&1; do - sleep 1; - try=`expr $try + 1` - if [ $try = 20 ]; then - echo " giving up after $try retries" - return 1 - fi - done - echo " done" - rm -f $pidfile - else - echo $pidfile does not exist - glite-jp-indexd not running? >&2 - return 1 - fi - - return 0 -} - -status() -{ -# if [ -f $pidfile ]; then -# pid=`cat $pidfile` -# if ps p $pid >/dev/null 2>&1; then -# echo glite-jp-indexd running as $pid -# return 0 -# fi -# fi - - retval=0 - if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_JPIS_PORT} .*LISTEN" >/dev/null 2>&1 ;then - echo glite-jp-indexd running - else - echo glite-jp-indexd not running - retval=1 - fi - - return $retval -} - -case x$1 in - xstart) start;; - xstop) stop;; - xrestart) stop; start;; - xstatus) status;; - x*) echo usage: $0 start,stop,restart,status >&2 - exit 1;; -esac diff --git a/org.glite.jp.index/configure b/org.glite.jp.index/configure deleted file mode 100755 index 0bf1a3f..0000000 --- a/org.glite.jp.index/configure +++ /dev/null @@ -1,701 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp.index/doc/README b/org.glite.jp.index/doc/README deleted file mode 100644 index 9b79e28..0000000 --- a/org.glite.jp.index/doc/README +++ /dev/null @@ -1,41 +0,0 @@ -Job Provenance Index Server README -================================== - -JPIS is ... - -For comprehensive documentation about JP see org.glite.jp.doc. - -Source code, executables, dependences -------------------------------------- - -JP-IS CVS module name is org.glite.jp.index. It depends on common JP libraries -(module org.glite.jp.common, org.glite.jp.server-common) and implements -interfaces defined in org.glite.jp.ws-interface. It is also based on -org.glite.lb.server-bones. - -JP-IS consist from one stand-alone daemon (glite-jp-indexd) which is -using MySQL database. Default db name is jpis, all access is granted to -user jpis. - -JP-IS interactions: - -- JP primary storage - feedings data from primary storage to the IS according - to particular IS instance administrator needs (expressed by IS configuration) - -- IS user query interface - implements IS service for end users - -- admin interface - intended for admin tools (management and - on-the-fly configuration changes) - - -Release notes -------------- - -- In this release configuration of JP-IS is rather limited. Parts of - configuration are hard-coded (src/conf.c) - -- Debug outputs are on and directed to /opt/glite/var/log/glite-jp-index.log - file. - -- No admin tools are implemented yet. - diff --git a/org.glite.jp.index/doc/client_conf.xsd b/org.glite.jp.index/doc/client_conf.xsd deleted file mode 100644 index 4101567..0000000 --- a/org.glite.jp.index/doc/client_conf.xsd +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.index/doc/glite-jp-indexd.sgml b/org.glite.jp.index/doc/glite-jp-indexd.sgml deleted file mode 100644 index 4b9ad37..0000000 --- a/org.glite.jp.index/doc/glite-jp-indexd.sgml +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - glite-jp-indexd - 8 - EU EGEE Project - - - - glite-jp-indexd - daemon providing subset of data from Job Provenance - - - - - glite-jp-indexd - - - -h - --help - - - -d - - - -q - --query-type - - hist - cont - both - - - - -k - --key - - - - -c - --cert - - - - - - -n - --no-auth - - - - -m - --mysql - USER/PASSWORD@HOST:DBNAME - - - -p - --port - PORT - - - -i - --pidfile - FILE.PID - - - -o - --logfile - FILE.LOG - - - -x - --config - CONFIG.XML - - - -s - --slaves - N - - - -D - --delete-db - - - - -f - --feeding - FILE - - - -F - --force-feed - - - - - - - DESCRIPTION - -glite-jp-index is stand-alone daemon which is using MySQL database. It provides subset of attributes and jobs from Job Provenance. - - - - - OPTIONS - - -With no options you get simple usage message as with . - - - - - | - -Don't run as daemon, additional diagnostics. - - - - - | - -Type of query: , or (default: ). - - - - hist - history query - - - cont - continuous query - - - both - combination of previous types - - - - - - - | - -Private key file. - - - - - | - -Certification file. - - - - - - - | - -Don't check user identity with result owner. - - - - - | - -Database connect string: USER/PASSWORD@HOST:DBNAME (default: ). - - - - - | - -Port to listen (default: ). - - - - - | - -File to store master pid (default: /var/run/glite-jp-indexd.pid or $HOME/glite-jp-indexd.pid). - - - - - | - -File to store logs (default: /var/run/glite-jp-indexd.log or $HOME/glite-jp-indexd.log). - - - - - | - -Configuration file containing information about feeds, primary storages, ... Structure is defined in server_conf.xsd (default: $GLITE_LOCATION/etc/glite-jpis-config.xml). - - - - - | - -Number of slave processes for responses (default: number of feeds, max. 20). - - - - - | - -Delete and refetch the data in the database. You need use this parameter when feeds from primary storage are already expired. - - - - - | - -Feed the index server from the local file. Format of the file is job per line with attribute values using ";" separator. Attributes go in order according to server configuration file (possible attributes with jobid and owner in configuration file are ignored). - - - - - | - -By default old feeds in the database are untouched when JP index server is restarted, and further used and refreshed. This option forces dropping and reloading feeds from the configuration file. - - - - - - - - - Starting the daemon - -Preferred way of starting the daemon is using start-up script (config/startup). It loads glite.conf file (personal version may be stored in ~/.glite.conf) where many variables may be set to configure the daemon. The script takes following variables: - - - - - GLITE_JPIS_CONFIG - -Specifying config file. Default is $GLITE_LOCATION/etc/glite-jpis-config.xml - - - - - GLITE_JPIS_DEBUG - -Setting to '-d' forces the daemon not to daemonize. - - - - - GLITE_JPIS_QT - -Defines query type (see parameter). - - - - - GLITE_JPIS_AUTH - -Setting to '-n' forces the daemon not to check authorisation. - - - - - GLITE_JPIS_PORT - -Used port (default is 8902). - - - - - GLITE_JPIS_DB - -Database connection string, see parameter. - - - - - GLITE_JPIS_LOGFILE - -Log file (default in startup script is $GLITE_LOCATION_VAR/log/glite-jp-indexd.log). - - - - - GLITE_JPIS_PIDFILE - -Pid file (default is in startup script is $GLITE_LOCATION_VAR/run/glite-jp-indexd.pid). - - - - - - - RETURN VALUE - - - 0 - Success start. - - - - 1 - -Error (database or network initialisation for example). - - - - - - - EXAMPLES - - - configure file for startup script - GLITE_LOCATION_VAR=/opt/glite/var -GLITE_JPIS_DB=jpis/@localhost:jpis -GLITE_JPIS_PORT=8902 -GLITE_JPIS_LOGFILE=$GLITE_LOCATION_VAR/run/glite-jp-indexd.log -GLITE_JPIS_PIDFILE=$GLITE_LOCATION_VAR/run/glite-jp-indexd.pid -GLITE_JPIS_DEBUG=0 -GLITE_JPIS_PS=JPPS:8901 -GLITE_JPIS_QT=cont - - - - - glite-jp-indexd -x /opt/glite/etc/glite-jpis-config-custom.xml -i $HOME/jpis.log -o $HOME/jpis.pid - -Manual run of the JP index server. Use local MySQL database, feeds from job provenances and attributes configured in /opt/glite/etc/glite-jpis-config-custom.xml, listen on default port, store logs and pid to given files. - - - - - - - SEE ALSO - glite-jpis-client(1) - - - - AUTHOR - EU DataGrid Work Package 1, CESNET group. - - - diff --git a/org.glite.jp.index/doc/glite-jpis-client.sgml b/org.glite.jp.index/doc/glite-jpis-client.sgml deleted file mode 100644 index 0593485..0000000 --- a/org.glite.jp.index/doc/glite-jpis-client.sgml +++ /dev/null @@ -1,193 +0,0 @@ - - - - - - glite-jpis-client - 1 - EU EGEE Project - - - - glite-jpis-client - client interface for JP IS - - - - - glite-jpis-client - - - -h - --help - - - - -i - --index-server - JPIS:PORT - - - -q - --query-file - IN_FILE.XML - - - -t - --test-file - IN_FILE.XML - - - -e - --example-file - OUT_FILE.XML - - - -f - --format - - xml - human - - - - - - - DESCRIPTION - -glite-jpis-client is command line interface for querying -the Job Provenance Index Server. It takes the XML input, process the QueryJobs -operation and returns the result in specified format. - - - - - OPTIONS - - -With no options you get simple usage message as with . - - - - - | - -Displays usage message. - - - - - | - -Specifies Job Provenance Index Server as HOST:PORT. - - - - - | - -Process the QueryJobs operation. Requires input data in file -IN_FILE.XML, for using stdin specify -. - -The input and output data are in XML format with XSD schema, which can be found -in JobProvenanceISClient.xsd (element QueryJobs for input -and QueryJobsResponse for output). - - - - - | - -Test the input data from IN_FILE.XML (or from stdin -if is specified) and prints the found content. - - - - - | - -Write the example input data to file OUT_FILE.XML -(or to stdout if is specified). The XML is valid against XSD -schema in JobProvananceISClient.xsd, formating may vary -according to used gsoap version. - - - - - | - -Use FORMAT as output format type. You can specify - for interchangeable XML output or -for nice looking human readable output. - - - - - - - RETURN VALUE - - - 0 - Success. - - - - -1 - Communication error or error from the remote server. - - - - EINVAL - In most cases XML parsing error. - - - - other error - Other error from errno. - - - - - - EXAMPLES - - - glite-jpis-client --example-file query.xml - -Save the example query parameters to file query.xml. - - - - - glite-jpis-client --query-file query.xml - -Queries the local index server running on default port with the query -parameters specified in the file query.xml. - - - - - glite-jpis-client -i localhost:8902 -q - -f human - -Queries the index server running on local host on the port 8902 with the query -parameters from stdin and show results in non-XML form. - - - - - - - - SEE ALSO - glite-jp-indexd(8) - - - - AUTHOR - EU DataGrid Work Package 1, CESNET group. - - - diff --git a/org.glite.jp.index/doc/server_conf.xsd b/org.glite.jp.index/doc/server_conf.xsd deleted file mode 100644 index 16f464d..0000000 --- a/org.glite.jp.index/doc/server_conf.xsd +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.index/examples/jpis-client.c b/org.glite.jp.index/examples/jpis-client.c deleted file mode 100644 index 102d1f0..0000000 --- a/org.glite.jp.index/examples/jpis-client.c +++ /dev/null @@ -1,538 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include - -#include "soap_version.h" - -#include -#include -#include - -#include "jp_.nsmap" -#include "common.h" -#define dprintf(FMT, ARGS...) fprintf(stderr, FMT, ##ARGS); -#include - - -#define DEFAULT_JPIS "http://localhost:8902" -#define USE_GMT 1 - - -static struct option opts[] = { - {"index-server",required_argument, NULL, 'i'}, - {"example-file",required_argument, NULL, 'e'}, - {"query-file", required_argument, NULL, 'q'}, - {"test-file", required_argument, NULL, 't'}, - {"format", required_argument, NULL, 'f'}, - {NULL, 0, NULL, 0} -}; -static const char *get_opt_string = "i:q:e:t:f:"; - -#define NUMBER_OP 6 -struct { - enum jptype__queryOp op; - const char *name; -} operations[] = { - {jptype__queryOp__EQUAL, "=="}, - {jptype__queryOp__UNEQUAL, "<>"}, - {jptype__queryOp__LESS, "<"}, - {jptype__queryOp__GREATER, ">"}, - {jptype__queryOp__WITHIN, "WITHIN"}, - {jptype__queryOp__EXISTS, "EXISTS"}, - {0, "unknown"} -}; - -#define NUMBER_ORIG 3 -struct { - enum jptype__attrOrig orig; - const char *name; -} origins[] = { - {jptype__attrOrig__SYSTEM, "SYSTEM"}, - {jptype__attrOrig__USER, "USER"}, - {jptype__attrOrig__FILE_, "FILE"}, - {0, "unknown"} -}; - -typedef enum {FORMAT_XML, FORMAT_STRIPPEDXML, FORMAT_HR} format_t; - - -/* - * set the value - */ -static void value_set(struct soap *soap, struct jptype__stringOrBlob **value, const char *str) { - *value = soap_malloc(soap, sizeof(**value)); - memset(*value, 0, sizeof(*value)); - GSOAP_SETSTRING(*value, soap_strdup(soap, str)); -} - - -/* - * print the query data in the soap structre - */ -static void value_print(FILE *out, const struct jptype__stringOrBlob *value) { - int i, size, maxsize; - unsigned char *ptr; - - if (value) { - if (GSOAP_ISSTRING(value)) fprintf(out, "%s", GSOAP_STRING(value)); - else if (GSOAP_ISBLOB(value)) { - fprintf(out, "BLOB("); - ptr = GSOAP_BLOB(value)->__ptr; - size = GSOAP_BLOB(value)->__size; - - maxsize = 10; - if (ptr) { - maxsize = size < 10 ? size : 10; - for (i = 0; i < maxsize; i++) fprintf(out, "%02X ", ptr[i]); - if (maxsize < size) fprintf(out, "..."); - } else fprintf(out, "NULL"); - fprintf(out, ")"); - } - } else { - fprintf(out, "-"); - } -} - - -/* - * fill the query soap structure with some example data - */ -static void query_example_fill(struct soap *soap, struct _jpelem__QueryJobs *in) { - struct jptype__indexQuery *cond; - struct jptype__indexQueryRecord *rec; - - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, in, conditions, struct jptype__indexQuery, 2); - - // query status - cond = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, 0); - memset(cond, 0, sizeof(*cond)); - cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); - cond->origin = soap_malloc(soap, sizeof(*(cond->origin))); - *(cond->origin) = jptype__attrOrig__SYSTEM; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, cond, record, struct jptype__indexQueryRecord, 2); - - // equal to Done - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, 0); - memset(rec, 0, sizeof(*rec)); - rec->op = jptype__queryOp__EQUAL; - value_set(soap, &rec->value, "Done"); - - // OR equal to Ready - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, 1); - memset(rec, 0, sizeof(*rec)); - rec->op = jptype__queryOp__EQUAL; - value_set(soap, &rec->value, "Ready"); - - - // AND - // owner - cond = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, 1); - memset(cond, 0, sizeof(*cond)); - cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); - cond->origin = NULL; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, cond, record, struct jptype__indexQueryRecord, 1); - - // not equal to CertSubj - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, 0); - memset(rec, 0, sizeof(*rec)); - rec->op = jptype__queryOp__UNEQUAL; - value_set(soap, &rec->value, "God"); - - - in->__sizeattributes = 4; - in->attributes = soap_malloc(soap, - in->__sizeattributes * - sizeof(*(in->attributes))); - in->attributes[0] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner"); - in->attributes[1] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:jobId"); - in->attributes[2] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); - in->attributes[3] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); - -} - - -/* - * read the XML query - */ -static int query_recv(struct soap *soap, int fd, struct _jpelem__QueryJobs *qj) { - int i; - - memset(qj, 0, sizeof(*qj)); - - soap->recvfd = fd; - soap_begin_recv(soap); - soap_default__jpelem__QueryJobs(soap, qj); - if (!soap_get__jpelem__QueryJobs(soap, qj, "jpelem:QueryJobs", NULL)) { - soap_end_recv(soap); - soap_end(soap); - return EINVAL; - } - soap_end_recv(soap); - - /* strip white-space characters from attributes */ - for (i = 0; i < qj->__sizeattributes; i++) - glite_jpis_trim(qj->attributes[i]); - for (i = 0; i < qj->__sizeconditions; i++) - glite_jpis_trim(GLITE_SECURITY_GSOAP_LIST_GET(qj->conditions, i)->attr); - - return 0; -} - - -/* - * print info from the query soap structure - */ -static void query_print(FILE *out, const struct _jpelem__QueryJobs *in) { - struct jptype__indexQuery *cond; - struct jptype__indexQueryRecord *rec; - int i, j, k; - - fprintf(out, "Conditions:\n"); - for (i = 0; i < in->__sizeconditions; i++) { - cond = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i); - fprintf(out, "\t%s\n", cond->attr); - if (cond->origin) { - for (k = 0; k <= NUMBER_ORIG; k++) - if (origins[k].orig == *(cond->origin)) break; - fprintf(out, "\t\torigin == %s\n", origins[k].name); - } else { - fprintf(out, "\t\torigin IS ANY\n"); - } - for (j = 0; j < cond->__sizerecord; j++) { - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, j); - for (k = 0; k <= NUMBER_OP; k++) - if (operations[k].op == rec->op) break; - fprintf(out, "\t\tvalue %s", operations[k].name); - if (rec->value) { - fprintf(out, " "); - value_print(out, rec->value); - } - if (rec->value2) { - if (!rec->value) fprintf(out, "-"); - fprintf(out, " AND "); - value_print(out, rec->value2); - } - fprintf(out, "\n"); - } - } - fprintf(out, "Attributes:\n"); - for (i = 0; i < in->__sizeattributes; i++) - fprintf(out, "\t%s\n", in->attributes[i]); -} - - -/* - * dump the XML query - */ -static int query_dump(struct soap *soap, int fd, struct _jpelem__QueryJobs *qj) { - int retval; - - soap->sendfd = fd; - soap_begin_send(soap); - soap_serialize__jpelem__QueryJobs(soap, qj); - retval = soap_put__jpelem__QueryJobs(soap, qj, "jpelem:QueryJobs", NULL); - soap_end_send(soap); - write(fd, "\n", strlen("\n")); - - return retval; -} - - -static int query_format(struct soap *soap, format_t format, FILE *f, struct _jpelem__QueryJobs *qj) { - switch (format) { - case FORMAT_XML: - case FORMAT_STRIPPEDXML: - return query_dump(soap, fileno(f), qj); - case FORMAT_HR: query_print(f, qj); return 0; - default: return EINVAL; - } -} - - -/* - * dump the XML query with the example data - */ -static int query_example_dump(struct soap *soap, int fd) { - struct _jpelem__QueryJobs qj; - int retval; - - memset(&qj, 0, sizeof(qj)); - - soap_begin(soap); - query_example_fill(soap, &qj); - retval = query_dump(soap, fd, &qj); - soap_end(soap); - - return retval; -} - - -/* - * dump the data returned from JP IS - */ -static int queryresult_dump(struct soap *soap, int fd, const struct _jpelem__QueryJobsResponse *qjr) { - int retval; - - soap->sendfd = fd; - soap_begin_send(soap); - soap_serialize__jpelem__QueryJobsResponse(soap, qjr); - retval = soap_put__jpelem__QueryJobsResponse(soap, qjr, "QueryJobsResponse", NULL); - soap_end_send(soap); - write(fd, "\n", strlen("\n")); - - return retval; -} - - -/* - * print the data returned from JP IS - */ -static void queryresult_print(FILE *out, const struct _jpelem__QueryJobsResponse *in) { - struct jptype__jobRecord *job; - struct jptype__attrValue *attr; - int i, j, k; - -#if USE_GMT - setenv("TZ","UTC",1); tzset(); -#endif - fprintf(out, "Result %d jobs:\n", in->__sizejobs); - for (j=0; j__sizejobs; j++) { - job = GLITE_SECURITY_GSOAP_LIST_GET(in->jobs, j); - fprintf(out, "\tjobid = %s, owner = %s\n", job->jobid, job->owner); - for (i=0; i__sizeattributes; i++) { - attr = GLITE_SECURITY_GSOAP_LIST_GET(job->attributes, i); - fprintf(out, "\t\t%s\n", attr->name); - fprintf(out, "\t\t\tvalue = "); - value_print(out, attr->value); - fprintf(out, "\n"); - - for (k = 0; k <= NUMBER_ORIG; k++) - if (origins[k].orig == attr->origin) break; - fprintf(out, "\t\t\torigin = %s", origins[k].name); - if (attr->originDetail) fprintf(out, ", %s\n", attr->originDetail); - else fprintf(out, " (no detail)\n"); - if (attr->timestamp != (time_t)0) - fprintf(out, "\t\t\ttime = %s", ctime(&attr->timestamp)); - } - } -} - - -static int queryresult_format(struct soap *soap, format_t format, FILE *f, const struct _jpelem__QueryJobsResponse *qj) { - switch (format) { - case FORMAT_XML: - case FORMAT_STRIPPEDXML: - return queryresult_dump(soap, fileno(f), qj); - case FORMAT_HR: queryresult_print(f, qj); return 0; - default: return EINVAL; - } -} - - -/* - * help screen - */ -static void usage(const char *prog_name) { - fprintf(stderr, "Usage: %s OPTIONS\n", prog_name); - fprintf(stderr, "Options:\n"); - fprintf(stderr, " -h|--help\n"); - fprintf(stderr, " -i|--index-server JPIS:PORT (default: " DEFAULT_JPIS ")\n"); - fprintf(stderr, " -q|--query-file IN_FILE.XML\n"); - fprintf(stderr, " -t|--test-file IN_FILE.XML\n"); - fprintf(stderr, " -e|--example-file OUT_FILE.XML\n"); - fprintf(stderr, " -f|--format xml | strippedxml | human\n"); -} - - -/* - * process the result after calling soap - */ -#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0) - - -int main(int argc, char * const argv[]) { - struct soap soap, soap_comm; - struct _jpelem__QueryJobs qj; - char *server, *example_file, *query_file, *test_file; - const char *prog_name; - int retval, opt, example_fd, query_fd, test_fd; - format_t format = FORMAT_XML; - - prog_name = server = NULL; - example_file = query_file = test_file = NULL; - query_fd = example_fd = test_fd = -1; - retval = 1; - - soap_init(&soap); - soap_set_namespaces(&soap, jp__namespaces); - - /* - * Soap with registered plugin can't be used for reading XML. - * For communications with JP IS glite_gsplugin needs to be registered yet. - */ - soap_init(&soap_comm); - soap_set_namespaces(&soap_comm, jp__namespaces); - soap_register_plugin(&soap_comm, glite_gsplugin); - - /* program name */ - prog_name = strrchr(argv[0], '/'); - if (prog_name) prog_name++; - else prog_name = argv[0]; - - if (argc <= 1) { - usage(prog_name); - goto cleanup; - } - - /* handle arguments */ - while ((opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF) switch (opt) { - case 'i': - free(server); - server = strdup(optarg); - break; - case 'e': - free(example_file); - example_file = strdup(optarg); - break; - case 'q': - free(query_file); - query_file = strdup(optarg); - break; - case 't': - free(test_file); - test_file = strdup(optarg); - break; - case 'f': - if (strcasecmp(optarg, "xml") == 0) format = FORMAT_XML; - else if (strcasecmp(optarg, "strippedxml") == 0) format = FORMAT_STRIPPEDXML; - else format = FORMAT_HR; - break; - default: - usage(prog_name); - goto cleanup; - } - if (optind < argc) { - usage(prog_name); - goto cleanup; - } - if (!server) server = strdup(DEFAULT_JPIS); -#ifdef SOAP_XML_INDENT - if (format != FORMAT_STRIPPEDXML) soap_omode(&soap, SOAP_XML_INDENT); -#endif - - - /* prepare steps according to the arguments */ - if (query_file) { - if (strcmp(query_file, "-") == 0) query_fd = STDIN_FILENO; - else if ((query_fd = open(query_file, 0)) < 0) { - fprintf(stderr, "error opening %s: %s\n", query_file, strerror(errno)); - goto cleanup; - } - free(query_file); - query_file = NULL; - } - if (example_file) { - if (strcmp(example_file, "-") == 0) example_fd = STDOUT_FILENO; - else if ((example_fd = creat(example_file, S_IREAD | S_IWRITE | S_IRGRP)) < 0) { - fprintf(stderr, "error creating %s: %s\n", example_file, strerror(errno)); - goto cleanup; - } - free(example_file); - example_file = NULL; - } - if (test_file) { - if (strcmp(test_file, "-") == 0) test_fd = STDIN_FILENO; - else if ((test_fd = open(test_file, 0)) < 0) { - fprintf(stderr, "error opening %s: %s\n", test_file, strerror(errno)); - goto cleanup; - } - free(test_file); - test_file = NULL; - } - - /* the dump action */ - if (example_fd >= 0) { - if (query_example_dump(&soap, example_fd) != 0) { - fprintf(stderr, "Error dumping example query XML.\n"); - } - } - - /* the test XML file action */ - if (test_fd >= 0) { - soap_begin(&soap); - if (query_recv(&soap, test_fd, &qj) != 0) { - fprintf(stderr, "test: Error getting query XML\n"); - } else { - query_format(&soap, format, stdout, &qj); - } - soap_end(&soap); - } - - /* query action */ - if (query_fd >= 0) { - struct _jpelem__QueryJobs in; - struct _jpelem__QueryJobsResponse out; - int ret; - - soap_begin(&soap); - memset(&in, 0, sizeof(in)); - memset(&out, 0, sizeof(out)); - /* - * Right way would be copy data from client query structure to IS query - * structure. Just ugly retype to client here. - */ - if (query_recv(&soap, query_fd, (struct _jpelem__QueryJobs *)&in) != 0) { - fprintf(stderr, "query: Error getting query XML\n"); - } else { - fprintf(stderr, "query: using JPIS %s\n\n", server); - query_print(stderr, &in); - fprintf(stderr, "\n"); - soap_begin(&soap_comm); - ret = check_fault(&soap_comm, soap_call___jpsrv__QueryJobs(&soap_comm, server, "", &in, &out)); - if (ret == 0) { - queryresult_format(&soap, format, stdout, (struct _jpelem__QueryJobsResponse *)&out); - } else { - soap_end(&soap_comm); - soap_end(&soap); - goto cleanup; - } - soap_end(&soap_comm); - } - soap_end(&soap); - } - - retval = 0; - -cleanup: - soap_done(&soap); - soap_done(&soap_comm); - if (example_fd > STDERR_FILENO) close(example_fd); - if (query_fd > STDERR_FILENO) close(query_fd); - if (test_fd > STDERR_FILENO) close(test_fd); - free(server); - free(example_file); - free(query_file); - free(test_file); - - return retval; -} diff --git a/org.glite.jp.index/examples/jpis-db-internal.c b/org.glite.jp.index/examples/jpis-db-internal.c deleted file mode 100644 index 45a9b42..0000000 --- a/org.glite.jp.index/examples/jpis-db-internal.c +++ /dev/null @@ -1,151 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include - -#include "db_ops.h" - - -static void print_err(glite_jp_context_t ctx) { - glite_jp_error_t *e; - - e = ctx->error; - while(e) { - printf("%s (%s)\n", e->desc, e->source); - e = e->reason; - } - printf("\n"); -} - - -int glite_jpis_db_queries_serialize(void **blob, size_t *len, glite_jp_query_rec_t **queries); -int glite_jpis_db_queries_deserialize(glite_jp_query_rec_t ***queries, void *blob, size_t blob_size); - -int main(int argc, char *argv[]) { -#if 1 - glite_jp_context_t jpctx; - glite_jp_is_conf *conf; - glite_jpis_context_t isctx; - int ret; - long int uniqueid; - char *ps, *feedid; - - jpctx = NULL; - isctx = NULL; - conf = NULL; - glite_jp_init_context(&jpctx); - if (glite_jp_get_conf(argc, argv, NULL, &conf) != 0) goto fail; - if (glite_jpis_init_context(&isctx, jpctx, conf) != 0) goto fail; - if (glite_jpis_init_db(isctx) != 0) goto fail; - - printf("dropping...\n"); - if (glite_jpis_dropDatabase(isctx) != 0) goto faildb; - - printf("initializing...\n"); - if (glite_jpis_initDatabase(isctx) != 0) goto faildb; - - printf("locking...\n"); - do { - if ((ret = glite_jpis_lockUninitializedFeed(isctx, &uniqueid, &ps)) == ENOLCK) goto faildb; - if (ret == 0) { - printf("locked: uniqueid=%li, ps=%s\n", uniqueid, ps); - free(ps); - - asprintf(&feedid, "feed://%lu", uniqueid + 3); - if (glite_jpis_initFeed(isctx, uniqueid, feedid, (time_t)10000) != 0) { - free(feedid); - goto faildb; - } - free(feedid); - - if (glite_jpis_unlockFeed(isctx, uniqueid) != 0) goto faildb; - } - } while (ret == 0); - - if (glite_jpis_tryReconnectFeed(isctx, uniqueid, time(NULL) + 10) != 0) goto faildb; - - glite_jpis_free_db(isctx); - glite_jpis_free_context(isctx); - glite_jp_free_conf(conf); - glite_jp_free_context(jpctx); - - return 0; - -faildb: - glite_jpis_free_db(isctx); -fail: - printf("failed\n"); - glite_jpis_free_context(isctx); - glite_jp_free_conf(conf); - if (jpctx) { - print_err(jpctx); - glite_jp_free_context(jpctx); - } - - return 1; -#endif -#if 0 - glite_jp_context_t ctx; - glite_jp_is_conf *conf; - void *blob; - size_t len; - int ret, i; - glite_jp_query_rec_t **queries; - - ret = 0; - glite_jp_init_context(&ctx); - - if (glite_jp_get_conf(argc, argv, NULL, &conf) != 0) goto fail_ctx; - if ((ret = glite_jpis_db_queries_serialize(&blob, &len, conf->feeds[0]->query)) != 0) goto fail; - - if (write(1, blob, len) != len) { - ret = errno; - free(blob); - goto fail; - } - - if ((ret = glite_jpis_db_queries_deserialize(&queries, blob, len)) != 0) goto fail_blob; - i = 0; - while (queries[i] && queries[i]->attr) { - printf("query: attr=%s, op=%d, value=%s, value2=%s, bin=%d\n", queries[i]->attr, queries[i]->op, queries[i]->value, queries[i]->value2, queries[i]->binary); - free(queries[i]->attr); - free(queries[i]->value); - free(queries[i]->value2); - free(queries[i]); - i++; - } - free(queries); - - free(blob); - glite_jp_free_context(ctx); - return 0; - -fail_blob: - free(blob); -fail: - fprintf(stderr, "fail: %s\n", strerror(ret)); -fail_ctx: - glite_jp_free_context(ctx); - return 1; -#endif -} diff --git a/org.glite.jp.index/examples/jpis-test.c b/org.glite.jp.index/examples/jpis-test.c deleted file mode 100644 index d6ddcb9..0000000 --- a/org.glite.jp.index/examples/jpis-test.c +++ /dev/null @@ -1,255 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include -#include -#include "glite/jobid/strmd5.h" - -#include "jp_H.h" -#include "jp_.nsmap" -#include "db_ops.h" -#include "conf.h" - - -#include "soap_version.h" -#if GSOAP_VERSION <= 20602 -#define soap_call___jpsrv__UpdateJobs soap_call___ns1__UpdateJobs -#define soap_call___jpsrv__QueryJobs soap_call___ns1__QueryJobs -#endif -#define dprintf(FMT, ARGS...) fprintf(stderr, FMT, ##ARGS); -#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0) -#include "glite/jp/ws_fault.c" - - -/* insert simulating FeedIndex call */ -#define INSERT "insert into feeds value ('93', '12345', '8', '0' , 'http://localhost:8901', '2005-10-14 10:48:27', 'COND2');" -#define DELETE "delete from feeds where feedid = '12345';" - - -int main(int argc,char *argv[]) -{ - char *default_server = NULL; - char server[512]; - struct soap *soap = soap_new(); - - soap_init(soap); - soap_set_namespaces(soap, jp__namespaces); - soap_register_plugin(soap,glite_gsplugin); - -/*---------------------------------------------------------------------------*/ - // simulate FeedIndex PS response - { - glite_jp_context_t ctx; - glite_jpis_context_t isctx = NULL; - glite_jp_is_conf *conf; - - - glite_jp_init_context(&ctx); - glite_jp_get_conf(argc, argv, &conf); - if (!conf) { - fprintf(stderr, "Can't gather configuration\n"); - goto end; - } - if (default_server) strcpy(server, default_server); - else snprintf(server, sizeof(server), "http://localhost:%s", conf->port ? conf->port : GLITE_JPIS_DEFAULT_PORT_STR); - printf("JP index server: %s\n", server); - - glite_jpis_init_context(&isctx, ctx, conf); - if (glite_jpis_init_db(isctx) != 0) { - fprintf(stderr, "Connect DB failed: %s (%s)\n", - ctx->error->desc, ctx->error->source); - goto end; - } - - if (glite_jp_db_ExecSQL(ctx, DELETE, NULL) < 0) goto end; - if (glite_jp_db_ExecSQL(ctx, INSERT, NULL) < 0) goto end; - end: - glite_jpis_free_context(isctx); - glite_jp_free_context(ctx); - glite_jp_free_conf(conf); - } - -/*---------------------------------------------------------------------------*/ - // test calls of server functions - // this call is issued by JPPS - { - struct jptype__jobRecord *rec; - struct _jpelem__UpdateJobs in; - struct _jpelem__UpdateJobsResponse out; - struct jptype__attrValue *a; - - memset(&in, 0, sizeof(in)); - memset(&out, 0, sizeof(out)); - - in.feedId = soap_strdup(soap, "12345"); - in.feedDone = GLITE_SECURITY_GSOAP_FALSE; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, &in, jobAttributes, struct jptype__jobRecord, 2); - rec = GLITE_SECURITY_GSOAP_LIST_GET(in.jobAttributes, 0); - { - memset(rec, 0, sizeof(*rec)); - rec->jobid = soap_strdup(soap, "https://localhost:7846/pokus1"); - { - edg_wll_GssCred cred = NULL; - edg_wll_GssStatus gss_code; - - if ( edg_wll_gss_acquire_cred_gsi(NULL, NULL, &cred, &gss_code) ) { - printf("Cannot obtain credentials - exiting.\n"); - return EINVAL; - } - rec->owner = soap_strdup(soap, cred->name); - } - rec->__sizeprimaryStorage = 0; - rec->primaryStorage = NULL; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, rec, attributes, struct jptype__attrValue, 2); - a = GLITE_SECURITY_GSOAP_LIST_GET(rec->attributes, 0); - a->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); - a->value = soap_malloc(soap, sizeof(*(a->value))); - memset(a->value, 0, sizeof(a->value)); - GSOAP_SETSTRING(a->value, soap_strdup(soap, "CertSubj")); - a->timestamp = 333; - a->origin = jptype__attrOrig__SYSTEM; - a->originDetail = NULL; - - a = GLITE_SECURITY_GSOAP_LIST_GET(rec->attributes, 1); - a->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); - a->value = soap_malloc(soap, sizeof(*(a->value))); - memset(a->value, 0, sizeof(a->value)); - GSOAP_SETSTRING(a->value, soap_strdup(soap, "Done")); - a->timestamp = 333; - a->origin = jptype__attrOrig__SYSTEM; - a->originDetail = NULL; - - } - - rec = GLITE_SECURITY_GSOAP_LIST_GET(in.jobAttributes, 1); - { - memset(rec, 0, sizeof(*rec)); - rec->jobid = soap_strdup(soap, "https://localhost:7846/pokus2"); - rec->owner = soap_strdup(soap, "OwnerName"); - rec->__sizeprimaryStorage = 0; - rec->primaryStorage = NULL; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, rec, attributes, struct jptype__jobRecord, 2); - a = GLITE_SECURITY_GSOAP_LIST_GET(rec->attributes, 0); - a->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); - a->value = soap_malloc(soap, sizeof(*(a->value))); - memset(a->value, 0, sizeof(a->value)); - GSOAP_SETSTRING(a->value, soap_strdup(soap, "CertSubj")); - a->timestamp = 333; - a->origin = jptype__attrOrig__USER; - a->originDetail = NULL; - - a = GLITE_SECURITY_GSOAP_LIST_GET(rec->attributes, 1); - a->name = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); - a->value = soap_malloc(soap, sizeof(*(a->value))); - memset(a->value, 0, sizeof(a->value)); - GSOAP_SETSTRING(a->value, soap_strdup(soap, "Ready")); - a->timestamp = 333; - a->origin = jptype__attrOrig__SYSTEM; - a->originDetail = NULL; - } - - check_fault(soap, - soap_call___jpsrv__UpdateJobs(soap,server,"",&in,&out)); - } - -/*---------------------------------------------------------------------------*/ - // this query call issued by user - { - struct _jpelem__QueryJobs in; - struct jptype__indexQuery *cond; - struct jptype__indexQueryRecord *rec; - struct _jpelem__QueryJobsResponse out; - struct jptype__jobRecord *job; - struct jptype__attrValue *attr; - int i, j; - - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, &in, conditions, struct jptype__indexQuery, 2); - - // query status - cond = GLITE_SECURITY_GSOAP_LIST_GET(in.conditions, 0); - memset(cond, 0, sizeof(*cond)); - cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); - cond->origin = NULL; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, cond, record, struct jptype__indexQueryRecord, 2); - - // equal to Done - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, 0); - memset(rec, 0, sizeof(*rec)); - rec->op = jptype__queryOp__EQUAL; - rec->value = soap_malloc(soap, sizeof(*(rec->value))); - memset(rec->value, 0, sizeof(*rec->value)); - GSOAP_SETSTRING(rec->value, soap_strdup(soap, "Done")); - - // OR equal to Ready - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, 1); - memset(rec, 0, sizeof(*rec)); - rec->op = jptype__queryOp__EQUAL; - rec->value = soap_malloc(soap, sizeof(*(rec->value))); - memset(rec->value, 0, sizeof(*rec->value)); - GSOAP_SETSTRING(rec->value, soap_strdup(soap, "Ready")); - - - // AND - // owner - cond = GLITE_SECURITY_GSOAP_LIST_GET(in.conditions, 1); - memset(cond, 0, sizeof(*cond)); - cond->attr = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); - cond->origin = NULL; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, cond, record, struct jptype__indexQueryRecord, 1); - - // not equal to CertSubj - rec = GLITE_SECURITY_GSOAP_LIST_GET(cond->record, 0); - memset(rec, 0, sizeof(*rec)); - rec->op = jptype__queryOp__UNEQUAL; - rec->value = soap_malloc(soap, sizeof(*(rec->value))); - memset(rec->value, 0, sizeof(*rec->value)); - GSOAP_SETSTRING(rec->value, soap_strdup(soap, "God")); - - - in.__sizeattributes = 4; - in.attributes = soap_malloc(soap, - in.__sizeattributes * - sizeof(*(in.attributes))); - in.attributes[0] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:owner"); - in.attributes[1] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/JP/System:jobId"); - in.attributes[2] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus"); - in.attributes[3] = soap_strdup(soap, "http://egee.cesnet.cz/en/Schema/LB/Attributes:user"); - - memset(&out, 0, sizeof(out)); - - check_fault(soap, - soap_call___jpsrv__QueryJobs(soap, server, "",&in,&out)); - - for (j=0; jjobid); - for (i=0; i__sizeattributes; i++) { - attr = GLITE_SECURITY_GSOAP_LIST_GET(job->attributes, i); - printf("\t%s = %s\n", - attr->name, - GSOAP_ISSTRING(attr->value) ? GSOAP_STRING(attr->value) : "binary"); - } - } - } - - return 0; -} diff --git a/org.glite.jp.index/examples/pch06/pch.pm b/org.glite.jp.index/examples/pch06/pch.pm deleted file mode 100644 index 46e5be2..0000000 --- a/org.glite.jp.index/examples/pch06/pch.pm +++ /dev/null @@ -1,237 +0,0 @@ -# -# Job Provenance queries wrapper (Primary and Index queries) -# -# $debug - trace calls -# $err - error status from last query -# - -package pch; - -use strict; -use warnings; -use XML::Twig; -use Data::Dumper; - -our $ps='https://skurut1.cesnet.cz:8901'; -our $is='https://scientific.civ.zcu.cz:8904'; - -our $lbattr='http://egee.cesnet.cz/en/Schema/LB/Attributes'; -our $jpsys='http://egee.cesnet.cz/en/Schema/JP/System'; -our $jpwf='http://egee.cesnet.cz/en/Schema/JP/Workflow'; -our $jplbtag='http://egee.cesnet.cz/en/WSDL/jp-lbtag'; - -our @view_attributes=("$pch::jplbtag:IPAW_STAGE", "$pch::jplbtag:IPAW_PROGRAM", "$pch::jplbtag:IPAW_PARAM", "$pch::jplbtag:IPAW_INPUT", "$pch::jplbtag:IPAW_OUTPUT", "$pch::lbattr:CE", "$pch::lbattr:parent", "$pch::lbattr:host", "$pch::jpsys:regtime"); - - -our $debug = 0; -our $err = 0; - -my $jpis_client_program = "./glite-jpis-client"; -my $jpps_client_program = "./glite-jp-primary-test"; -my @default_is_attributes = ( - "http://egee.cesnet.cz/en/Schema/JP/System:owner", - "http://egee.cesnet.cz/en/Schema/JP/System:jobId", - "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus", - "http://egee.cesnet.cz/en/Schema/LB/Attributes:user", - "http://egee.cesnet.cz/en/WSDL/jp-lbtag:IPAW_PROGRAM", - "http://egee.cesnet.cz/en/Schema/JP/Workflow:ancestor" -); -my @isquery = ( -' - -', -' -' -); - - -my @jobs; - - -# -# query to Job Provenance Index Server -# -sub isquery { - my ($server, $queries, $attributes, $origin) = @_; - my ($s, @jobs); - my $args = ''; - my @attributes; - my $fh; - - $err = 0; - if ($attributes) { @attributes = @$attributes; } - else { @attributes = @default_is_attributes; } - - $s = $isquery[0]; - foreach my $query (@$queries) { - my @query = @$query; - my $i = 1; - $s .= "\n"; - $s .= "\t$query[0]\n"; - while ($i <= $#query) { - my @record = @{$query[$i]}; - $s .= "\t$origin\n" if $origin; - $s .= "\t\n"; - $s .= "\t\t$record[0]\n"; - $s .= "\t\t$record[1]\n"; - $s .= "\t\t$record[2]\n" if ($record[2]); - $s .= "\t\n"; - $i++; - } - $s .= "\n"; - } - - foreach my $attribute (@attributes) { - $s .= "$attribute\n"; - } - $s .= $isquery[1]; - - $args .= "-i $server " if ($server); - $args .= '-q -'; - - if ($debug) { - print STDERR "calling 'echo '$s' | $jpis_client_program $args |'\n"; - } - if (!open($fh, "echo '$s' | $jpis_client_program $args |")) { - print STDERR "Can't execute '$jpis_client_program $args'\n"; - $err = 1; - return (); - } - @jobs = parse_is($fh); -# print STDERR <$fh>; print STDERR "\n"; - close $fh; - if ($?) { - print STDERR "Error returned from $jpis_client_program $args\n"; - $err = 1; - return (); - } - - return @jobs; -} - - -sub parse_is { - my ($fh) = @_; - my $twig; - - @jobs = (); - - $twig = new XML::Twig(TwigHandlers => { jobs => \&jobs_handler }); - if (!$twig->safe_parse($fh)) { $err = 1; return (); } - else { return @jobs; } -} - - -sub jobs_handler { - my($twig, $xmljobs)= @_; - my (%attributes, $xmljobid, $xmlattribute, %job); - %attributes = (); - - $xmljobid = $xmljobs->first_child('jobid'); - die "No jobid on '".$xmljobs->text."'" if (!$xmljobid); - $job{jobid} = $xmljobid->text; - - $xmlattribute = $xmljobs->first_child('attributes'); - while ($xmlattribute) { - my ($xmlname, $xmlvalue, $xmlorigin); - my @values = (); - my @origins = (); - my %attribute = (); - my $nvalues = 0; - - $xmlname = $xmlattribute->first_child('name'); - die "No name on '".$xmlattribute->text."'" if (!$xmlname); -#print $xmljobid->text.": ".$xmlname->text.":\n"; - if (exists $attributes{$xmlname->text}) { - %attribute = %{$attributes{$xmlname->text}}; - } -#print " prev attr: ".Dumper(%attribute)."\n"; - if (exists $attribute{value}) { - @values = @{$attribute{value}}; - } -#print " prev values: ".Dumper(@values)."\n"; - if (exists $attribute{origin}) { - @origins = @{$attribute{origin}}; - } -#print " prev origins: ".Dumper(@origins)."\n"; - $xmlvalue = $xmlattribute->first_child('value'); - while ($xmlvalue) { -#print " to add: ".$xmlvalue->text."\n"; - push @values, $xmlvalue->text; - $xmlvalue = $xmlvalue->next_sibling('value'); - $nvalues = $nvalues + 1; - } - @{$attribute{value}} = @values; -#print " new values: ".Dumper($attribute{value})."\n"; - $xmlorigin = $xmlattribute->first_child('origin'); - for ($nvalues..1) { - if ($xmlorigin and $xmlorigin->text) { push @origins, $xmlorigin->text; } - else { push @origins, undef; } - } - @{$attribute{origin}} = @origins; -#print " new origins: ".Dumper($attribute{origin})."\n"; - $attribute{timestamp} = $xmlattribute->first_child('timestamp')->text; - $xmlattribute = $xmlattribute->next_sibling('attributes'); - - $attributes{$xmlname->text} = \%attribute; - } - $job{attributes} = \%attributes; - - push @jobs, \%job; -} - -# -# query to Job Provenance Primary Storage -# ==> array of string -# -sub psquery { - my ($server, $jobid, $attribute) = @_; - my $args = ''; - my @attrs = (); - my $fh; - - $err = 0; - $args .= "-s $server " if ($server); - $args .= "GetJobAttr $jobid $attribute"; - if ($debug) { - print STDERR "calling '$jpps_client_program $args |'\n"; - } - if (!open($fh, "$jpps_client_program $args |")) { - print STDERR "Can't execute '$jpps_client_program $args'\n"; - $err = 1; - return (); - } - @attrs = parse_ps($fh); - close $fh; - if ($?) { - print STDERR "Error returned from $jpps_client_program $args\n"; - $err = 1; - return (); - } - - return @attrs; -} - - -sub parse_ps { - my ($fh) = @_; - my @attrs = (); - my $attr; - - while (<$fh>) { - chomp; - next if (!$_); - next if (/^OK$/); - next if (/^Attribute values:$/); -# print STDERR "$_\n"; - $attr = $_; - $attr =~ s/\t*//; - $attr =~ s/\t.*//; - push @attrs, $attr; - } - - return @attrs; -} - - -1; diff --git a/org.glite.jp.index/examples/pch06/query1.pl b/org.glite.jp.index/examples/pch06/query1.pl deleted file mode 100644 index 3b48708..0000000 --- a/org.glite.jp.index/examples/pch06/query1.pl +++ /dev/null @@ -1,132 +0,0 @@ -#! /usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# 1. query: -# -# Find the process that led to Atlas X Graphic / everything that caused Atlas X -# Graphic to be as it is. This should tell us the new brain images from which -# the averaged atlas was generated, the warping performed etc. -# -# call: -# ./query1.pl OUTPUT_FILE_NAME 2>/dev/null -# - -use strict; -use pch; -use Data::Dumper; - -my $ps=$pch::ps; -my $is=$pch::is; - -my @according_jobs = (); # sequencially jobid list -my %according_jobs = (); # hash jobid list -my $according_count = 0; -my $output; - - -if ($#ARGV + 1 != 1) { - print STDERR "Usage: $0 OUTPUT_FILE\n"; - exit 1 -} -$output = $ARGV[0]; - -# debug calls -$pch::debug = 0; -my $debug = 0; - -# -# find out processes with given output -# -my @jobs = pch::isquery($is, [ - ["$pch::jplbtag:IPAW_OUTPUT", ['EQUAL', "$output"]], -], ["$pch::jpsys:jobId", "$pch::jpwf:ancestor"]); -print Dumper(@jobs) if ($debug); -die "...so exit on error" if ($pch::err); - -# -# initial set from index server -# -foreach my $job (@jobs) { - my %job = %$job; - my %attributes = %{$job{attributes}}; - - if (!exists $according_jobs{$job{jobid}}) { - push @according_jobs, $job{jobid}; - $according_jobs{$job{jobid}} = 1; - } -} -undef @jobs; - - -# -# collect all jobids (tree browsing) -# -# better implementation will be: using children attribute on LB:parent -# -$according_count = 0; -foreach my $jobid (@according_jobs) { - my @attrs; - - print "Handling $jobid (position $according_count)\n" if ($debug); - @attrs = pch::psquery($ps, $jobid, "$pch::jpwf:ancestor"); - - for my $anc_jobid (@attrs) { - print "Considered: $anc_jobid\n" if ($debug); - if (!exists $according_jobs{$anc_jobid}) { - $according_jobs{$anc_jobid} = 1; - push @according_jobs, $anc_jobid; - print "Added $anc_jobid to $#according_jobs\n" if ($debug); - } - else { - print "Already existing $anc_jobid\n" if ($debug); - } - } - $according_count++; -} - -foreach my $jobid (@according_jobs) { - my @attrs2 = pch::psquery($ps, $jobid, "$pch::jplbtag:IPAW_STAGE"); - $according_jobs{$jobid} = $attrs2[0]; -} - -# -# queries on result set -# -print "Results\n"; -print "=======\n"; -print "\n"; -foreach my $jobid (sort { $according_jobs{$b} <=> $according_jobs{$a} } keys %according_jobs) { - print "jobid $jobid:\n"; - - # query & output all desired atributes - foreach my $attr (@pch::view_attributes) { - my @attrs; - my $attr_name = $attr; $attr_name =~ s/.*://; - - @attrs = pch::psquery($ps, $jobid, $attr); - print " attr $attr_name: "; - if ($attr eq "$pch::jpsys:regtime") { - print gmtime(@attrs[0])." (".join(", ", @attrs).")\n"; - } else { - print join(", ", @attrs)."\n"; - } - } - - print "\n"; -} diff --git a/org.glite.jp.index/examples/pch06/query2.pl b/org.glite.jp.index/examples/pch06/query2.pl deleted file mode 100644 index 767fe15..0000000 --- a/org.glite.jp.index/examples/pch06/query2.pl +++ /dev/null @@ -1,147 +0,0 @@ -#! /usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# 2. query: -# -# Find the process that led to Atlas X Graphic, excluding everything prior to -# the averaging of images with softmean. -# -# call: -# ./query2.pl OUTPUT_FILE_NAME [SOFTMEAN_PROGRAM] 2>/dev/null -# - -use strict; -use pch; -use Data::Dumper; - -my $ps=$pch::ps; -my $is=$pch::is; -my %program_names = (softmean => 1); - -my @according_jobs = (); # sequencially jobid list -my %according_jobs = (); # hash jobid list -my $according_count = 0; -my $output; - - -if ($#ARGV + 1 < 1) { - print STDERR "Usage: $0 OUTPUT_FILE [PROGRAM]\n"; - exit 1 -} -$output = $ARGV[0]; -if ($#ARGV + 1 > 1) { - %program_names = (); - foreach (split(/ */,$ARGV[1])) { - $program_names{$_} = 1; - } -} - -# debug calls -$pch::debug = 0; -my $debug = 0; - -# -# find out processes with given output -# -my @jobs = pch::isquery($is, [ - ["$pch::jplbtag:IPAW_OUTPUT", ['EQUAL', "$output"]], -], ["$pch::jpsys:jobId", "$pch::jpwf:ancestor"]); -print Dumper(@jobs) if ($debug); -die "...so exit on error" if ($pch::err); - -# -# initial set from index server -# -foreach my $job (@jobs) { - my %job = %$job; - my %attributes = %{$job{attributes}}; - - if (!exists $according_jobs{$job{jobid}}) { - push @according_jobs, $job{jobid}; - $according_jobs{$job{jobid}} = 1; - } -} -undef @jobs; - - -# -# collect all jobids (tree browsing), stop on softmean program -# -# note, the browsing tree is really needed here since we explore the workflow -# -$according_count = 0; -foreach my $jobid (@according_jobs) { - my (@attrs, @program); - - print "Handling $jobid (position $according_count)\n" if ($debug); - - # stop on given program name - @program = pch::psquery($ps, $jobid, "$pch::jplbtag:IPAW_PROGRAM"); - die "More program names of $jobid?" if ($#program > 0); - if (exists $program_names{$program[0]}) { - print "$jobid is $program[0], stop here\n" if $debug; - next; - } - - # else browse up - @attrs = pch::psquery($ps, $jobid, "$pch::jpwf:ancestor"); - for my $anc_jobid (@attrs) { - print "Considered: $anc_jobid\n" if ($debug); - if (!exists $according_jobs{$anc_jobid}) { - $according_jobs{$anc_jobid} = 1; - push @according_jobs, $anc_jobid; - print "Added $anc_jobid to $#according_jobs\n" if ($debug); - } - else { - print "Already existing $anc_jobid\n" if ($debug); - } - } - $according_count++; -} - -foreach my $jobid (@according_jobs) { - my @attrs2 = pch::psquery($ps, $jobid, "$pch::jplbtag:IPAW_STAGE"); - $according_jobs{$jobid} = $attrs2[0]; -} - -# -# queries on result set -# -print "Results\n"; -print "=======\n"; -print "\n"; -foreach my $jobid (sort { $according_jobs{$b} <=> $according_jobs{$a} } keys %according_jobs) { - print "jobid $jobid:\n"; - - # query & output all desired atributes - foreach my $attr (@pch::view_attributes) { - my @attrs; - my $attr_name = $attr; $attr_name =~ s/.*://; - - @attrs = pch::psquery($ps, $jobid, $attr); - print " attr $attr_name: "; - if ($attr eq "$pch::jpsys:regtime") { - print gmtime(@attrs[0])." (".join(", ", @attrs).")\n"; - } else { - print join(", ", @attrs)."\n"; - } - } - - print "\n"; -} diff --git a/org.glite.jp.index/examples/pch06/query3.pl b/org.glite.jp.index/examples/pch06/query3.pl deleted file mode 100644 index 90695d7..0000000 --- a/org.glite.jp.index/examples/pch06/query3.pl +++ /dev/null @@ -1,140 +0,0 @@ -#! /usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# 3. query: -# -# Find the Stage 3, 4 and 5 details of the process that led to Atlas X Graphic. -# -# call: -# ./query3.pl OUTPUT_FILE_NAME 2>/dev/null -# - -use strict; -use pch; -use Data::Dumper; - -my $ps=$pch::ps; -my $is=$pch::is; -my @attributes = ("$pch::jpsys:jobId", "$pch::jpwf:ancestor", @pch::view_attributes); - -my @according_jobs = (); # sequencially jobid list -my %according_jobs = (); # hash jobid list -my $according_count = 0; -my $output; - - -if ($#ARGV + 1 != 1) { - print STDERR "Usage: $0 OUTPUT_FILE\n"; - exit 1 -} -$output = $ARGV[0]; - -# debug calls -$pch::debug = 0; -my $debug = 0; - -# -# find out processes with given output -# -my @jobs = pch::isquery($is, [ - ["$pch::jplbtag:IPAW_OUTPUT", ['EQUAL', "$output"]], -], \@attributes); -die "...so exit on error" if ($pch::err); -print Dumper(@jobs) if ($debug); - -# -# initial set from index server -# -foreach my $job (@jobs) { - my %job = %$job; - my %attributes = %{$job{attributes}}; - - if (!exists $according_jobs{$job{jobid}}) { - push @according_jobs, $job{jobid}; - $according_jobs{$job{jobid}} = \%job; - } -} -undef @jobs; - - -# -# collect all jobs (tree browsing) -# -$according_count = 0; -foreach my $jobid (@according_jobs) { - my @ancs; - - print "Handling $jobid (position $according_count)\n" if ($debug); - @ancs = pch::isquery($is, [["$pch::jpwf:successor", ['EQUAL', "$jobid"]]], \@attributes); - die "...so exit on error" if ($pch::err); - - for my $anc (@ancs) { - my %anc = %$anc; - print "Considered: $anc{jobid}\n" if ($debug); - if (!exists $according_jobs{$anc{jobid}}) { - $according_jobs{$anc{jobid}} = \%anc; - push @according_jobs, $anc{jobid}; - print "Added $anc{jobid} to $#according_jobs\n" if ($debug); - } - else { - print "Already existing $anc{jobid}\n" if ($debug); - } - } - $according_count++; -} - - -# -# queries on result set -# -print "Results\n"; -print "=======\n"; -print "\n"; -foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] <=> $according_jobs{$a}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] } keys %according_jobs) { - my %job = %{$according_jobs{$jobid}}; - my %attributes = %{$job{attributes}}; - my $stage = $attributes{"$pch::jplbtag:IPAW_STAGE"}{value}[0]; - -# if ( $stage == 3 || $stage == 4 || $stage == 5) { - if ( $stage == 2 || $stage == 3) { - print "jobid $jobid:\n"; - - # query & output all desired atributes - foreach my $attr (@pch::view_attributes) { - my $attr_name = $attr; $attr_name =~ s/.*://; - - print " attr $attr_name: "; - if (exists $attributes{$attr}) { - my %attr = %{$attributes{$attr}}; - - if ($attr eq "$pch::jpsys:regtime") { - print gmtime($attr{value}[0])." (".join(", ", @{$attr{value}}).")\n"; - } else { - print join(", ", @{$attr{value}})."\n"; - } - } else { - print "N/A\n"; - } - } - - print "\n"; - } else { - print "(ignored $jobid with stage $stage)\n" if $debug; - } -} diff --git a/org.glite.jp.index/examples/pch06/query4.pl b/org.glite.jp.index/examples/pch06/query4.pl deleted file mode 100644 index b3c96c8..0000000 --- a/org.glite.jp.index/examples/pch06/query4.pl +++ /dev/null @@ -1,150 +0,0 @@ -#! /usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# 4. query: -# -# Find all invocations of procedure align_warp using a twelfth order nonlinear -# 1365 parameter model (see model menu describing possible values of parameter -# "-m 12" of align_warp) that ran on a Monday. -# -# call: -# ./query4.pl [PROGRAMS [PARAMS]] 2>/dev/null -# - -use strict; -use pch; -use Data::Dumper; - -my $ps=$pch::ps; -my $is=$pch::is; -my %program_names=(align_warp => 1); -my $program_params='-m 12'; -my $runday=3; -#my $runday=4; -my @attributes = ("$pch::jpsys:jobId", @pch::view_attributes); - -my %according_jobs = (); # hash jobid list -my $according_count = 0; - - -# debug calls -$pch::debug = 0; -my $debug = 0; - -if ($#ARGV + 1 >= 1) { - %program_names = (); - foreach (split(/ */, $ARGV[0])) { - $program_names{$_} = 1; - } -} -if ($#ARGV + 1 >= 2) { - $program_params=$ARGV[1]; -} - - -# -# find out processes with given name ant parameters -# -my @query_programs = (); -foreach (keys %program_names) { - my @qitem = ['EQUAL', "$_"]; - push @query_programs, @qitem; -} -my @jobs = pch::isquery($is, [ - ["$pch::jplbtag:IPAW_PROGRAM", @query_programs], - ["$pch::jplbtag:IPAW_PARAM", ['EQUAL', "$program_params"]], -], \@attributes); -print Dumper(@jobs) if ($debug); -die "...so exit on error" if ($pch::err); - - -# -# check found all jobs -# -$according_count = 0; -foreach my $job (@jobs) { - my %job = %$job; - my (@time, @timesep, @origin); - my $itime; - - print "Handling $job{jobid} ($according_count.)\n" if ($debug); - - # search first regtime with origin USER, - # be satisfied with first regime too if no value has USER origin - @time = @{$job{attributes}{"$pch::jpsys:regtime"}{value}}; - @origin = @{$job{attributes}{"$pch::jpsys:regtime"}{origin}}; - @timesep = (); - foreach $itime (0..$#time) { -#print "check ".$time[$itime]." ".$origin[$itime]."\n"; - if ($origin[$itime] eq 'USER') { - @timesep = gmtime($time[$itime]); - last; - } - } - if ($#timesep == -1) { @timesep = gmtime($time[0]); } -#print join(',', @timesep)."\n"; - - if ($timesep[6] == $runday) { - if (!exists $according_jobs{$job{jobid}}) { - $according_jobs{$job{jobid}} = \%job; - print "Added $job{jobid}\n" if $debug; - } else { - print "Already existing $job{jobid}\n" if $debug; - } - } else { - print "Job $job{jobid} ran at day $timesep[6] (0=Sun, ...): ".gmtime($time[0])."\n" if $debug; - } - - $according_count++; -} -undef @jobs; - - -# -# print the result set -# -print "Results\n"; -print "=======\n"; -print "\n"; -foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] <=> $according_jobs{$a}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] } keys %according_jobs) { - my %job = %{$according_jobs{$jobid}}; - my %attributes = %{$job{attributes}}; - - print "jobid $jobid:\n"; - - # output all desired atributes - foreach my $attr (@pch::view_attributes) { - my $attr_name = $attr; $attr_name =~ s/.*://; - - print " attr $attr_name: "; - if (exists $attributes{$attr}) { - my %attr = %{$attributes{$attr}}; - - if ($attr eq "$pch::jpsys:regtime") { - print gmtime($attr{value}[0])." (".join(", ", @{$attr{value}}).")\n"; - } else { - print join(", ", @{$attr{value}})."\n"; - } - } else { - print "N/A\n"; - } - } - - print "\n"; -} diff --git a/org.glite.jp.index/examples/pch06/query5.pl b/org.glite.jp.index/examples/pch06/query5.pl deleted file mode 100644 index 604d735..0000000 --- a/org.glite.jp.index/examples/pch06/query5.pl +++ /dev/null @@ -1,142 +0,0 @@ -#! /usr/bin/perl -W -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# 5. query: -# -# Find all Atlas Graphic images outputted from workflows where at least one of -# the input Anatomy Headers had an entry global maximum=4095. The contents of -# a header file can be extracted as text using the scanheader AIR utility. -# -# call: -# ./query5.pl [PROGRAMS] [END_PROGRAMS] [HEADER] 2>/dev/null -# - -use strict; -use pch; -use Data::Dumper; - -my $ps=$pch::ps; -my $is=$pch::is; -my %program_names=(align_warp => 1); -my %end_program_names=(convert => 1); -my $header="GLOBAL_MAXIMUM=4095"; # test for exact equal (scripts already prepared it) - -my @according_jobs = (); # sequencially jobid list -my %according_jobs = (); # hash jobid list - - -# debug calls -$pch::debug = 0; -my $debug = 0; - -if ($#ARGV + 1 >= 1) { - %program_names = (); - foreach (split(/ */, $ARGV[0])) { - $program_names{$_} = 1; - } -} -if ($#ARGV + 1 >= 2) { - %end_program_names = (); - foreach (split(/ */, $ARGV[1])) { - $end_program_names{$_} = 1; - } -} -if ($#ARGV + 1 >= 3) { - $header = $ARGV[2]; -} - - -# -# find out processes with given name and parameters -# -my @query_programs = (); -foreach (keys %program_names) { - my @qitem = ['EQUAL', "$_"]; - push @query_programs, @qitem; -} -my @jobs = pch::isquery($is, [ - ["$pch::jplbtag:IPAW_PROGRAM", @query_programs], - ["$pch::jplbtag:IPAW_HEADER", ['EQUAL', "$header"]], -], \@pch::view_attributes); -print STDERR Dumper(@jobs) if ($debug); -die "...so exit on error" if ($pch::err); - -# -# collect all jobs (tree browsing down) -# -foreach my $job (@jobs) { - my %job = %$job; - my $jobid = $job{jobid}; - my @succs; - my $pname; - - $pname = $job{attributes}{"$pch::jplbtag:IPAW_PROGRAM"}{value}[0]; - print "Handling $jobid ($pname)\n" if ($debug); - - if (exists $end_program_names{$pname}) { - print "It's $pname\n" if $debug; - if (!exists $according_jobs{$jobid}) { - $according_jobs{$jobid} = \%job; - push @according_jobs, $jobid; - print "Added $jobid to $#according_jobs\n" if ($debug); - } - else { - print "Already existing $jobid\n" if ($debug); - } - next; - } - - @succs = pch::isquery($is, [["$pch::jpwf:ancestor", ['EQUAL', "$jobid"]]], \@pch::view_attributes); - die "...so exit on error" if ($pch::err); - push @jobs, @succs; -} - - -# -# print the result set -# -print "Results\n"; -print "=======\n"; -print "\n"; -foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] <=> $according_jobs{$a}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] } keys %according_jobs) { - my %job = %{$according_jobs{$jobid}}; - my %attributes = %{$job{attributes}}; - - print "jobid $jobid:\n"; - - # output all desired atributes - foreach my $attr (@pch::view_attributes) { - my $attr_name = $attr; $attr_name =~ s/.*://; - - print " attr $attr_name: "; - if (exists $attributes{$attr}) { - my %attr = %{$attributes{$attr}}; - - if ($attr eq "$pch::jpsys:regtime") { - print gmtime($attr{value}[0])." (".join(", ", @{$attr{value}}).")\n"; - } else { - print join(", ", @{$attr{value}})."\n"; - } - } else { - print "N/A\n"; - } - } - - print "\n"; -} diff --git a/org.glite.jp.index/examples/pch06/query6.pl b/org.glite.jp.index/examples/pch06/query6.pl deleted file mode 100644 index f03a806..0000000 --- a/org.glite.jp.index/examples/pch06/query6.pl +++ /dev/null @@ -1,172 +0,0 @@ -#! /usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# 6. query: -# -# Find all output averaged images of softmean (average) procedures, where the -# warped images taken as input were align_warped using a twelfth order -# nonlinear 1365 parameter model, i.e. "where softmean was preceded in the -# workflow, directly or indirectly, by an align_warp procedure with argument -# -m 12. -# -# call: -# ./query6.pl [PROGRAMS [END_PROGRAMS] [PARAM] ]2>/dev/null -# - -use strict; -use pch; -use Data::Dumper; - -my $ps=$pch::ps; -my $is=$pch::is; -my %program_names=(align_warp=>1); -my $program_param='-m 12'; -my %end_program_names=(softmean=>1); - -#my %jobs = (); # just information cache -my @workflow_jobs = (); # sequencially jobid list -my %workflow_jobs = (); # hash jobid list -my @according_jobs = (); # sequencially jobid list -my %according_jobs = (); # hash jobid list -my $workflow_count = 0; - - -# debug calls -$pch::debug = 0; -my $debug = 0; - -if ($#ARGV + 1 >= 1) { - %program_names = (); - foreach (split(/ */, $ARGV[0])) { - $program_names{$_} = 1; - } -} -if ($#ARGV + 1 >= 2) { - %end_program_names = (); - foreach (split(/ */, $ARGV[1])) { - $end_program_names{$_} = 1; - } -} -if ($#ARGV + 1 >= 3) { - $program_param=$ARGV[2]; -} - -# -# find out processes with given name and parameters -# -my @query_programs = (); -foreach (keys %program_names) { - my @qitem = ['EQUAL', "$_"]; - push @query_programs, @qitem; -} -my @jobs = pch::isquery($is, [ - ["$pch::jplbtag:IPAW_PROGRAM", @query_programs], - ["$pch::jplbtag:IPAW_PARAM", ['EQUAL', "$program_param"]], -], ["$pch::jpwf:successor", @pch::view_attributes]); -print Dumper(@jobs) if ($debug); -die "...so exit on error" if ($pch::err); - -# -# initial set of starting jobs from index server -# (root jobs) -# -foreach my $job (@jobs) { - my %job = %$job; - my %attributes = %{$job{attributes}}; - my $jobid = $job{jobid}; - - if (!exists $workflow_jobs{$jobid}) { - push @workflow_jobs, $jobid; - $workflow_jobs{$jobid} = \%job; - } -} -undef @jobs; - - -# -# collect all jobs (tree browsing down) -# -$workflow_count = 0; -foreach my $jobid (@workflow_jobs) { - my @succs; - my $pname; - - print "Handling $jobid (position $workflow_count)\n" if ($debug); - print " progname: ".$workflow_jobs{$jobid}{attributes}{"$pch::jplbtag:IPAW_PROGRAM"}{value}[0]."\n" if ($debug); - - $pname = $workflow_jobs{$jobid}{attributes}{"$pch::jplbtag:IPAW_PROGRAM"}{value}[0]; - if (exists $end_program_names{$pname}) { - print "It's $pname, adding\n" if $debug; - $according_jobs{$jobid} = \%{$workflow_jobs{$jobid}}; - next; - } - - @succs = pch::isquery($is, [["$pch::jpwf:ancestor", ['EQUAL', "$jobid"]]], \@pch::view_attributes); - die "...so exit on error" if ($pch::err); - - for my $succ (@succs) { - my %succ = %$succ; - print "Considered: $succ{jobid}\n" if ($debug); - if (!exists $workflow_jobs{$succ{jobid}}) { - $workflow_jobs{$succ{jobid}} = \%succ; - push @workflow_jobs, $succ{jobid}; - print "Added $succ{jobid} to $#workflow_jobs\n" if ($debug); - } - else { - print "Already existing $succ{jobid}\n" if ($debug); - } - } - $workflow_count++; -} -undef @workflow_jobs; -undef %workflow_jobs; - - -# -# print the result set -# -print "Results\n"; -print "=======\n"; -print "\n"; -foreach my $jobid (sort { $according_jobs{$b}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] <=> $according_jobs{$a}{attributes}{"$pch::jplbtag:IPAW_STAGE"}{value}[0] } keys %according_jobs) { - my %job = %{$according_jobs{$jobid}}; - my %attributes = %{$job{attributes}}; - - print "jobid $jobid:\n"; - - # output all desired atributes - foreach my $attr (@pch::view_attributes) { - my $attr_name = $attr; $attr_name =~ s/.*://; - - print " attr $attr_name: "; - if (exists $attributes{$attr}) { - my %attr = %{$attributes{$attr}}; - - if ($attr eq "$pch::jpsys:regtime") { - print gmtime($attr{value}[0])." (".join(", ", @{$attr{value}}).")\n"; - } else { - print join(", ", @{$attr{value}})."\n"; - } - } else { - print "N/A\n"; - } - } - - print "\n"; -} diff --git a/org.glite.jp.index/examples/query-tests/authz.out b/org.glite.jp.index/examples/query-tests/authz.out deleted file mode 100644 index 53ff341..0000000 --- a/org.glite.jp.index/examples/query-tests/authz.out +++ /dev/null @@ -1,14 +0,0 @@ -query: using JPIS http://localhost:10000 - -Conditions: - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - origin IS ANY - value == Ready -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - -OK -Result 0 jobs: diff --git a/org.glite.jp.index/examples/query-tests/complex_query.in b/org.glite.jp.index/examples/query-tests/complex_query.in deleted file mode 100644 index 3dd8f22..0000000 --- a/org.glite.jp.index/examples/query-tests/complex_query.in +++ /dev/null @@ -1,36 +0,0 @@ - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - - EQUAL - - Done - - - - EQUAL - - Ready - - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - - UNEQUAL - - God - - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - - - diff --git a/org.glite.jp.index/examples/query-tests/complex_query.out b/org.glite.jp.index/examples/query-tests/complex_query.out deleted file mode 100644 index 69971c1..0000000 --- a/org.glite.jp.index/examples/query-tests/complex_query.out +++ /dev/null @@ -1,36 +0,0 @@ -query: using JPIS http://localhost:10000 - -Conditions: - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - origin IS ANY - value == Done - value == Ready - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - origin IS ANY - value <> God -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - -OK -Result 2 jobs: - jobid = https://localhost:7846/pokus1, owner = /O=CESNET/O=Masaryk University/CN=Milos Mulac - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Done - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - jobid = https://localhost:7846/pokus2, owner = OwnerName - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Ready - origin = SYSTEM (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = SYSTEM (no detail) - time = Thu Jan 1 02:00:01 1970 diff --git a/org.glite.jp.index/examples/query-tests/dump1.sql b/org.glite.jp.index/examples/query-tests/dump1.sql deleted file mode 100644 index 0fd7cea..0000000 --- a/org.glite.jp.index/examples/query-tests/dump1.sql +++ /dev/null @@ -1,594 +0,0 @@ --- MySQL dump 10.8 --- --- Host: localhost Database: jpis1test --- ------------------------------------------------------ --- Server version 4.1.7-max-log - -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; -/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; -/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE="NO_AUTO_VALUE_ON_ZERO" */; - --- --- Current Database: `jpis1test` --- - -CREATE DATABASE /*!32312 IF NOT EXISTS*/ `jpis1test`; - -USE `jpis1test`; - --- --- Table structure for table `acls` --- - -DROP TABLE IF EXISTS `acls`; -CREATE TABLE `acls` ( - `aclid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` mediumblob NOT NULL, - `refcnt` int(11) NOT NULL default '0', - PRIMARY KEY (`aclid`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `acls` --- - - -/*!40000 ALTER TABLE `acls` DISABLE KEYS */; -LOCK TABLES `acls` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `acls` ENABLE KEYS */; - --- --- Table structure for table `attr_ac7ea0b2cd17deedbc569733597059ae` --- - -DROP TABLE IF EXISTS `attr_ac7ea0b2cd17deedbc569733597059ae`; -CREATE TABLE `attr_ac7ea0b2cd17deedbc569733597059ae` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_ac7ea0b2cd17deedbc569733597059ae` --- - - -/*!40000 ALTER TABLE `attr_ac7ea0b2cd17deedbc569733597059ae` DISABLE KEYS */; -LOCK TABLES `attr_ac7ea0b2cd17deedbc569733597059ae` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_ac7ea0b2cd17deedbc569733597059ae` ENABLE KEYS */; - --- --- Table structure for table `attr_5de12c1776c3130b9d27a7502a13e11c` --- - -DROP TABLE IF EXISTS `attr_5de12c1776c3130b9d27a7502a13e11c`; -CREATE TABLE `attr_5de12c1776c3130b9d27a7502a13e11c` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_5de12c1776c3130b9d27a7502a13e11c` --- - - -/*!40000 ALTER TABLE `attr_5de12c1776c3130b9d27a7502a13e11c` DISABLE KEYS */; -LOCK TABLES `attr_5de12c1776c3130b9d27a7502a13e11c` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_5de12c1776c3130b9d27a7502a13e11c` ENABLE KEYS */; - --- --- Table structure for table `attr_f496f5d872a2d04ee626045477f340db` --- - -DROP TABLE IF EXISTS `attr_f496f5d872a2d04ee626045477f340db`; -CREATE TABLE `attr_f496f5d872a2d04ee626045477f340db` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_f496f5d872a2d04ee626045477f340db` --- - - -/*!40000 ALTER TABLE `attr_f496f5d872a2d04ee626045477f340db` DISABLE KEYS */; -LOCK TABLES `attr_f496f5d872a2d04ee626045477f340db` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_f496f5d872a2d04ee626045477f340db` ENABLE KEYS */; - --- --- Table structure for table `attr_34d7a9e823c6948d525362d2709bdfcd` --- - -DROP TABLE IF EXISTS `attr_34d7a9e823c6948d525362d2709bdfcd`; -CREATE TABLE `attr_34d7a9e823c6948d525362d2709bdfcd` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_34d7a9e823c6948d525362d2709bdfcd` --- - - -/*!40000 ALTER TABLE `attr_34d7a9e823c6948d525362d2709bdfcd` DISABLE KEYS */; -LOCK TABLES `attr_34d7a9e823c6948d525362d2709bdfcd` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_34d7a9e823c6948d525362d2709bdfcd` ENABLE KEYS */; - --- --- Table structure for table `attr_824794b00ee73be550f893b99ceaa643` --- - -DROP TABLE IF EXISTS `attr_824794b00ee73be550f893b99ceaa643`; -CREATE TABLE `attr_824794b00ee73be550f893b99ceaa643` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_824794b00ee73be550f893b99ceaa643` --- - - -/*!40000 ALTER TABLE `attr_824794b00ee73be550f893b99ceaa643` DISABLE KEYS */; -LOCK TABLES `attr_824794b00ee73be550f893b99ceaa643` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_824794b00ee73be550f893b99ceaa643` ENABLE KEYS */; - --- --- Table structure for table `attr_ac1e0e146f3e1bee11d6e40d07e60abb` --- - -DROP TABLE IF EXISTS `attr_ac1e0e146f3e1bee11d6e40d07e60abb`; -CREATE TABLE `attr_ac1e0e146f3e1bee11d6e40d07e60abb` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_ac1e0e146f3e1bee11d6e40d07e60abb` --- - - -/*!40000 ALTER TABLE `attr_ac1e0e146f3e1bee11d6e40d07e60abb` DISABLE KEYS */; -LOCK TABLES `attr_ac1e0e146f3e1bee11d6e40d07e60abb` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_ac1e0e146f3e1bee11d6e40d07e60abb` ENABLE KEYS */; - --- --- Table structure for table `attr_7636d6368c1cf53bc5511241cac9751f` --- - -DROP TABLE IF EXISTS `attr_7636d6368c1cf53bc5511241cac9751f`; -CREATE TABLE `attr_7636d6368c1cf53bc5511241cac9751f` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_7636d6368c1cf53bc5511241cac9751f` --- - - -/*!40000 ALTER TABLE `attr_7636d6368c1cf53bc5511241cac9751f` DISABLE KEYS */; -LOCK TABLES `attr_7636d6368c1cf53bc5511241cac9751f` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_7636d6368c1cf53bc5511241cac9751f` ENABLE KEYS */; - --- --- Table structure for table `attr_64ea5318d74aca823630ba9ca38971e0` --- - -DROP TABLE IF EXISTS `attr_64ea5318d74aca823630ba9ca38971e0`; -CREATE TABLE `attr_64ea5318d74aca823630ba9ca38971e0` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_64ea5318d74aca823630ba9ca38971e0` --- - - -/*!40000 ALTER TABLE `attr_64ea5318d74aca823630ba9ca38971e0` DISABLE KEYS */; -LOCK TABLES `attr_64ea5318d74aca823630ba9ca38971e0` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_64ea5318d74aca823630ba9ca38971e0` ENABLE KEYS */; - --- --- Table structure for table `attr_81a1d6b95da954e977f22f78417b98a8` --- - -DROP TABLE IF EXISTS `attr_81a1d6b95da954e977f22f78417b98a8`; -CREATE TABLE `attr_81a1d6b95da954e977f22f78417b98a8` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_81a1d6b95da954e977f22f78417b98a8` --- - - -/*!40000 ALTER TABLE `attr_81a1d6b95da954e977f22f78417b98a8` DISABLE KEYS */; -LOCK TABLES `attr_81a1d6b95da954e977f22f78417b98a8` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_81a1d6b95da954e977f22f78417b98a8` ENABLE KEYS */; - --- --- Table structure for table `attr_e6c0fb3b99f16296db2623c02f0d5c6f` --- - -DROP TABLE IF EXISTS `attr_e6c0fb3b99f16296db2623c02f0d5c6f`; -CREATE TABLE `attr_e6c0fb3b99f16296db2623c02f0d5c6f` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_e6c0fb3b99f16296db2623c02f0d5c6f` --- - - -/*!40000 ALTER TABLE `attr_e6c0fb3b99f16296db2623c02f0d5c6f` DISABLE KEYS */; -LOCK TABLES `attr_e6c0fb3b99f16296db2623c02f0d5c6f` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_e6c0fb3b99f16296db2623c02f0d5c6f` ENABLE KEYS */; - --- --- Table structure for table `attr_474e4207c49813e09915732c80c0e1cc` --- - -DROP TABLE IF EXISTS `attr_474e4207c49813e09915732c80c0e1cc`; -CREATE TABLE `attr_474e4207c49813e09915732c80c0e1cc` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_474e4207c49813e09915732c80c0e1cc` --- - - -/*!40000 ALTER TABLE `attr_474e4207c49813e09915732c80c0e1cc` DISABLE KEYS */; -LOCK TABLES `attr_474e4207c49813e09915732c80c0e1cc` WRITE; -INSERT INTO `attr_474e4207c49813e09915732c80c0e1cc` VALUES ('593e62a063231f8c623b74406b3e12b0','CertSubj','S:7201:F::CertSubj',3),('9276789a0093ad44457655ef03ade36a','CertSubj','S:7201:S::CertSubj',2); -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_474e4207c49813e09915732c80c0e1cc` ENABLE KEYS */; - --- --- Table structure for table `attr_e2d5742f6e917ea2e949d49b9fa0c1b3` --- - -DROP TABLE IF EXISTS `attr_e2d5742f6e917ea2e949d49b9fa0c1b3`; -CREATE TABLE `attr_e2d5742f6e917ea2e949d49b9fa0c1b3` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_e2d5742f6e917ea2e949d49b9fa0c1b3` --- - - -/*!40000 ALTER TABLE `attr_e2d5742f6e917ea2e949d49b9fa0c1b3` DISABLE KEYS */; -LOCK TABLES `attr_e2d5742f6e917ea2e949d49b9fa0c1b3` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_e2d5742f6e917ea2e949d49b9fa0c1b3` ENABLE KEYS */; - --- --- Table structure for table `attr_941ae4f469950ed63ad19822dbcf5427` --- - -DROP TABLE IF EXISTS `attr_941ae4f469950ed63ad19822dbcf5427`; -CREATE TABLE `attr_941ae4f469950ed63ad19822dbcf5427` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_941ae4f469950ed63ad19822dbcf5427` --- - - -/*!40000 ALTER TABLE `attr_941ae4f469950ed63ad19822dbcf5427` DISABLE KEYS */; -LOCK TABLES `attr_941ae4f469950ed63ad19822dbcf5427` WRITE; -INSERT INTO `attr_941ae4f469950ed63ad19822dbcf5427` VALUES ('593e62a063231f8c623b74406b3e12b0','Done','S:7201:F::Done',3),('9276789a0093ad44457655ef03ade36a','Ready','S:7201:S::Ready',1); -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_941ae4f469950ed63ad19822dbcf5427` ENABLE KEYS */; - --- --- Table structure for table `attr_97b3c128ab54e621c806b9ffe5c45185` --- - -DROP TABLE IF EXISTS `attr_97b3c128ab54e621c806b9ffe5c45185`; -CREATE TABLE `attr_97b3c128ab54e621c806b9ffe5c45185` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_97b3c128ab54e621c806b9ffe5c45185` --- - - -/*!40000 ALTER TABLE `attr_97b3c128ab54e621c806b9ffe5c45185` DISABLE KEYS */; -LOCK TABLES `attr_97b3c128ab54e621c806b9ffe5c45185` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_97b3c128ab54e621c806b9ffe5c45185` ENABLE KEYS */; - --- --- Table structure for table `attr_04ffb63c6978549209734fc02e8d688d` --- - -DROP TABLE IF EXISTS `attr_04ffb63c6978549209734fc02e8d688d`; -CREATE TABLE `attr_04ffb63c6978549209734fc02e8d688d` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_04ffb63c6978549209734fc02e8d688d` --- - - -/*!40000 ALTER TABLE `attr_04ffb63c6978549209734fc02e8d688d` DISABLE KEYS */; -LOCK TABLES `attr_04ffb63c6978549209734fc02e8d688d` WRITE; -INSERT INTO `attr_04ffb63c6978549209734fc02e8d688d` VALUES ('593e62a063231f8c623b74406b3e12b0','VOCE','S:7201:F::VOCE',3); -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_04ffb63c6978549209734fc02e8d688d` ENABLE KEYS */; - --- --- Table structure for table `attr_48f1a123884d6e24fe205c0f1c60c686` --- - -DROP TABLE IF EXISTS `attr_48f1a123884d6e24fe205c0f1c60c686`; -CREATE TABLE `attr_48f1a123884d6e24fe205c0f1c60c686` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_48f1a123884d6e24fe205c0f1c60c686` --- - - -/*!40000 ALTER TABLE `attr_48f1a123884d6e24fe205c0f1c60c686` DISABLE KEYS */; -LOCK TABLES `attr_48f1a123884d6e24fe205c0f1c60c686` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_48f1a123884d6e24fe205c0f1c60c686` ENABLE KEYS */; - --- --- Table structure for table `attr_52df8110aad9f80fd33a96073bfe58e7` --- - -DROP TABLE IF EXISTS `attr_52df8110aad9f80fd33a96073bfe58e7`; -CREATE TABLE `attr_52df8110aad9f80fd33a96073bfe58e7` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_52df8110aad9f80fd33a96073bfe58e7` --- - - -/*!40000 ALTER TABLE `attr_52df8110aad9f80fd33a96073bfe58e7` DISABLE KEYS */; -LOCK TABLES `attr_52df8110aad9f80fd33a96073bfe58e7` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_52df8110aad9f80fd33a96073bfe58e7` ENABLE KEYS */; - --- --- Table structure for table `attr_47a0c544b03cd51e37f3ad7f9e0a0a62` --- - -DROP TABLE IF EXISTS `attr_47a0c544b03cd51e37f3ad7f9e0a0a62`; -CREATE TABLE `attr_47a0c544b03cd51e37f3ad7f9e0a0a62` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `value` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `full_value` mediumblob NOT NULL, - `origin` int(11) NOT NULL default '0', - KEY `jobid` (`jobid`), - KEY `value` (`value`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attr_47a0c544b03cd51e37f3ad7f9e0a0a62` --- - - -/*!40000 ALTER TABLE `attr_47a0c544b03cd51e37f3ad7f9e0a0a62` DISABLE KEYS */; -LOCK TABLES `attr_47a0c544b03cd51e37f3ad7f9e0a0a62` WRITE; -UNLOCK TABLES; -/*!40000 ALTER TABLE `attr_47a0c544b03cd51e37f3ad7f9e0a0a62` ENABLE KEYS */; - --- --- Table structure for table `attrs` --- - -DROP TABLE IF EXISTS `attrs`; -CREATE TABLE `attrs` ( - `attrid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `name` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `indexed` int(11) NOT NULL default '0', - `type` varchar(32) character set latin1 collate latin1_bin default NULL, - PRIMARY KEY (`attrid`), - KEY `attrid` (`attrid`), - KEY `name` (`name`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `attrs` --- - - -/*!40000 ALTER TABLE `attrs` DISABLE KEYS */; -LOCK TABLES `attrs` WRITE; -INSERT INTO `attrs` VALUES ('824794b00ee73be550f893b99ceaa643','http://egee.cesnet.cz/en/Schema/JP/System:owner',1,'mediumblob'),('ac1e0e146f3e1bee11d6e40d07e60abb','http://egee.cesnet.cz/en/Schema/JP/System:jobId',1,'mediumblob'),('81a1d6b95da954e977f22f78417b98a8','http://egee.cesnet.cz/en/Schema/JP/System:regtime',0,'mediumblob'),('474e4207c49813e09915732c80c0e1cc','http://egee.cesnet.cz/en/Schema/LB/Attributes:user',1,'mediumblob'),('52df8110aad9f80fd33a96073bfe58e7','http://egee.cesnet.cz/en/Schema/LB/Attributes:aTag',0,'mediumblob'),('48f1a123884d6e24fe205c0f1c60c686','http://egee.cesnet.cz/en/Schema/LB/Attributes:eNodes',0,'mediumblob'),('34d7a9e823c6948d525362d2709bdfcd','http://egee.cesnet.cz/en/Schema/LB/Attributes:RB',1,'mediumblob'),('04ffb63c6978549209734fc02e8d688d','http://egee.cesnet.cz/en/Schema/LB/Attributes:CE',1,'mediumblob'),('f496f5d872a2d04ee626045477f340db','http://egee.cesnet.cz/en/Schema/LB/Attributes:UIHost',1,'mediumblob'),('97b3c128ab54e621c806b9ffe5c45185','http://egee.cesnet.cz/en/Schema/LB/Attributes:CPUTime',0,'mediumblob'),('5de12c1776c3130b9d27a7502a13e11c','http://egee.cesnet.cz/en/Schema/LB/Attributes:NProc',0,'mediumblob'),('941ae4f469950ed63ad19822dbcf5427','http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus',1,'mediumblob'),('7636d6368c1cf53bc5511241cac9751f','http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatusDate',0,'mediumblob'),('e2d5742f6e917ea2e949d49b9fa0c1b3','http://egee.cesnet.cz/en/Schema/LB/Attributes:retryCount',0,'mediumblob'),('47a0c544b03cd51e37f3ad7f9e0a0a62','http://egee.cesnet.cz/en/Schema/LB/Attributes:jobType',0,'mediumblob'),('ac7ea0b2cd17deedbc569733597059ae','http://egee.cesnet.cz/en/Schema/LB/Attributes:nsubjobs',0,'mediumblob'),('64ea5318d74aca823630ba9ca38971e0','http://egee.cesnet.cz/en/Schema/LB/Attributes:lastStatusHistory',0,'mediumblob'),('e6c0fb3b99f16296db2623c02f0d5c6f','http://egee.cesnet.cz/en/Schema/LB/Attributes:fullStatusHistory',0,'mediumblob'); -UNLOCK TABLES; -/*!40000 ALTER TABLE `attrs` ENABLE KEYS */; - --- --- Table structure for table `feeds` --- - -DROP TABLE IF EXISTS `feeds`; -CREATE TABLE `feeds` ( - `uniqueid` int(11) NOT NULL auto_increment, - `feedid` varchar(32) character set latin1 collate latin1_bin default NULL, - `state` int(11) NOT NULL default '0', - `locked` int(11) NOT NULL default '0', - `source` varchar(255) NOT NULL default '', - `expires` datetime default NULL, - `condition` mediumblob, - PRIMARY KEY (`uniqueid`), - UNIQUE KEY `feedid` (`feedid`), - KEY `uniqueid` (`uniqueid`), - KEY `feedid_2` (`feedid`), - KEY `state` (`state`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `feeds` --- - - -/*!40000 ALTER TABLE `feeds` DISABLE KEYS */; -LOCK TABLES `feeds` WRITE; -INSERT INTO `feeds` VALUES (93,'12345',8,0,'http://localhost:8901','2005-10-14 10:48:27','COND2'); -UNLOCK TABLES; -/*!40000 ALTER TABLE `feeds` ENABLE KEYS */; - --- --- Table structure for table `jobs` --- - -DROP TABLE IF EXISTS `jobs`; -CREATE TABLE `jobs` ( - `jobid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `dg_jobid` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - `ownerid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `aclid` varchar(32) character set latin1 collate latin1_bin default NULL, - `ps` varchar(255) NOT NULL default '', - PRIMARY KEY (`jobid`), - UNIQUE KEY `dg_jobid` (`dg_jobid`), - KEY `jobid` (`jobid`), - KEY `dg_jobid_2` (`dg_jobid`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `jobs` --- - - -/*!40000 ALTER TABLE `jobs` DISABLE KEYS */; -LOCK TABLES `jobs` WRITE; -INSERT INTO `jobs` VALUES ('593e62a063231f8c623b74406b3e12b0','https://localhost:7846/pokus1','5864429d57da18e4ecf9ea366c6b2c9c',NULL,'http://localhost:8901'),('9276789a0093ad44457655ef03ade36a','https://localhost:7846/pokus2','9996d295b9e10ce182983b258b280779',NULL,'http://localhost:8901'); -UNLOCK TABLES; -/*!40000 ALTER TABLE `jobs` ENABLE KEYS */; - --- --- Table structure for table `users` --- - -DROP TABLE IF EXISTS `users`; -CREATE TABLE `users` ( - `userid` varchar(32) character set latin1 collate latin1_bin NOT NULL default '', - `cert_subj` varchar(255) character set latin1 collate latin1_bin NOT NULL default '', - PRIMARY KEY (`userid`), - UNIQUE KEY `cert_subj` (`cert_subj`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1; - --- --- Dumping data for table `users` --- - - -/*!40000 ALTER TABLE `users` DISABLE KEYS */; -LOCK TABLES `users` WRITE; -INSERT INTO `users` VALUES ('5864429d57da18e4ecf9ea366c6b2c9c','/O=CESNET/O=Masaryk University/CN=Milos Mulac'),('9996d295b9e10ce182983b258b280779','OwnerName'); -UNLOCK TABLES; -/*!40000 ALTER TABLE `users` ENABLE KEYS */; - -/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; -/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; -/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; -/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; -/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; - diff --git a/org.glite.jp.index/examples/query-tests/exists_query.in b/org.glite.jp.index/examples/query-tests/exists_query.in deleted file mode 100644 index c56c485..0000000 --- a/org.glite.jp.index/examples/query-tests/exists_query.in +++ /dev/null @@ -1,17 +0,0 @@ - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - - EXISTS - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - - diff --git a/org.glite.jp.index/examples/query-tests/exists_query.out b/org.glite.jp.index/examples/query-tests/exists_query.out deleted file mode 100644 index 2fbebf3..0000000 --- a/org.glite.jp.index/examples/query-tests/exists_query.out +++ /dev/null @@ -1,28 +0,0 @@ -query: using JPIS http://localhost:10000 - -Conditions: - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - origin IS ANY - value EXISTS -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - -OK -Result 1 jobs: - jobid = https://localhost:7846/pokus1, owner = /O=CESNET/O=Masaryk University/CN=Milos Mulac - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Done - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - value = VOCE - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 diff --git a/org.glite.jp.index/examples/query-tests/jobid_query.in b/org.glite.jp.index/examples/query-tests/jobid_query.in deleted file mode 100644 index 1f57246..0000000 --- a/org.glite.jp.index/examples/query-tests/jobid_query.in +++ /dev/null @@ -1,19 +0,0 @@ - - - - - http://egee.cesnet.cz/en/Schema/JP/System:jobId - - EQUAL - - https://localhost:7846/pokus1 - - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - - diff --git a/org.glite.jp.index/examples/query-tests/jobid_query.out b/org.glite.jp.index/examples/query-tests/jobid_query.out deleted file mode 100644 index e00d456..0000000 --- a/org.glite.jp.index/examples/query-tests/jobid_query.out +++ /dev/null @@ -1,23 +0,0 @@ -query: using JPIS http://localhost:10000 - -Conditions: - http://egee.cesnet.cz/en/Schema/JP/System:jobId - origin IS ANY - value == https://localhost:7846/pokus1 -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - -OK -Result 1 jobs: - jobid = https://localhost:7846/pokus1, owner = /O=CESNET/O=Masaryk University/CN=Milos Mulac - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Done - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 diff --git a/org.glite.jp.index/examples/query-tests/origin_query.in b/org.glite.jp.index/examples/query-tests/origin_query.in deleted file mode 100644 index 3e398ed..0000000 --- a/org.glite.jp.index/examples/query-tests/origin_query.in +++ /dev/null @@ -1,20 +0,0 @@ - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - FILE - - EQUAL - - Done - - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - - diff --git a/org.glite.jp.index/examples/query-tests/origin_query.out b/org.glite.jp.index/examples/query-tests/origin_query.out deleted file mode 100644 index 573f5d7..0000000 --- a/org.glite.jp.index/examples/query-tests/origin_query.out +++ /dev/null @@ -1,23 +0,0 @@ -query: using JPIS http://localhost:10000 - -Conditions: - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - origin == FILE - value == Done -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - -OK -Result 1 jobs: - jobid = https://localhost:7846/pokus1, owner = /O=CESNET/O=Masaryk University/CN=Milos Mulac - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Done - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 diff --git a/org.glite.jp.index/examples/query-tests/run-test.sh b/org.glite.jp.index/examples/query-tests/run-test.sh deleted file mode 100755 index da1e208..0000000 --- a/org.glite.jp.index/examples/query-tests/run-test.sh +++ /dev/null @@ -1,314 +0,0 @@ -#! /bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# test script for the index server -# -# requires running mysql -# - -LC_ALL=C - -usage() { -cat <&1| \ - grep timeleft| sed 's/^.* //'` - if [ "$timeleft" = "0:00:00" -o -z "$timeleft" ]; then - echo "No valid proxy cert found nor "\ - "GLITE_HOST_KEY/GLITE_HOST_KEY specified!"\ - " Aborting." - exit 1 - fi - else - echo "Can't check proxy cert (grid-proxy-info not found). If you do not have valid proxy certificate, set GLITE_HOST_KEY/GLITE_HOST_KEY - otherwise tests will fail!" - fi - fi - - # handle the configuration - ARGS="-u ${GLITE_JPIS_TEST_ROOT_USER:-root}" - [ -z "$GLITE_JPIS_TEST_ROOT_PASSWORD" ] || ARGS="--password=${GLITE_JPIS_TEST_ROOT_PASSWORD} $ARGS" - GLITE_JPIS_TEST_PORT=${GLITE_JPIS_TEST_PORT:-"10000"} - GLITE_JPIS_TEST_PIDFILE=${GLITE_JPIS_TEST_PIDFILE:-"/tmp/glite-jp-indexd.pid"} - GLITE_JPIS_TEST_LOGFILE=${GLITE_JPIS_TEST_LOGFILE:-"/tmp/glite-jp-indexd.log"} - GLITE_JPIS_TEST_CONFIG=${GLITE_JPIS_TEST_CONFIG:-"$GLITE_LOCATION/etc/glite-jpis-test-config.xml"} - - if [ -z "$GLITE_JPIS_TEST_DB" ]; then - GLITE_JPIS_TEST_DB="jpis/@localhost:jpis1test" - need_new_db=1; - fi - DB_USER=`echo $GLITE_JPIS_TEST_DB| sed 's!/.*$!!'` - DB_HOST=`echo $GLITE_JPIS_TEST_DB| sed 's!^.*@!!' | sed 's!:.*!!'` - DB_NAME=`echo $GLITE_JPIS_TEST_DB| sed 's!^.*:!!'` - - GLITE_JPIS_DEBUG=0 -} - -create_db() { - # create database when needed - if [ "x$need_new_db" = "x1" ]; then - mysqladmin -f $ARGS drop $DB_NAME > /dev/null 2>&1 - mysqladmin -f $ARGS create $DB_NAME && \ - mysql $ARGS -e "GRANT ALL on $DB_NAME.* to jpis@localhost" && \ - mysql -u $DB_USER $DB_NAME < $GLITE_LOCATION/etc/glite-jp-index-dbsetup.sql || exit 1 - db_created="1" - fi -} - -import_db() { - # import database - echo -n "D" - cat $1 | sed "s/jpis1test/$DB_NAME/" | mysql -u $DB_USER -h $DB_HOST - if [ x"$?" != x"0" ]; then - echo "FAILED to import database." - kill_is; - drop_db; - exit 1 - fi - echo -n "B " -} - -drop_db() { - # drop databaze when created - [ -z "$db_created" ] || mysqladmin -f $ARGS drop $DB_NAME >/dev/null - -} - -run_is() { - # check - if [ -f "${GLITE_JPIS_TEST_PIDFILE}" ]; then - echo "Index server already running!" - echo " pid $(cat ${GLITE_JPIS_TEST_PIDFILE})" - echo " pidfile ${GLITE_JPIS_TEST_PIDFILE}" - exit 1 - fi - - echo -n "I" - # run index server - #valgrind --tool=memcheck --trace-children=yes --num-callers=15 --suppressions=$HOME/egee.supp - X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT} \ - $GLITE_LOCATION/bin/glite-jp-indexd -m $GLITE_JPIS_TEST_DB -p $GLITE_JPIS_TEST_PORT \ - -i ${GLITE_JPIS_TEST_PIDFILE} -o ${GLITE_JPIS_TEST_LOGFILE} \ - -x ${GLITE_JPIS_TEST_CONFIG} $1\ - 2>/tmp/result - - if [ x"$?" != x"0" ]; then - echo FAILED - drop_db; - exit 1 - fi - i=0 - while [ ! -s "${GLITE_JPIS_TEST_PIDFILE}" -a $i -lt 20 ]; do - sleep 0.1 - i=$(($i+1)) - done - if [ ! -s "${GLITE_JPIS_TEST_PIDFILE}" ]; then - echo "Can't startup index server." - kill_is; - drop_db; - exit 1 - fi - - # wait for index server - ret=1 - i=0 - while [ x"$ret" != x"0" -a $i -lt 20 ]; do - netstat -tapn 2>/dev/null | grep "\<$GLITE_JPIS_TEST_PORT\>" > /dev/null - ret=$? - i=$(($i+1)) - sleep 0.1 - done - if [ x"$ret" != x"0" ]; then - echo "Index server not started." - kill_is; - drop_db; - exit 1; - fi - echo -n "S " - sleep 1 -} - -kill_is() { - # kill the index server - kill `cat ${GLITE_JPIS_TEST_PIDFILE}`; - sleep 1; - kill -9 `cat ${GLITE_JPIS_TEST_PIDFILE}` 2>/dev/null - rm -f ${GLITE_JPIS_TEST_PIDFILE} -} - -run_test_query() { - echo -n "Q" - X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT} \ - $GLITE_LOCATION/examples/glite-jpis-client -f hr -q $1 \ - -i http://localhost:$GLITE_JPIS_TEST_PORT 2>&1 | grep -v '^GSLITE_GSPLUGIN: ' > /tmp/result - echo -n "R " - DIFF=`diff -b -B --ignore-matching-lines="query: using JPIS" $2 /tmp/result` - if [ -z "$DIFF" -a "$?" -eq "0" ] ; then - echo "OK." - rm /tmp/result - else - echo "FAILED!" - echo - echo "Expected result (using query $1):" - echo ------------------------------------------------------------------------------ - cat $2 - echo - echo --------------------------------------------------------------------------------------------------- - echo - echo "Obtained result (in /tmp/result):" - echo --------------------------------- - cat /tmp/result - echo - echo --------------------------------------------------------------------------------------------------- - drop_db; - kill_is; - exit 1 - fi -} - -run_test_feed() { - # run the example - X509_USER_KEY=${X509_USER_KEY} X509_USER_CERT=${X509_USER_CERT}\ - $GLITE_LOCATION/examples/glite-jpis-test -p $GLITE_JPIS_TEST_PORT \ - -m $GLITE_JPIS_TEST_DB -x $GLITE_JPIS_TEST_CONFIG &>/tmp/result - numok="$(cat /tmp/result | grep -c OK)" - if [ "$numok" -eq "2" ]; then - echo OK. - else - echo FAILED! - echo --------------------------------------------------------------------------------------------------- - echo - echo "Obtained result (in /tmp/result):" - echo --------------------------------- - cat /tmp/result - echo - echo --------------------------------------------------------------------------------------------------- - drop_db; - kill_is; - exit 1 - fi -} - - -########################################################################## -# - -if [ "$1" ]; then usage; exit 1; fi -init; - -echo - -echo -n "Simple query test.... " -create_db; -run_is "-n"; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/simple_query.in $GLITE_LOCATION/examples/query-tests/simple_query.out; -drop_db; -kill_is; - -echo -n "Complex query test... " -create_db; -run_is "-n"; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/complex_query.in $GLITE_LOCATION/examples/query-tests/complex_query.out; -drop_db; -kill_is; - -echo -n "Feed & query test.... " -create_db; -run_is; -run_test_feed; -drop_db; -kill_is; - -echo -n "Authz test........... " -create_db; -run_is; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/simple_query.in $GLITE_LOCATION/examples/query-tests/authz.out; -drop_db; -kill_is; - -echo -n "Query jobId test..... " -create_db; -run_is "-n"; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/jobid_query.in $GLITE_LOCATION/examples/query-tests/jobid_query.out; -drop_db; -kill_is; - -echo -n "Origin test.......... " -create_db; -run_is "-n"; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/origin_query.in $GLITE_LOCATION/examples/query-tests/origin_query.out; -drop_db; -kill_is; - -echo -n "EXISTS test.......... " -create_db; -run_is "-n"; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/exists_query.in $GLITE_LOCATION/examples/query-tests/exists_query.out; -drop_db; -kill_is; - -echo -n "WITHIN test.......... " -create_db; -run_is "-n"; -import_db $GLITE_LOCATION/examples/query-tests/dump1.sql; -run_test_query $GLITE_LOCATION/examples/query-tests/within_query.in $GLITE_LOCATION/examples/query-tests/within_query.out; -drop_db; -kill_is; diff --git a/org.glite.jp.index/examples/query-tests/simple_query.in b/org.glite.jp.index/examples/query-tests/simple_query.in deleted file mode 100644 index 3a32ae3..0000000 --- a/org.glite.jp.index/examples/query-tests/simple_query.in +++ /dev/null @@ -1,19 +0,0 @@ - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - - EQUAL - - Ready - - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - - diff --git a/org.glite.jp.index/examples/query-tests/simple_query.out b/org.glite.jp.index/examples/query-tests/simple_query.out deleted file mode 100644 index 3426131..0000000 --- a/org.glite.jp.index/examples/query-tests/simple_query.out +++ /dev/null @@ -1,23 +0,0 @@ -query: using JPIS http://localhost:10000 - -Conditions: - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - origin IS ANY - value == Ready -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - -OK -Result 1 jobs: - jobid = https://localhost:7846/pokus2, owner = OwnerName - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Ready - origin = SYSTEM (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = SYSTEM (no detail) - time = Thu Jan 1 02:00:01 1970 diff --git a/org.glite.jp.index/examples/query-tests/within_query.in b/org.glite.jp.index/examples/query-tests/within_query.in deleted file mode 100644 index e40d902..0000000 --- a/org.glite.jp.index/examples/query-tests/within_query.in +++ /dev/null @@ -1,19 +0,0 @@ - - - - - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - - WITHIN - VOCA - VOCI - - - - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - - diff --git a/org.glite.jp.index/examples/query-tests/within_query.out b/org.glite.jp.index/examples/query-tests/within_query.out deleted file mode 100644 index c1d7251..0000000 --- a/org.glite.jp.index/examples/query-tests/within_query.out +++ /dev/null @@ -1,28 +0,0 @@ -query: using JPIS http://localhost:12002 - -Conditions: - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - origin IS ANY - value WITHIN VOCA AND VOCI -Attributes: - http://egee.cesnet.cz/en/Schema/JP/System:owner - http://egee.cesnet.cz/en/Schema/JP/System:jobId - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - -OK -Result 1 jobs: - jobid = https://localhost:7846/pokus1, owner = /O=CESNET/O=Masaryk University/CN=Milos Mulac - http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - value = Done - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:user - value = CertSubj - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 - http://egee.cesnet.cz/en/Schema/LB/Attributes:CE - value = VOCE - origin = FILE (no detail) - time = Thu Jan 1 02:00:01 1970 diff --git a/org.glite.jp.index/interface/JobProvenanceISClient.xsd b/org.glite.jp.index/interface/JobProvenanceISClient.xsd deleted file mode 100644 index 2cf0755..0000000 --- a/org.glite.jp.index/interface/JobProvenanceISClient.xsd +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.index/project/ChangeLog b/org.glite.jp.index/project/ChangeLog deleted file mode 100644 index 99ea05f..0000000 --- a/org.glite.jp.index/project/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -1.4.0-1 -- Initial version - -1.4.0-2 -- configure updated - diff --git a/org.glite.jp.index/project/build.number b/org.glite.jp.index/project/build.number deleted file mode 100644 index 5a6321a..0000000 --- a/org.glite.jp.index/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Fri Oct 14 15:22:37 CEST 2005 -module.build=12 diff --git a/org.glite.jp.index/project/build.properties b/org.glite.jp.index/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.jp.index/project/configure.properties.xml b/org.glite.jp.index/project/configure.properties.xml deleted file mode 100644 index 5406d55..0000000 --- a/org.glite.jp.index/project/configure.properties.xml +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -expat_prefix=${with.expat.prefix} -gsoap_prefix=${with.gsoap.prefix} -gsoap_version=${ext.gsoap.version} -mysql_prefix=${with.mysql.prefix} -mysql_version=${ext.mysql.version} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -cppunit=${with.cppunit.prefix} -jpproject=${subsystem.project.dir} -project=${component.project.dir} - - - diff --git a/org.glite.jp.index/project/properties.xml b/org.glite.jp.index/project/properties.xml deleted file mode 100755 index 5f56392..0000000 --- a/org.glite.jp.index/project/properties.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.index/project/tar_exclude b/org.glite.jp.index/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.jp.index/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.jp.index/project/version.properties b/org.glite.jp.index/project/version.properties deleted file mode 100644 index f183374..0000000 --- a/org.glite.jp.index/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# $Header$ -module.version=1.4.0 -module.age=2 diff --git a/org.glite.jp.index/src/bones_server.c b/org.glite.jp.index/src/bones_server.c deleted file mode 100644 index 0643ba6..0000000 --- a/org.glite.jp.index/src/bones_server.c +++ /dev/null @@ -1,560 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include - -#include -#include -#include - -#include "conf.h" -#include "db_ops.h" -#include "soap_ps_calls.h" -#include "context.h" -#include "common.h" - -#include "soap_version.h" -#include "jp_H.h" -#include "jp_.nsmap" - -#if GSOAP_VERSION <= 20602 -#define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex -#define soap_call___jpsrv__FeedIndexRefresh soap_call___ns1__FeedIndexRefresh -#endif - -#define CONN_QUEUE 20 -#define MAX_SLAVES_NUM 20 // max. of slaves to be spawned -#define USER_QUERY_SLAVES_NUM 2 // # of slaves reserved for user queries if - // # PS to conntact is << MAX_SLAVES_NUM - -#define RECONNECT_TIME 60*20 // when try reconnect to PS in case of error (in sec) -#define RECONNECT_TIME_QUICK 1 // time between feed requests -#define REACTION_TIME 60*2 // when try reconnect to PS in case of new feeds (in sec) -#define LAUNCH_TIME 2 // wait (for starting slaves) before requesting feeds - - -extern SOAP_NMAC struct Namespace jp__namespaces[],jpps__namespaces[]; - -int newconn(int,struct timeval *,void *); -int request(int,struct timeval *,void *); -static int reject(int); -static int disconn(int,struct timeval *,void *); -int data_init(void **data); -#ifndef ONETIME_FEEDS -int feed_loop_slave(void); -#endif - - -static struct glite_srvbones_service stab = { - "JP Index Server", -1, newconn, request, reject, disconn -}; - -static time_t cert_mtime; -static char *server_cert, *server_key, *cadir; -static edg_wll_GssCred mycred = NULL; - -static char *port = GLITE_JPIS_DEFAULT_PORT_STR; -static int debug = 1; - -static glite_jp_context_t ctx; -static glite_jp_is_conf *conf; // Let's make configuration visible to all slaves - - -int main(int argc, char *argv[]) -{ - int one = 1, nfeeds; - edg_wll_GssStatus gss_code; - struct sockaddr_in a; - glite_jpis_context_t isctx; - int retval = 0; - char *err; - int i; - - glite_jp_init_context(&ctx); - - if (glite_jp_get_conf(argc, argv, &conf)) { - glite_jp_free_context(ctx); - exit(1); - } - glite_jpis_init_context(&isctx, ctx, conf); - - /* connect to DB */ - if (glite_jpis_init_db(isctx) != 0) { - fprintf(stderr, "Connect DB failed: %s (%s)\n", ctx->error->desc, ctx->error->source); - glite_jpis_free_context(isctx); - glite_jp_free_context(ctx); - glite_jp_free_conf(conf); - return 1; - } - - /* daemonize */ - if (!conf->debug) glite_srvbones_daemonize("glite-jp-indexd", conf->pidfile, conf->logfile); - - /* load plugins */ - for (i=0; conf->plugins[i]; i++) - glite_jp_typeplugin_load(ctx,conf->plugins[i]); - - if (conf->delete_db) { - if (glite_jpis_dropDatabase(isctx) != 0) { - fprintf(stderr, "Drop DB failed: "); - retval = 1; - goto quit; - } - } - - if (glite_jpis_initDatabase(isctx) != 0) { - fprintf(stderr, "Init DB failed: "); - retval = 1; - goto quit; - } - - if (conf->delete_db || conf->force_feed) { - if (glite_jpis_initDatabaseFeeds(isctx) != 0) { - fprintf(stderr, "Init feeds failed: "); - retval = 1; - goto quit; - } - } - - server_cert = conf->server_cert; - server_key = conf->server_key; - - if (!server_cert || !server_key) - fprintf(stderr, "%s: WARNING: key or certificate file not specified, " - "can't watch them for changes\n", - argv[0]); - - if ( cadir ) setenv("X509_CERT_DIR", cadir, 1); - edg_wll_gss_watch_creds(server_cert, &cert_mtime); - - if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &gss_code)) - fprintf(stderr,"Server identity: %s\n",mycred ? mycred->name : "NULL"); - else fputs("WARNING: Running unauthenticated\n",stderr); - - if (conf->feeding) { - fprintf(stderr, "%s: Feeding from '%s'\n", argv[0], conf->feeding); - retval = glite_jpis_feeding(isctx, conf->feeding, mycred ? mycred->name : NULL); - goto quit; - } - - stab.conn = socket(PF_INET, SOCK_STREAM, 0); - if (stab.conn < 0) { - perror("socket"); - return 1; - } - - setsockopt(stab.conn,SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); - - if (conf->port) port = conf->port; - a.sin_family = AF_INET; - a.sin_addr.s_addr = INADDR_ANY; - a.sin_port = htons(atoi(port)); - if (bind(stab.conn,(struct sockaddr *) &a, sizeof(a)) ) { - char buf[200]; - - snprintf(buf,sizeof(buf),"bind(%d)",atoi(port)); - perror(buf); - return 1; - } - - if (listen(stab.conn,CONN_QUEUE)) { - perror("listen()"); - return 1; - } - - // XXX: more tests needed - if (conf->feeds) - for (nfeeds=0; conf->feeds[nfeeds]; nfeeds++); - else nfeeds = 0; - if (conf->slaves <= 0) { - // add some slaves for user queries and PS responses - conf->slaves = nfeeds + (USER_QUERY_SLAVES_NUM - 1); - if (conf->slaves > MAX_SLAVES_NUM) conf->slaves = MAX_SLAVES_NUM; - } - // - // SUM(PS, feeds(PS) - slaves(PS)) slaves would be blocked - // when waited for all PS - // - // wild guess for slaves(PS) == 1 on all PS: - // 1 + SUM(PS, feeds(PS) - 1) slaves is required, - // SUM(PS, feeds(PS)) is enough. - // - if (conf->slaves < nfeeds) { - fprintf(stderr, "WARNING: %d slaves can be too low for %d feeds\n", conf->slaves, nfeeds); - } - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, conf->slaves); -#ifndef ONETIME_FEEDS - if (feed_loop_slave() < 0) { - fprintf(stderr, "forking feed_loop_slave failed!\n"); - } else -#endif - glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug); - -quit: - if (isctx->jpctx->error) { - err = glite_jp_error_chain(isctx->jpctx); - fprintf(stderr, "%s: %s\n", argv[0], err); - free(err); - } - - glite_jpis_free_db(isctx); - glite_jp_free_conf(conf); - glite_jpis_free_context(isctx); - glite_jp_free_context(ctx); - - return retval; -} - - -static int get_soap(struct soap *soap, glite_jpis_context_t ctx) { - glite_gsplugin_Context plugin_ctx; - - glite_gsplugin_init_context(&plugin_ctx); - - soap_init(soap); - soap_set_namespaces(soap, jp__namespaces); - soap_set_omode(soap, SOAP_IO_BUFFER); // set buffered response - // buffer set to SOAP_BUFLEN (default = 8k) - if (soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx)) - return glite_jpis_stack_error(ctx->jpctx, EIO, "can't register gsoap plugin"); - - return 0; -} - - -/* looking for some feed in DB */ -static int feed_caller(struct soap *soap, glite_jpis_context_t isctx) { - char *PS_URL, *feedid, *errs; - long int uniqueid; - int i, ok, ret, status, initialized, result = 0; - - // dirty hack - try quicker several times first - glite_jp_clear_error(isctx->jpctx); - - feedid = NULL; - for (initialized = 0; initialized <= 1; initialized++) { - switch (glite_jpis_lockSearchFeed(isctx,initialized,&uniqueid,&PS_URL,&status,&feedid)) { - case 0: - // some locked feeds found - ok = 0; - for (i = 0; i < 10; i++) { - if (!initialized) { - // contact PS server, ask for data, save - // feedId and expiration to DB and unlock the feed - ret = MyFeedIndex(soap, isctx, uniqueid, PS_URL); - } else { - ret = MyFeedRefresh(soap, isctx, uniqueid, PS_URL, status, feedid); - } - if (ret) { - // error when connecting to PS - errs = glite_jp_error_chain(isctx->jpctx); - printf("[%d] %s: %s, reconnecting later\n", getpid(), __FUNCTION__, errs); - free(errs); - } else { - lprintf("%s %s (%ld) ok\n", initialized ? "refresh" : "init", feedid, uniqueid); - ok = 1; - break; - } - } - if (!ok) { - // when unintialized feed: always reconnect - // when not refreshed feed: reconnect only once and two times quicker - if (!initialized || (status & GLITE_JP_IS_STATE_ERROR) == 0) { - lprintf("reconnecting %s (%ld)\n", feedid, uniqueid); - glite_jpis_tryReconnectFeed(isctx, uniqueid, time(NULL) + RECONNECT_TIME / (initialized + 1), status | GLITE_JP_IS_STATE_ERROR); - } else { - lprintf("destroying %s (%ld)\n", feedid, uniqueid); - glite_jpis_destroyTryReconnectFeed(isctx, uniqueid, time(NULL) - 1); - } - } - free(PS_URL); PS_URL = NULL; - free(feedid); feedid = NULL; - - sleep(RECONNECT_TIME_QUICK); - - result = 1; - break; - case ENOENT: - // no more feeds to initialize - break; - default: - // error during locking - printf("[%d] %s: Locking error: ", getpid(), __FUNCTION__); - if (isctx->jpctx->error) { - errs = glite_jp_error_chain(isctx->jpctx); - printf("%s\n", errs); - free(errs); - } else printf("(no detail)\n"); - return -1; - } - } - - return result; -} - - -#ifndef ONETIME_FEEDS -int feed_loop_slave(void) { - pid_t pid; - glite_jpis_context_t isctx; - struct soap soap; - char *errs; - - if ( (pid = fork()) ) return pid; - - glite_jpis_init_context(&isctx, ctx, conf); - if (glite_jpis_init_db(isctx) != 0) { - printf("[%d] %s: DB error: %s (%s)\n", getpid(), __FUNCTION__, ctx->error->desc, ctx->error->source); - exit(1); - } - - if (get_soap(&soap, isctx) != 0) { - printf("[%d] %s: ", getpid(), __FUNCTION__); - if (isctx->jpctx->error) { - errs = glite_jp_error_chain(isctx->jpctx); - printf("%s\n", errs); - free(errs); - } else printf("(no detail)\n"); - exit(1); - } - - printf("[%d] %s: waiting before feed requests...\n", getpid(), __FUNCTION__); - sleep(LAUNCH_TIME); - printf("[%d] %s: feeder slave started\n", getpid(), __FUNCTION__); - do { - switch (feed_caller(&soap, isctx)) { - case 1: break; - case 0: - sleep(REACTION_TIME); - break; - default: - if (isctx->jpctx->error) { - errs = glite_jp_error_chain(isctx->jpctx); - printf("[%d] %s: %s\n", getpid(), __FUNCTION__, errs); - free(errs); - } - printf("[%d] %s: feed locking error, slave terminated\n", getpid(), __FUNCTION__); - exit(1); - } - } while (1); - - printf("[%d] %s: slave terminated\n", getpid(), __FUNCTION__); - exit(0); -} -#endif - - -/* slave's init comes here */ -int data_init(void **data) -{ - slave_data_t *private; - - private = calloc(sizeof(*private), 1); - glite_jpis_init_context(&private->ctx, ctx, conf); - if (glite_jpis_init_db(private->ctx) != 0) { - printf("[%d] slave_init(): DB error: %s (%s)\n",getpid(),ctx->error->desc,ctx->error->source); - return -1; - } - - printf("[%d] slave started\n",getpid()); - private->soap = soap_new(); - -#if ONETIME_FEEDS - if (get_soap(private->soap, ctx) != 0) { - printf("[%d] %s: ", getpid(), __FUNCTION__); - if (isctx->jpctx->error) { - errs = glite_jp_error_chain(ctx->jpctx); - printf("%s\n", errs); - free(errs); - } else printf("(no error)\n"); - exit(1); - } - - /* ask PS server for data */ - do { - switch (feed_caller(private->soap, private->ctx)) { - case 1: - // one feed handled - break; - case 0: - // no more feeds to initialize - *data = (void *) private; - return 0; - default: - // error during locking - glite_jpis_free_db(private->ctx); - glite_jpis_free_context(private->ctx); - return -1; - } - } while (1); -#else - *data = (void *) private; - return 0; -#endif -} - - -int newconn(int conn,struct timeval *to,void *data) -{ - slave_data_t *private = (slave_data_t *)data; - struct soap *soap = private->soap; - glite_jp_context_t ctx = private->ctx->jpctx; - glite_gsplugin_Context plugin_ctx; - - edg_wll_GssCred newcred = NULL; - edg_wll_GssStatus gss_code; - int ret = 0; - edg_wll_GssPrincipal client = NULL; - edg_wll_GssConnection connection; - - - soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE); - soap_set_omode(soap, SOAP_IO_BUFFER); // set buffered response - // buffer set to SOAP_BUFLEN (default = 8k) - soap_set_namespaces(soap,jp__namespaces); - soap->user = (void *) private; - - switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) { - case 0: break; - case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key, - &newcred,&gss_code)) - { - - printf("[%d] reloading credentials\n",getpid()); /* XXX: log */ - edg_wll_gss_release_cred(&mycred, NULL); - mycred = newcred; - } - break; - case -1: - printf("[%d] edg_wll_gss_watch_creds failed\n", getpid()); /* XXX: log */ - break; - } - - /* TODO: DNS paranoia etc. */ - memset(&connection, 0, sizeof(connection)); - if (edg_wll_gss_accept(mycred,conn,to,&connection,&gss_code)) { - char *et; - - edg_wll_gss_get_error(&gss_code,"",&et); - - fprintf(stderr,"[%d] GSS connection accept failed: %s\nClosing connection.\n",getpid(),et); - free(et); - ret = 1; - soap_end(soap); - return 1; - } - - ret = edg_wll_gss_get_client_conn(&connection, &client, NULL); - - if (ctx->peer) free(ctx->peer); - if (ret || client->flags & EDG_WLL_GSS_FLAG_ANON) { - printf("[%d] annonymous client\n",getpid()); - ctx->peer = NULL; - } - else { - printf("[%d] client DN: %s\n",getpid(),client->name); /* XXX: log */ - - ctx->peer = strdup(client->name); - edg_wll_gss_free_princ(client); - } - - glite_gsplugin_init_context(&plugin_ctx); - glite_gsplugin_set_connection(plugin_ctx, &connection); - soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx); - - return 0; -} - -int request(int conn UNUSED,struct timeval *to,void *data) -{ - slave_data_t *private = (slave_data_t *)data; - struct soap *soap = private->soap; - glite_jp_context_t ctx = private->ctx->jpctx; - - glite_gsplugin_set_timeout(glite_gsplugin_get_context(soap),to); - - soap->max_keep_alive = 1; /* XXX: prevent gsoap to close connection */ - soap_begin(soap); - if (soap_begin_recv(soap)) { - if (soap->error < SOAP_STOP) { - soap_send_fault(soap); - return EIO; - } - return ENOTCONN; - } - - soap->keep_alive = 1; - if (soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap) - || jp__serve_request(soap) -#if GSOAP_VERSION >= 20700 - || (soap->fserveloop && soap->fserveloop(soap)) -#endif - ) - { - soap_send_fault(soap); // sets soap->keep_alive back to 0 :( - // and closes connection - if (ctx->error) { - /* XXX: shall we die on some errors? */ - int err = ctx->error->code; - glite_jp_clear_error(ctx); - return err == EIO ? -err : err; /* EIO is fatal */ - } - - return ECANCELED; // let srv_bones know something is wrong - } - - glite_jp_run_deferred(ctx); - return ENOTCONN; -} - -static int reject(int conn) -{ - int flags = fcntl(conn, F_GETFL, 0); - - fcntl(conn,F_SETFL,flags | O_NONBLOCK); - edg_wll_gss_reject(conn); - - return 0; -} - -static int disconn(int conn UNUSED,struct timeval *to UNUSED,void *data) -{ - slave_data_t *private = (slave_data_t *)data; - struct soap *soap = private->soap; - -// XXX: belongs to "data_init complement" -// glite_jpis_free_db(private->ctx); -// glite_jpis_free_context(private->ctx); - soap_end(soap); // clean up everything and close socket - - return 0; -} - - diff --git a/org.glite.jp.index/src/common.c b/org.glite.jp.index/src/common.c deleted file mode 100644 index 3bf16a2..0000000 --- a/org.glite.jp.index/src/common.c +++ /dev/null @@ -1,77 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include - -#include -#include - -#include "common.h" - -#define WHITE_SPACE_SET "\n\r \t" - - -void glite_jpis_trim(char *str) { - size_t pos, len; - - if (!str) return; - - pos = strspn(str, WHITE_SPACE_SET); - len = strcspn(str + pos, WHITE_SPACE_SET); - if (pos) memmove(str, str + pos, len); - str[len] = '\0'; -} - - -int glite_jpis_stack_error_source(glite_jp_context_t ctx, int code, const char *func, int line, const char *descfmt, ...) { - glite_jp_error_t err; - char *source, *desc; - va_list ap; - - va_start(ap, descfmt); - - asprintf(&source, "%s:%d", func, line); - if (descfmt) vasprintf(&desc, descfmt, ap); - else desc = NULL; - memset(&err, 0, sizeof err); - err.code = code; - err.desc = desc; - err.source = source; - glite_jp_stack_error(ctx, &err); - free(source); - free(desc); - - va_end(ap); - return code; -} - - -int glite_jpis_find_attr(char **attrs, const char *attr){ - size_t i; - - i = 0; - while (attrs[i]) { - if (strcasecmp(attr, attrs[i]) == 0) return 1; - i++; - } - return 0; -} diff --git a/org.glite.jp.index/src/common.h b/org.glite.jp.index/src/common.h deleted file mode 100644 index 4d84e59..0000000 --- a/org.glite.jp.index/src/common.h +++ /dev/null @@ -1,36 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#ifndef GLITE_JPIS_COMMON_H -#define GLITE_JPIS_COMMON_H - -#include -#include - -void glite_jpis_trim(char *str); - -int glite_jpis_stack_error_source(glite_jp_context_t ctx, int code, const char *func, int line, const char *desc, ...); - -#define glite_jpis_stack_error(CTX, CODE, DESCFMT...) glite_jpis_stack_error_source((CTX), (CODE), __FUNCTION__, __LINE__, ##DESCFMT); - -int glite_jp_typeplugin_load(glite_jp_context_t ctx,const char *so); - -int glite_jpis_find_attr(char **attrs, const char *attr); - -#endif diff --git a/org.glite.jp.index/src/conf.c b/org.glite.jp.index/src/conf.c deleted file mode 100644 index e72f941..0000000 --- a/org.glite.jp.index/src/conf.c +++ /dev/null @@ -1,345 +0,0 @@ -/* Module for obtaining configuration for Index Server */ - -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "soap_version.h" -#include - -#include "conf.h" -#include "db_ops.h" -#include "ws_is_typeref.h" - -#include - - -extern SOAP_NMAC struct Namespace jp__namespaces[]; - -static const char *get_opt_string = "dq:c:k:C:V:nm:p:i:o:x:s:Df:F"; - -static struct option opts[] = { - {"debug", 0, NULL, 'd'}, - {"query-type", 1, NULL, 'q'}, - {"cert", 1, NULL, 'c'}, - {"key", 1, NULL, 'k'}, -// {"CAdir", 1, NULL, 'C'}, -// {"VOMSdir", 1, NULL, 'V'}, - {"noauth", 0, NULL, 'n'}, - {"mysql", 1, NULL, 'm'}, - {"port", 1, NULL, 'p'}, - {"pidfile", 1, NULL, 'i'}, - {"logfile", 1, NULL, 'o'}, - {"config", 1, NULL, 'x'}, - {"slaves", 1, NULL, 's'}, - {"delete-db", 0, NULL, 'D'}, - {"feeding", 1, NULL, 'f'}, - {"force-feed", 0, NULL, 'F'}, - {NULL, 0, NULL, 0} -}; - -static int read_conf(glite_jp_is_conf *conf, char *conf_file); -#if 0 -static int dump_conf(void); -#endif - -static void usage(char *me) -{ - fprintf(stderr,"usage: %s [option]\n" - "\t-d, --debug\t don't run as daemon, additional diagnostics\n" - "\t-q, --query-type hist/cont/both (default history)\n" - "\t-k, --key\t private key file\n" - "\t-c, --cert\t certificate file\n" -// "\t-C, --CAdir\t trusted certificates directory\n" -// "\t-V, --VOMSdir\t trusted VOMS servers certificates directory\n" - "\t-n, --noauth\t don't check user identity with result owner\n" - "\t-m, --mysql\t database connect string\n" - "\t-p, --port\t port to listen\n" - "\t-i, --pidfile\t file to store master pid\n" - "\t-o, --logfile\t file to store logs\n" - "\t-x, --config\t file with server configuration\n" - "\t-s, --slaves\t number of slaves for responses\n" - "\t-D, --delete-db\t delete and restore data in the database\n" - "\t-f, --feeding\t feed index server from local file\n" - "\t-F, --force-feed\t force reloading feeds from the config file\n" - "\n" - ,me); -} - - -int glite_jp_get_conf(int argc, char **argv, glite_jp_is_conf **configuration) -{ - char *qt = NULL, *conf_file = NULL; - int opt; - glite_jp_is_conf *conf; - - - conf = calloc(1, sizeof(*conf)); - - while ((opt = getopt_long(argc,argv,get_opt_string,opts,NULL)) != EOF) switch (opt) { - case 'd': conf->debug = 1; break; - case 'q': qt = optarg; break; - case 'c': conf->server_cert = optarg; break; - case 'k': conf->server_key = optarg; break; -// case 'C': cadir = optarg; break; -// case 'V': vomsdir = optarg; break; - case 'n': conf->no_auth = 1; break; - case 'm': conf->cs = optarg; break; - case 'p': conf->port = optarg; break; - case 'i': conf->pidfile = optarg; break; - case 'o': conf->logfile = optarg; break; - case 'x': conf_file = optarg; break; - case 's': conf->slaves = atoi(optarg); if (conf->slaves > 0) break; - case 'D': conf->delete_db = 1; break; - case 'f': conf->feeding = optarg; break; - case 'F': conf->force_feed = 1; break; - default : usage(argv[0]); exit(0); break; - } - - if (!conf->cs) { - fprintf(stderr,"DB contact string not specified! "\ - "Using build-in default: %s \n", GLITE_JP_IS_DEFAULTCS); - } - if (!conf->port) { - fprintf(stderr,"JP IS port not specified! "\ - "Using build-in default: %s \n", GLITE_JPIS_DEFAULT_PORT_STR); - } - - if (!conf_file) { - fprintf(stderr,"JP IS configuration file must be specified! "\ - "Exiting.\n"); - free(conf); - return 1; - } - else { - if (read_conf(conf, conf_file) != 0) return 1; - } - - *configuration = conf; - - return 0; -} - - -void glite_jp_free_conf(glite_jp_is_conf *conf) -{ - size_t i, j; - glite_jp_is_feed *feed; - - if (!conf) return; - - if (conf->attrs) for (i = 0; conf->attrs[i]; i++) free(conf->attrs[i]); - if (conf->indexed_attrs) for (i = 0; conf->indexed_attrs[i]; i++) free(conf->indexed_attrs[i]); - if (conf->multival_attrs) for (i = 0; conf->multival_attrs[i]; i++) free(conf->multival_attrs[i]); - if (conf->queriable_attrs) for (i = 0; conf->queriable_attrs[i]; i++) free(conf->queriable_attrs[i]); - if (conf->feeds) for (i = 0; conf->feeds[i]; i++) { - feed = conf->feeds[i]; - free(feed->PS_URL); - for (j = 0; feed->query[j].attr; j++) glite_jp_free_query_rec(&feed->query[j]); - free(feed->query); - free(feed); - } - free(conf->attrs); - free(conf->indexed_attrs); - free(conf->multival_attrs); - free(conf->queriable_attrs); - free(conf->plugins); - free(conf->feeds); - free(conf); -} - - -void glite_jp_lprintf(const char *source, const char *fmt, ...) { - va_list ap; - - printf("[%d] %s: ", getpid(), source); - va_start(ap, fmt); - vprintf(fmt, ap); - va_end(ap); -} - -/* - * Reads configuration from XML conf. file - */ -static int read_conf(glite_jp_is_conf *conf, char *conf_file) -{ - struct soap soap; - struct _jpelem__ServerConfigurationResponse out; - int fd, i; - - - if ((fd = open(conf_file, 0)) < 0) { - fprintf(stderr, "error opening %s: %s\n", conf_file, strerror(errno)); - return 1; - } - - memset(&soap, 0, sizeof(soap)); - soap_init(&soap); - soap_set_namespaces(&soap, jp__namespaces); - - soap_begin(&soap); - soap.recvfd = fd; - soap_begin_recv(&soap); - memset(&out, 0, sizeof(out)); - - soap_default__jpelem__ServerConfigurationResponse(&soap, &out); - if (!soap_get__jpelem__ServerConfigurationResponse(&soap, &out, "ServerConfiguration", NULL)) { - soap_end_recv(&soap); - soap_end(&soap); - soap_print_fault(&soap, stderr); - return EINVAL; - } - soap_end_recv(&soap); - - if (out.__sizeattrs) { - conf->attrs = calloc(out.__sizeattrs + 1, sizeof(*conf->attrs)); - conf->multival_attrs = calloc(1, sizeof(*conf->multival_attrs)); - conf->queriable_attrs = calloc(1, sizeof(*conf->queriable_attrs)); - int mva = 0; - int qa = 0; - for (i=0; i < out.__sizeattrs; i++) { - struct jptype__attrType *attr; - attr = GLITE_SECURITY_GSOAP_LIST_GET(out.attrs, i); - if (!attr->name) { - fprintf(stderr, "missing name of %d attribute in %s\n", i + 1, conf_file); - goto err; - } - conf->attrs[i] = strdup(attr->name); - if (attr->multival == jptype__yesNo__YES){ - conf->multival_attrs = realloc(conf->multival_attrs, (mva+2)*sizeof(*conf->multival_attrs)); - conf->multival_attrs[mva] = strdup(attr->name); - conf->multival_attrs[++mva] = NULL; - } - if (attr->queriable == jptype__yesNo__YES){ - conf->queriable_attrs = realloc(conf->queriable_attrs, (qa+2)*sizeof(*conf->queriable_attrs)); - conf->queriable_attrs[qa] = strdup(attr->name); - conf->queriable_attrs[++qa] = NULL; - } - } - } - if (out.__sizeindexedAttrs) { - conf->indexed_attrs = calloc(out.__sizeindexedAttrs + 1, sizeof(*conf->indexed_attrs)); - for (i=0; i < out.__sizeindexedAttrs; i++) { - conf->indexed_attrs[i] = strdup(out.indexedAttrs[i]); - } - } - if (out.__sizeplugins) { - conf->plugins = calloc(out.__sizeplugins + 1, sizeof(*conf->plugins)); - for (i=0; i < out.__sizeplugins; i++) { - conf->plugins[i] = strdup(out.plugins[i]); - } - } - if (out.__sizefeeds) { - conf->feeds = calloc(out.__sizefeeds + 1, sizeof(*conf->feeds)); - for (i=0; i < out.__sizefeeds; i++) { - struct jptype__feedSession *feed; - - feed = GLITE_SECURITY_GSOAP_LIST_GET(out.feeds, i); - conf->feeds[i] = calloc(1, sizeof(*conf->feeds[i])); - conf->feeds[i]->PS_URL=strdup(feed->primaryServer); - - if (glite_jpis_SoapToPrimaryQueryConds(feed->__sizecondition, - feed->condition, &conf->feeds[i]->query)) goto err; - - conf->feeds[i]->history = feed->history; - conf->feeds[i]->continuous = feed->continuous; - conf->feeds[i]->uniqueid = -1; - } - } - - soap_destroy(&soap); - soap_end(&soap); - soap_done(&soap); - - return 0; - -err: - glite_jp_free_conf(conf); - soap_destroy(&soap); - soap_end(&soap); - soap_done(&soap); - return EINVAL; -} - -#if 0 -/* - * Just helper function - used only once for first generation - * of XML example configuration (which was then reedited in hand) - */ -static int dump_conf(void) { - int retval; - struct _jpelem__ServerConfigurationResponse out; - struct soap soap; - struct jptype__feedSession *feed; - struct jptype__primaryQuery *cond; - - soap_init(&soap); - soap_set_namespaces(&soap, jp__namespaces); - - soap.sendfd = STDOUT_FILENO; - soap_begin_send(&soap); - soap_default__jpelem__ServerConfigurationResponse(&soap, &out); - - out.__sizeattrs = 2; - out.attrs = calloc(2, sizeof(*out.attrs)); - out.attrs[0] = strdup("atrr1"); - out.attrs[1] = strdup("atrr2"); - - out.__sizeindexedAttrs = 2; - out.indexedAttrs = calloc(2, sizeof(*out.indexedAttrs)); - out.indexedAttrs[0] = strdup("idxAtrr1"); - out.indexedAttrs[1] = strdup("idxAtrr2"); - - out.__sizeplugins = 2; - out.plugins = calloc(2, sizeof(*out.plugins)); - out.plugins[0] = strdup("plugin1"); - out.plugins[1] = strdup("plugin2"); - - GLITE_SECURITY_GSOAP_LIST_CREATE(&soap, &out, feeds, struct jptype__feedSession, 1); - feed = GLITE_SECURITY_GSOAP_LIST_GET(out.feeds, 0); - feed->primaryServer = strdup("PrimaryServer"); - feed->__sizecondition = 1; - GLITE_SECURITY_GSOAP_LIST_CREATE(&soap, feed, condition, struct jptype__primaryQuery, 1); - cond = GLITE_SECURITY_GSOAP_LIST_GET(feed->condition, 0); - cond->attr = strdup("queryAttr"); - cond->op = jptype__queryOp__EQUAL; - cond->origin = jptype__attrOrig__SYSTEM; - cond->value = calloc(1, sizeof(*(cond->value))); - GSOAP_SETSTRING(cond->value, soap_strdup(&soap, "attrValue")); - feed->history = 1; - feed->continuous = 0; - - soap_serialize__jpelem__ServerConfigurationResponse(&soap, &out); - retval = soap_put__jpelem__ServerConfigurationResponse(&soap, &out, "jpelem:ServerConfiguration", NULL); - soap_end_send(&soap); - soap_free(&soap); - soap_end(&soap); - - return retval; -} -#endif diff --git a/org.glite.jp.index/src/conf.h b/org.glite.jp.index/src/conf.h deleted file mode 100644 index eaa2f77..0000000 --- a/org.glite.jp.index/src/conf.h +++ /dev/null @@ -1,85 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#ifndef _CONF_H -#define _CONF_H - -#include - -#ifndef UNUSED - #ifdef __GNUC__ - #define UNUSED __attribute__((unused)) - #else - #define UNUSED - #endif -#endif - -#define GLITE_JPIS_DEFAULT_PORT_STR "8902" - -//#define lprintf -#define lprintf(args...) glite_jp_lprintf(__FUNCTION__, ##args) -#define llprintf(MODULE, args...) do { \ - if ((MODULE)) glite_jp_lprintf(__FUNCTION__, ##args); \ -} while(0) - - -typedef struct _glite_jp_is_feed { - char *PS_URL; //URLs of Primary Storage servers - glite_jp_query_rec_t *query; // query to Primary Server (aka filter) - int history, // type of query - continuous; - long int uniqueid; // internal ID -} glite_jp_is_feed; - -typedef struct _glite_jp_is_conf { - // all I need to get from comman line options and configuration file - - // arrays are zero-terminated - char **attrs; // atributes to obtain - char **indexed_attrs; // list of indexed atributes - char **multival_attrs; // list of multivalue attributes - char **queriable_attrs; // list of queriable attributes - char **plugins; // list of plugin.so's - - glite_jp_is_feed **feeds; // null terminated list of feeds - - int debug; - int no_auth; // set if you do not want authorization - char *cs, // database contact string - *port, // server port - *pidfile, - *logfile, - *server_cert, - *server_key; - int slaves; - int delete_db; - - char *feeding; // feed DB from local file - int force_feed; -} glite_jp_is_conf; - - - -// read commad line options and configuration file -int glite_jp_get_conf(int argc, char **argv, glite_jp_is_conf **configuration); -void glite_jp_free_conf(glite_jp_is_conf *conf); - -void glite_jp_lprintf(const char *source, const char *fmt, ...); - -#endif diff --git a/org.glite.jp.index/src/context.c b/org.glite.jp.index/src/context.c deleted file mode 100644 index 4f81c55..0000000 --- a/org.glite.jp.index/src/context.c +++ /dev/null @@ -1,55 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include - -#include "conf.h" -#include "context.h" - - -int glite_jpis_init_context(glite_jpis_context_t *isctx, glite_jp_context_t jpctx, glite_jp_is_conf *conf) { - char hname[512]; - char *op_args; - - if ((*isctx = calloc(sizeof(**isctx), 1)) != NULL) { - (*isctx)->jpctx = jpctx; - (*isctx)->conf = conf; - edg_wll_gss_gethostname(hname, sizeof hname); - asprintf(&(*isctx)->hname, "https://%s:%s", hname, (conf && conf->port) ? conf->port : GLITE_JPIS_DEFAULT_PORT_STR); - - op_args = (*isctx)->op_args; - op_args[GLITE_JP_QUERYOP_WITHIN] = 2; - op_args[GLITE_JP_QUERYOP_UNDEF] = 0; - op_args[GLITE_JP_QUERYOP_EQUAL] = 1; - op_args[GLITE_JP_QUERYOP_LESS] = 1; - op_args[GLITE_JP_QUERYOP_GREATER] = 1; - op_args[GLITE_JP_QUERYOP_EXISTS] = 0; - return 0; - } else return ENOMEM; -} - - -void glite_jpis_free_context(glite_jpis_context_t ctx) { - if (!ctx) return; - free(ctx->hname); - free(ctx); -} diff --git a/org.glite.jp.index/src/context.h b/org.glite.jp.index/src/context.h deleted file mode 100644 index a8f3f4d..0000000 --- a/org.glite.jp.index/src/context.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_IS_CONTEXT_H -#define GLITE_JP_IS_CONTEXT_H - -#include -#include -#include -#include "conf.h" - - -typedef struct _glite_jpis_context { - glite_jp_context_t jpctx; - glite_jp_is_conf *conf; - glite_lbu_Statement select_unlocked_feed_stmt, lock_feed_stmt, init_feed_stmt, unlock_feed_stmt, select_info_feed_stmt, update_state_feed_stmt, select_info_attrs_indexed, select_jobid_stmt, select_user_stmt, insert_job_stmt, insert_user_stmt; - - char *hname; - - char op_args[GLITE_JP_QUERYOP__LAST]; -} *glite_jpis_context_t; - -typedef struct _slave_data_t{ - glite_jpis_context_t ctx; - glite_jp_is_conf *conf; - struct soap *soap; -} slave_data_t; - -int glite_jpis_init_context(glite_jpis_context_t *isctx, glite_jp_context_t jpctx, glite_jp_is_conf *conf); -void glite_jpis_free_context(glite_jpis_context_t ctx); -#endif diff --git a/org.glite.jp.index/src/db_ops.c b/org.glite.jp.index/src/db_ops.c deleted file mode 100644 index c8aff72..0000000 --- a/org.glite.jp.index/src/db_ops.c +++ /dev/null @@ -1,889 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define GLITE_JP_INDEX_COMPILE 1 - -#include -#include -#include -#include -#include -#include -#include -#include "glite/jp/known_attr.h" -#include "glite/jp/indexdb.h" - -#include "conf.h" -#include "context.h" -#include "db_ops.h" -#include "common.h" - - -#ifndef LOG_SQL -#define LOG_SQL 1 -#endif - -#define SQLCMD_DROP_DATA_TABLE "DROP TABLE " GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "%s" -#define SQLCMD_CREATE_DATA_TABLE "CREATE TABLE " GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "%s (\n\ - `jobid` CHAR(32) NOT NULL,\n\ - `value` %s NOT NULL,\n\ - `full_value` %s NOT NULL,\n\ - `origin` INT NOT NULL,\n\ -\n\ - INDEX (jobid),\n\ - INDEX (value)\n\ -) CHARACTER SET utf8 COLLATE utf8_bin ENGINE=innodb;" - -#define SQLCMD_CREATE_JOBS_TABLE_BEGIN "CREATE TABLE jobs (\n\ - `jobid` char(32) NOT NULL,\n\ - `dg_jobid` varchar(255) NOT NULL,\n\ - `ownerid` char(32) NOT NULL,\n\ - `aclid` char(32) NOT NULL,\n\ - `ps` varchar(255) NOT NULL,\n" -#define SQLCMD_CREATE_JOBS_TABLE_END "\ - primary key (jobid),\n\ - unique (dg_jobid),\n\ - index (jobid),\n\ - index (dg_jobid)\n\ -) character set utf8 collate utf8_bin engine=innodb;" - -#define SQLCMD_INSERT_ATTRVAL "INSERT INTO " GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "%|Ss (jobid, value, full_value, origin) VALUES (\n\ - '%|Ss',\n\ - '%|Ss',\n\ - '%|Ss',\n\ - '%ld'\n\ -)" -#define SQL_CMD_INSERT_SINGLEATTRVAL "UPDATE jobs \n\ - SET attr_%s='%s' \n\ - WHERE dg_jobid='%s'" - -#define WORD_SWAP(X) ((((X) >> 8) & 0xFF) | (((X) & 0xFF) << 8)) -#define LONG_SWAP(X) (WORD_SWAP(((X) >> 16) & 0xFFFF) | ((WORD_SWAP(X) & 0xFFFF) << 16)) -#if __BYTE_ORDER == __LITTLE_ENDIAN -#define LONG_LE(X) (X) -#else -#define LONG_LE(X) LONG_SWAP(X) -#endif - -#define COND_MAGIC 0x444E4F43 - - -static int glite_jpis_db_queries_deserialize(glite_jp_query_rec_t **queries, void *blob, size_t blob_size) UNUSED; - - -static int is_indexed(glite_jp_is_conf *conf, const char *attr) { - return glite_jpis_find_attr(conf->indexed_attrs, attr); -} - -static int is_singleval(glite_jp_is_conf *conf, const char *attr) { - return !glite_jpis_find_attr(conf->multival_attrs, attr); -} - -static int is_queriable(glite_jp_is_conf *conf, const char *attr){ - return glite_jpis_find_attr(conf->queriable_attrs, attr); -} - -static size_t db_arg1_length(glite_jpis_context_t isctx, glite_jp_query_rec_t *query) { - size_t len; - - assert(query->op > GLITE_JP_QUERYOP_UNDEF && query->op <= GLITE_JP_QUERYOP__LAST); - if (isctx->op_args[query->op] >= 1) - len = query->binary ? query->size : (query->value ? strlen(query->value) + 1 : 0); - else len = 0; - - return len; -} - -static size_t db_arg2_length(glite_jpis_context_t isctx, glite_jp_query_rec_t *query) { - size_t len; - - assert(query->op > GLITE_JP_QUERYOP_UNDEF && query->op <= GLITE_JP_QUERYOP__LAST); - if (isctx->op_args[query->op] >= 1) - len = query->binary ? query->size2 : (query->value2 ? strlen(query->value2) + 1 : 0); - else len = 0; - - return len; -} - - -static int array_init(void **data, size_t *len, size_t *maxlen, size_t initial_len) { - *len = 0; - if ((*data = malloc(initial_len)) != NULL) { - *maxlen = initial_len; - return 0; - } else { - *maxlen = 0; - return ENOMEM; - } -} - - -static int array_add(void **data, size_t *len, size_t *maxlen, void *new_data, size_t new_data_len) { - void *tmp; - size_t ptr; - - ptr = *len; - (*len) += new_data_len; - if (*len > *maxlen) { - do { - (*maxlen) *= 2; - } while (*len > *maxlen); - if ((tmp = realloc(*data, *maxlen)) == NULL) return ENOMEM; - *data = tmp; - } - memcpy(((char *)(*data)) + ptr, new_data, new_data_len); - - return 0; -} - - -static int array_add_long(void **data, size_t *len, size_t *maxlen, uint32_t l) { - uint32_t lel; - - lel = LONG_LE(l); - return array_add(data, len, maxlen, &lel, sizeof(uint32_t)); -} - - -static uint32_t array_get_long(void **data) { - uint32_t *lel; - - lel = (uint32_t *)*data; - *data = ((char *)*data) + sizeof(uint32_t); - - return LONG_LE(*lel); -} - - -static void *array_get(void **data, size_t data_len) { - void *res; - - res = *data; - *data = ((char *)*data) + data_len; - - return res; -} - - -static int glite_jpis_db_queries_serialize(glite_jpis_context_t isctx, void **blob, size_t *len, glite_jp_query_rec_t *queries) { - size_t maxlen; - glite_jp_query_rec_t *query; - int ret; - size_t datalen; - - if ((ret = array_init(blob, len, &maxlen, 1024)) != 0) return ret; - query = queries; - while(query && query->attr) { - if ((ret = array_add_long(blob, len, &maxlen, COND_MAGIC)) != 0) goto fail; - datalen = strlen(query->attr) + 1; - if ((ret = array_add_long(blob, len, &maxlen, datalen)) != 0) goto fail; - if ((ret = array_add(blob, len, &maxlen, query->attr, datalen)) != 0) goto fail; - if ((ret = array_add_long(blob, len, &maxlen, query->op)) != 0) goto fail; - if ((ret = array_add_long(blob, len, &maxlen, query->binary ? 1 : 0)) != 0) goto fail; - - datalen = db_arg1_length(isctx, query); - if ((ret = array_add_long(blob, len, &maxlen, datalen)) != 0) goto fail; - if (datalen) - if ((ret = array_add(blob, len, &maxlen, query->value, datalen)) != 0) goto fail; - - datalen = db_arg2_length(isctx, query); - if ((ret = array_add_long(blob, len, &maxlen, datalen)) != 0) goto fail; - if (datalen) - if ((ret = array_add(blob, len, &maxlen, query->value2, datalen)) != 0) goto fail; - - query++; - } - - return 0; -fail: - free(*blob); - *len = 0; - return ret; -} - - -static int glite_jpis_db_queries_deserialize(glite_jp_query_rec_t **queries, void *blob, size_t blob_size) { - size_t maxlen, len, datalen; - void *blob_ptr, *blob_end; - int ret; - uint32_t l; - glite_jp_query_rec_t query; - int i; - - if ((ret = array_init((void *)queries, &len, &maxlen, 512)) != 0) return ret; - blob_ptr = blob; - blob_end = (char *)blob + blob_size; - while (blob_end > blob_ptr) { - ret = ENOMEM; - memset(&query, 0, sizeof query); - l = array_get_long(&blob_ptr); - if (l != COND_MAGIC) { - lprintf("blob=%p, blob_ptr=%p, 0x%08" PRIX32 "\n", blob, blob_ptr, l); - ret = EINVAL; - goto fail_query; - } - - datalen = array_get_long(&blob_ptr); - if (datalen) { - if ((query.attr = malloc(datalen)) == NULL) goto fail_query; - memcpy(query.attr, array_get(&blob_ptr, datalen), datalen); - } else query.attr = NULL; - - query.op = array_get_long(&blob_ptr); - query.binary = array_get_long(&blob_ptr); - - datalen = array_get_long(&blob_ptr); - if (datalen) { - if ((query.value = malloc(datalen)) == NULL) goto fail_query; - memcpy(query.value, array_get(&blob_ptr, datalen), datalen); - } else query.value = NULL; - query.size = datalen; - - datalen = array_get_long(&blob_ptr); - if (datalen) { - if ((query.value2 = malloc(datalen)) == NULL) goto fail_query; - memcpy(query.value2, array_get(&blob_ptr, datalen), datalen); - } else query.value2 = NULL; - query.size2 = datalen; - - if ((ret = array_add((void *)queries, &len, &maxlen, &query, sizeof(query))) != 0) goto fail_query; - } - assert(blob_end == blob_ptr); - - memset(&query, 0, sizeof query); - if ((ret = array_add((void *)queries, &len, &maxlen, &query, sizeof(query))) != 0) goto fail; - - return 0; - -fail_query: -fail: - i = 0; - while ((*queries)[i].attr) { - free((*queries)[i].attr); - free((*queries)[i].value); - free((*queries)[i].value2); - i++; - } - free(*queries); - return ret; -} - - -/* Init the database. - * - * \retval 0 OK - * \retval non-zero JP error code - */ - -int glite_jpis_initDatabase(glite_jpis_context_t ctx) { - char **attrs, *attrid, *num; - const char *type_index, *type_full; - size_t i; - int indexed, nattrs; - char sql[2048]; - glite_jp_context_t jpctx = ctx->jpctx; - glite_lbu_Statement stmt = NULL; - - jpctx = ctx->jpctx; - - // check, if database was already created - if (glite_jp_db_ExecSQL(jpctx, "SELECT COUNT(*) FROM attrs", &stmt) < 0) { - glite_jpis_stack_error(ctx->jpctx, EIO, "error during counting attrs"); - goto fail; - } - if (glite_jp_db_FetchRow(jpctx, stmt, 1, NULL, &num) < 0) { - glite_jpis_stack_error(ctx->jpctx, EIO, "error during fetching attrs"); - goto fail; - } - nattrs = atoi(num); - llprintf(LOG_SQL, "found '%s' attributes in attrs table\n", num, nattrs); - free(num); - glite_jp_db_FreeStmt(&stmt); - if (nattrs != 0) { - lprintf("database with %d attributes kept (use -D for delete)\n", nattrs); - return 0; - } - - if (glite_jp_db_PrepareStmt(jpctx, "INSERT INTO attrs (attrid, name, indexed, type) VALUES (?, ?, ?, ?)", &stmt) != 0) { - glite_jpis_stack_error(ctx->jpctx, EIO, "can't create insert attributes statement"); - goto fail; - } - - // attrs table and attrid_* tables - attrs = ctx->conf->attrs; - i = 0; - if (attrs) while (attrs[i]) { - type_full = glite_jp_attrval_db_type_full(jpctx, attrs[i]); - type_index = glite_jp_attrval_db_type_index(jpctx, attrs[i], GLITE_JPIS_INDEX_LENGTH); - - attrid = glite_jp_indexdb_attr2id(attrs[i]); - indexed = is_indexed(ctx->conf, attrs[i]); - if (glite_jp_db_ExecPreparedStmt(jpctx, stmt, 4, - GLITE_LBU_DB_TYPE_VARCHAR, attrid, - GLITE_LBU_DB_TYPE_VARCHAR, attrs[i], - GLITE_LBU_DB_TYPE_INT, indexed, - GLITE_LBU_DB_TYPE_VARCHAR, type_full) == -1) { - glite_jpis_stack_error(ctx->jpctx, EIO, "can't create '%s' attribute", attrs[i]); - goto fail; - } - - // silently drop - sql[sizeof(sql) - 1] = '\0'; - snprintf(sql, sizeof(sql), SQLCMD_DROP_DATA_TABLE, attrid); - llprintf(LOG_SQL, "preventive dropping '%s' ==> '%s'\n", attrid, sql); - glite_jp_db_ExecSQL(jpctx, sql, NULL); - glite_jp_clear_error(ctx->jpctx); - - // create table - sql[sizeof(sql) - 1] = '\0'; - snprintf(sql, sizeof(sql) - 1, SQLCMD_CREATE_DATA_TABLE, attrid, type_index, type_full); - free(attrid); - llprintf(LOG_SQL, "creating table: '%s'\n", sql); - if ((glite_jp_db_ExecSQL(jpctx, sql, NULL)) == -1) { - glite_jpis_stack_error(ctx->jpctx, EAGAIN, "if the atribute table already exists, restart may help"); - goto fail; - } - - i++; - } - glite_jp_db_FreeStmt(&stmt); - - // create jobs table - snprintf(sql, sizeof(sql) - 1, SQLCMD_CREATE_JOBS_TABLE_BEGIN); - if (ctx->conf->attrs) for (i = 0; ctx->conf->attrs[i]; i++) - if (is_singleval(ctx->conf, ctx->conf->attrs[i]) - && is_queriable(ctx->conf, ctx->conf->attrs[i])){ - snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), - " `attr_%s` %s NOT NULL,\n", - glite_jp_indexdb_attr2id(ctx->conf->attrs[i]), - glite_jp_attrval_db_type_index(jpctx, ctx->conf->attrs[i], GLITE_JPIS_INDEX_LENGTH)); - - if (is_indexed(ctx->conf, ctx->conf->attrs[i])) - snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), - " index (attr_%s), \n", - glite_jp_indexdb_attr2id(ctx->conf->attrs[i])); - } - snprintf(sql + strlen(sql), sizeof(sql) - strlen(sql), SQLCMD_CREATE_JOBS_TABLE_END); - llprintf(LOG_SQL, "sql=%s\n", sql); - if ((glite_jp_db_ExecSQL(jpctx, sql, NULL)) == -1) { - glite_jpis_stack_error(ctx->jpctx, EAGAIN, "Cannot create table 'jobs'!"); - goto fail; - } - - return 0; - -fail: - glite_jp_db_FreeStmt(&stmt); - if (!jpctx->error) glite_jpis_stack_error(ctx->jpctx, EIO, "error during initial filling of the database"); - return jpctx->error->code; -} - - -int glite_jpis_initDatabaseFeeds(glite_jpis_context_t ctx) { - glite_jp_context_t jpctx = ctx->jpctx; - glite_lbu_Statement stmt = NULL; - glite_jp_is_feed **feeds; - size_t i; - size_t conds_len; - void *conds; - int state, locked; - - if (glite_jp_db_ExecSQL(jpctx, "DELETE FROM feeds", NULL) == -1) { - glite_jpis_stack_error(ctx->jpctx, EIO, "can't delete feeds"); - goto fail; - } - - // feeds table - if (glite_jp_db_PrepareStmt(jpctx, "INSERT INTO feeds (`state`, `locked`, `source`, `condition`) VALUES (?, ?, ?, ?)", &stmt) != 0) { - glite_jpis_stack_error(ctx->jpctx, EIO, "can't create insert feeds statement"); - goto fail; - } - feeds = ctx->conf->feeds; - i = 0; - if (feeds) while (feeds[i]) { - state = (feeds[i]->history ? GLITE_JP_IS_STATE_HIST : 0) | - (feeds[i]->continuous ? GLITE_JP_IS_STATE_CONT : 0); - locked = 0; - assert(glite_jpis_db_queries_serialize(ctx, &conds, &conds_len, feeds[i]->query) == 0); - if (glite_jp_db_ExecPreparedStmt(jpctx, stmt, 4, - GLITE_LBU_DB_TYPE_INT, state, - GLITE_LBU_DB_TYPE_INT, locked, - GLITE_LBU_DB_TYPE_VARCHAR, feeds[i]->PS_URL, - GLITE_LBU_DB_TYPE_MEDIUMBLOB, conds, conds_len) == -1) - goto fail_conds; - free(conds); - conds = NULL; - feeds[i]->uniqueid = glite_lbu_Lastid(stmt); - - i++; - } - glite_jp_db_FreeStmt(&stmt); - return 0; - -fail_conds: - free(conds); -fail: - glite_jp_db_FreeStmt(&stmt); - if (!jpctx->error) glite_jpis_stack_error(ctx->jpctx, EIO, "error during initial filling of the database"); - return jpctx->error->code; -} - - -/* Drop the whole database. - * - * \retval 0 OK - * \retval non-zero JP error code - */ - -int glite_jpis_dropDatabase(glite_jpis_context_t ctx) { - char *attrid, sql[256]; - unsigned long len; - int ret; - glite_jp_context_t jpctx = ctx->jpctx; - glite_lbu_Statement stmt_tabs = NULL; - - // search data tables and drop them - if (glite_jp_db_PrepareStmt(jpctx, "SELECT attrid FROM attrs", &stmt_tabs) != 0) goto fail; - if (glite_jp_db_ExecPreparedStmt(jpctx, stmt_tabs, 0) == -1) goto fail; - while ((ret = glite_jp_db_FetchRow(jpctx, stmt_tabs, 1, &len, &attrid)) > 0) { - snprintf(sql, sizeof(sql), SQLCMD_DROP_DATA_TABLE, attrid); - llprintf(LOG_SQL, "dropping '%s' ==> '%s'\n", attrid, sql); - if (glite_jp_db_ExecSQL(jpctx, sql, NULL) == -1) printf("warning: can't drop table '" GLITE_JP_INDEXDB_TABLE_ATTR_PREFIX "%s': %s (%s)\n", attrid, jpctx->error->desc, jpctx->error->source); - } - if (ret != 0) goto fail; - glite_jp_db_FreeStmt(&stmt_tabs); - snprintf(sql, sizeof(sql)-1, "DROP TABLE jobs"); - llprintf(LOG_SQL, "dropping 'jobs'"); - if (glite_jp_db_ExecSQL(jpctx, sql, NULL) == -1) printf("warning: can't drop table 'jobs'\n"); - - // drop feeds and atributes - if (glite_jp_db_ExecSQL(jpctx, "DELETE FROM attrs", NULL) == -1) goto fail; - if (glite_jp_db_ExecSQL(jpctx, "DELETE FROM feeds", NULL) == -1) goto fail; - if (glite_jp_db_ExecSQL(jpctx, "DELETE FROM users", NULL) == -1) goto fail; - if (glite_jp_db_ExecSQL(jpctx, "DELETE FROM acls", NULL) == -1) goto fail; - - return 0; - -fail: - glite_jp_db_FreeStmt(&stmt_tabs); - return jpctx->error->code; -} - - -int glite_jpis_init_db(glite_jpis_context_t isctx) { - int ret, caps; - const char *cs; - glite_jp_context_t jpctx; - - jpctx = isctx->jpctx; - if (glite_lbu_InitDBContext(((glite_lbu_DBContext *)&jpctx->dbhandle)) != 0) goto fail_db; - if ((cs = isctx->conf->cs) == NULL) cs = GLITE_JP_IS_DEFAULTCS; - if (glite_lbu_DBConnect(jpctx->dbhandle, cs) != 0) goto fail_db; - - // try transaction for feeding - if (isctx->conf->feeding) { - caps = glite_lbu_DBQueryCaps(jpctx->dbhandle); - if (caps != -1) { - glite_lbu_DBSetCaps(jpctx->dbhandle, caps); - llprintf(LOG_SQL, "transactions %s\n", (caps & GLITE_LBU_DB_CAP_TRANSACTIONS) ? "supported" : "not supported"); - } - } - - // sql command: lock the feed (via uniqueid) - if ((ret = glite_jp_db_PrepareStmt(jpctx, "UPDATE feeds SET locked=1 WHERE (locked = 0) AND (uniqueid = ?)", &isctx->lock_feed_stmt)) != 0) goto fail; - - // sql command: assign the feed (via uniqueid) - if ((ret = glite_jp_db_PrepareStmt(jpctx, "UPDATE feeds SET feedid=?, expires=?, state=? WHERE (uniqueid=?)", &isctx->init_feed_stmt)) != 0) goto fail; - - // sql command: unlock the feed (via uniqueid) - if ((ret = glite_jp_db_PrepareStmt(jpctx, "UPDATE feeds SET locked=0 WHERE (uniqueid=?)", &isctx->unlock_feed_stmt)) != 0) goto fail; - - // sql command: get info about the feed (via feedid) - if ((ret = glite_jp_db_PrepareStmt(jpctx, "SELECT uniqueid, state, source FROM feeds WHERE (feedid=?)", &isctx->select_info_feed_stmt)) != 0) goto fail; - - // sql command: update state of the feed (via uniqueid) - if ((ret = glite_jp_db_PrepareStmt(jpctx, "UPDATE feeds SET state=? WHERE (uniqueid=?)", &isctx->update_state_feed_stmt)) != 0) goto fail; - - // sql command: check for job with jobid - if ((ret = glite_jp_db_PrepareStmt(jpctx, "SELECT jobid FROM jobs WHERE jobid=?", &isctx->select_jobid_stmt)) != 0) goto fail; - - // sql command: insert the job - if ((ret = glite_jp_db_PrepareStmt(jpctx, "INSERT INTO jobs (jobid, dg_jobid, ownerid, ps) VALUES (?, ?, ?, ?)", &isctx->insert_job_stmt)) != 0) goto fail; - - // sql command: check the user - if ((ret = glite_jp_db_PrepareStmt(jpctx, "SELECT userid FROM users WHERE userid=?", &isctx->select_user_stmt)) != 0) goto fail; - - // sql command: insert the user - if ((ret = glite_jp_db_PrepareStmt(jpctx, "INSERT INTO users (userid, cert_subj) VALUES (?, ?)", &isctx->insert_user_stmt)) != 0) goto fail; - - return 0; - -fail_db: - ret = glite_jp_db_SetError(jpctx, __FUNCTION__); -fail: - glite_jpis_free_db(isctx); - return ret; -} - - -void glite_jpis_free_db(glite_jpis_context_t ctx) { - glite_jp_db_FreeStmt(&ctx->lock_feed_stmt); - glite_jp_db_FreeStmt(&ctx->init_feed_stmt); - glite_jp_db_FreeStmt(&ctx->unlock_feed_stmt); - glite_jp_db_FreeStmt(&ctx->select_info_feed_stmt); - glite_jp_db_FreeStmt(&ctx->update_state_feed_stmt); - glite_jp_db_FreeStmt(&ctx->select_jobid_stmt); - glite_jp_db_FreeStmt(&ctx->select_user_stmt); - glite_jp_db_FreeStmt(&ctx->insert_job_stmt); - glite_jp_db_FreeStmt(&ctx->insert_user_stmt); - glite_lbu_DBClose(ctx->jpctx->dbhandle); - glite_lbu_FreeDBContext(ctx->jpctx->dbhandle); - ctx->jpctx->dbhandle = NULL; -} - - -/* Find first unitialized feed, lock it and return URL of corresponding PS - * - * Return value: - * 0 - OK - * ENOENT - no more feeds to initialize - * ENOLCK - error during locking */ - -int glite_jpis_lockSearchFeed(glite_jpis_context_t ctx, int initialized, long int *uniqueid, char **PS_URL, int *status, char **feedid) -{ - int ret; - static int uninit_msg = 1; - char *sql, *res[4], *t, *ps; - glite_lbu_Statement stmt; - - if (feedid) *feedid = NULL; - do { - glite_lbu_TimeToDB(time(NULL), &t); - if (initialized) { - trio_asprintf(&sql, "SELECT uniqueid, source, state, feedid FROM feeds WHERE (locked=0) AND (feedid IS NOT NULL) AND (expires <= %s)", t); - } else - trio_asprintf(&sql, "SELECT uniqueid, source, state, feedid FROM feeds WHERE (locked=0) AND (feedid IS NULL) AND ((state < " GLITE_JP_IS_STATE_ERROR_STR ") OR (expires <= %s))", t); - free(t); - //llprintf(LOG_SQL, "sql=%s\n", sql); - ret = glite_jp_db_ExecSQL(ctx->jpctx, sql, &stmt); - free(sql); - switch (ret) { - case -1: - glite_jpis_stack_error(ctx->jpctx, ENOLCK, "error selecting unlocked feed"); - uninit_msg = 1; - glite_jp_db_FreeStmt(&stmt); - return ENOLCK; - case 0: - if (uninit_msg) { - lprintf("no more %s feeds for now\n", initialized ? "not-refreshed" : "uninitialized"); - uninit_msg = 0; - } - glite_jp_db_FreeStmt(&stmt); - return ENOENT; - default: break; - } - uninit_msg = 1; - if (glite_jp_db_FetchRow(ctx->jpctx, stmt, sizeof(res)/sizeof(res[0]), NULL, res) <= 0) { - glite_jpis_stack_error(ctx->jpctx, ENOLCK, "error fetching unlocked feed"); - glite_jp_db_FreeStmt(&stmt); - return ENOLCK; - } - glite_jp_db_FreeStmt(&stmt); - lprintf("selected feed, uniqueid=%s\n", res[0]); - *uniqueid = atol(res[0]); free(res[0]); - ps = res[1]; - if (status) *status = atoi(res[2]); free(res[2]); - if (feedid) { - free(*feedid); - *feedid = res[3]; - } else free(res[3]); - - ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->lock_feed_stmt, 1, GLITE_LBU_DB_TYPE_INT, *uniqueid); - lprintf("locked %d feeds (uniqueid=%ld)\n", ret, *uniqueid); - } while (ret != 1); - - if (PS_URL) *PS_URL = ps; - else free(ps); - - return 0; -} - - -/* Store feed ID and expiration time returned by PS for locked feed. */ - -int glite_jpis_initFeed(glite_jpis_context_t ctx, long int uniqueid, const char *feedId, time_t feedExpires, int status) -{ - int ret; - time_t tnow, expires; - - tnow = time(NULL); - expires = tnow + (feedExpires - tnow) / 2; - - ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->init_feed_stmt, 4, - GLITE_LBU_DB_TYPE_CHAR, feedId, - GLITE_LBU_DB_TYPE_DATETIME, expires, - GLITE_LBU_DB_TYPE_INT, status, - GLITE_LBU_DB_TYPE_INT, uniqueid); - lprintf("initializing feed, uniqueid=%ld, result=%d\n", uniqueid, ret); - - return ret == 1 ? 0 : ENOLCK; -} - - -/* Unlock given feed */ - -int glite_jpis_unlockFeed(glite_jpis_context_t ctx, long int uniqueid) { - int ret; - - ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->unlock_feed_stmt, 1, GLITE_LBU_DB_TYPE_INT, uniqueid); - lprintf("unlocking feed, uniqueid=%ld, result=%d\n", uniqueid, ret); - - return ret == 1 ? 0 : ENOLCK; -} - - -/* Saves TTL (when to reconnect if error occured) for given feed */ - -int glite_jpis_tryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time, int state) { - int ret; - char *sql, *t; - - glite_lbu_TimeToDB(reconn_time, &t); - lprintf("reconnect, un=%ld, %s\n", uniqueid, t); - trio_asprintf(&sql, "UPDATE feeds SET state=%d, expires=%s WHERE (uniqueid=%ld)", state, t, uniqueid); - free(t); - if ((ret = glite_jp_db_ExecSQL(ctx->jpctx, sql, NULL)) != 1) - glite_jpis_stack_error(ctx->jpctx, EIO, "can't update feed no. %ld in DB", uniqueid); - free(sql); - return ret == -1 ? ctx->jpctx->error->code : 0; -} - - -// TODO: could be merged with initFeed -int glite_jpis_destroyTryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time) { - int ret; - char *sql, *t; - - glite_lbu_TimeToDB(reconn_time, &t); - lprintf("destroy not refreshed feed, un=%ld, %s\n", uniqueid, t); - trio_asprintf(&sql, "UPDATE feeds SET feedid=NULL, state=0, expires=%s WHERE (uniqueid=%ld)", t, uniqueid); - free(t); - if ((ret = glite_jp_db_ExecSQL(ctx->jpctx, sql, NULL)) != 1) - glite_jpis_stack_error(ctx->jpctx, EIO, "can't destroy non-refreshable feed no. %ld in DB", uniqueid); - free(sql); - return ret == -1 ? ctx->jpctx->error->code : 0; -} - - -int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av) { - char *sql, *table, *value, *full_value, *md5_jobid; - long int origin; - glite_jp_error_t err; - - glite_jp_clear_error(ctx->jpctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - table = glite_jp_indexdb_attr2id(av->name); - value = glite_jp_attrval_to_db_index(ctx->jpctx, av, GLITE_JPIS_INDEX_LENGTH); - full_value = glite_jp_attrval_to_db_full(ctx->jpctx, av); - md5_jobid = str2md5(jobid); - origin = av->origin; - trio_asprintf(&sql, SQLCMD_INSERT_ATTRVAL, table, md5_jobid, value, full_value, origin); - llprintf(LOG_SQL, "(%s) sql=%s\n", av->name, sql); -// if (ctx->conf->feeding) printf("FEED: %s\n", sql); -// else - if (glite_jp_db_ExecSQL(ctx->jpctx, sql, NULL) != 1){ - err.code = EIO; - err.desc = "DB access failed"; - goto cleanup; - } - free(sql); sql=NULL; - - if (is_singleval(ctx->conf, av->name) && is_queriable(ctx->conf, av->name)){ - trio_asprintf(&sql, SQL_CMD_INSERT_SINGLEATTRVAL, - glite_jp_indexdb_attr2id(av->name), value, jobid); - llprintf(LOG_SQL, "(%s) sql=%s\n", av->name, sql); - if (glite_jp_db_ExecSQL(ctx->jpctx, sql, NULL) != 1){ - err.code = EIO; - err.desc = "DB access failed"; - goto cleanup; - } - free(sql);sql=NULL; - } - -cleanup: - free(md5_jobid); - free(table); - free(value); - free(full_value); - - if (err.code) { - return glite_jpis_stack_error(ctx->jpctx, err.code, err.desc); - } else { - return 0; - } -} - - -int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *ps, const char *jobid, const char *owner) { - int ret; - char *md5_jobid = NULL, *md5_cert = NULL; - - lprintf("\n"); - - if (!jobid || !owner) { - glite_jpis_stack_error(ctx->jpctx, EINVAL, "jobid and owner is mandatory (jobid=%s, owner=%s)!\n", jobid, owner); - goto fail; - } - md5_jobid = str2md5(jobid); - md5_cert = str2md5(owner); - switch (ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->select_jobid_stmt, 1, GLITE_LBU_DB_TYPE_CHAR, md5_jobid)) { - case 1: lprintf("jobid '%s' found\n", jobid); goto ok0; - case 0: - lprintf("inserting jobid %s (%s)\n", jobid, md5_jobid); - if (glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->insert_job_stmt, 4, - GLITE_LBU_DB_TYPE_CHAR, md5_jobid, - GLITE_LBU_DB_TYPE_VARCHAR, jobid, - GLITE_LBU_DB_TYPE_CHAR, md5_cert, - GLITE_LBU_DB_TYPE_CHAR, ps) != 1) goto fail; - break; - default: assert(ret != 1); break; - } -ok0: - - switch (ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->select_user_stmt, 1, GLITE_LBU_DB_TYPE_CHAR, md5_cert)) { - case 1: lprintf("owner '%s' found\n", owner); goto ok; - case 0: - lprintf("inserting user %s (%s)\n", owner, md5_cert); - if (glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->insert_user_stmt, 2, - GLITE_LBU_DB_TYPE_CHAR, md5_cert, - GLITE_LBU_DB_TYPE_VARCHAR, owner) != 1) goto fail; - break; - default: assert(ret != 1); break; - } - -ok: - free(md5_jobid); - free(md5_cert); - return 0; -fail: - free(md5_jobid); - free(md5_cert); - return ctx->jpctx->error->code; -} - - -#define FEEDING_SEPARATORS ";" -#define FEEDING_JOBID_BKSERVER "localhost-test" -#define FEEDING_JOBID_PORT 0 -#define FEEDING_PRIMARY_STORAGE "localhost:8901" -#define FEEDING_DEFAULT_OWNER "God" -int glite_jpis_feeding(glite_jpis_context_t ctx, const char *fname, const char *dn) { - FILE *f; - char line[1024], *token, *lasts, *jobid = NULL; - int nattrs, lno, i, iname, c; - glite_jp_attrval_t *avs; - glite_jobid_t j; - const char *owner = dn ? dn : FEEDING_DEFAULT_OWNER; - - if ((f = fopen(fname, "rt")) == NULL) { - glite_jpis_stack_error(ctx->jpctx, errno, "can't open csv dump file"); - return 1; - } - - for (nattrs = 0; ctx->conf->attrs[nattrs]; nattrs++); - avs = malloc(nattrs * sizeof avs[0]); - - lno = 0; - while(fgets(line, sizeof line, f) != NULL) { - if ((lno % 100) == 0) { - if (lno) glite_jp_db_Commit(ctx->jpctx); - glite_jp_db_Transaction(ctx->jpctx); - } - lno++; - if (line[0]) { - c = strlen(line) - 1; - if (line[c] != '\r' && line[c] != '\n' && !feof(f)) { - glite_jpis_stack_error(ctx->jpctx, E2BIG, "line too large at %d (max. %d)", lno, sizeof line); - goto err; - } - while (c >= 0 && (line[c] == '\r' || line[c] == '\n')) c--; - line[c + 1] = 0; - } -// printf("'%s'\n", line); - - memset(avs, 0, nattrs * sizeof avs[0]); - i = 0; - iname = 0; - token = strtok_r(line, FEEDING_SEPARATORS, &lasts); - while (token && iname < nattrs) { -// printf("\t'%s'\n", token); - do { - avs[i].name = ctx->conf->attrs[iname]; - iname++; - } while (strcasecmp(avs[i].name, GLITE_JP_ATTR_JOBID) == 0 || strcasecmp(avs[i].name, GLITE_JP_ATTR_OWNER) == 0); - glite_jpis_trim(token); - avs[i].value = token; - avs[i].timestamp = time(NULL); - avs[i].origin = GLITE_JP_ATTR_ORIG_FILE; -// printf("\t %d: %s = '%s'\n", i, avs[i].name, avs[i].value); - i++; - - token = strtok_r(NULL, FEEDING_SEPARATORS, &lasts); - } - - if (glite_jobid_create(FEEDING_JOBID_BKSERVER, FEEDING_JOBID_PORT, &j) != 0) { - glite_jpis_stack_error(ctx->jpctx, errno, "can't create jobid"); - goto err; - } - if ((jobid = glite_jobid_unparse(j)) == NULL) { - glite_jobid_free(j); - glite_jpis_stack_error(ctx->jpctx, ENOMEM, "can't unparse jobid"); - goto err; - } - glite_jobid_free(j); - if (glite_jpis_lazyInsertJob(ctx, FEEDING_PRIMARY_STORAGE, jobid, owner)) goto err; - for (i = 0; i < nattrs && avs[i].name; i++) { - if (glite_jpis_insertAttrVal(ctx, jobid, &avs[i])) goto err; - } - free(jobid); jobid = NULL; - } - glite_jp_db_Commit(ctx->jpctx); - - fclose(f); - free(avs); - return 0; -err: - fclose(f); - free(avs); - free(jobid); - glite_jp_db_Rollback(ctx->jpctx); - return 1; -} diff --git a/org.glite.jp.index/src/db_ops.h b/org.glite.jp.index/src/db_ops.h deleted file mode 100644 index 23af5f0..0000000 --- a/org.glite.jp.index/src/db_ops.h +++ /dev/null @@ -1,67 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#ifndef _DB_OPS_H -#define _DB_OPS_H - - -#include -#include -#include "context.h" - - -#define GLITE_JP_IS_DEFAULTCS "jpis/@localhost:jpis" - -#define GLITE_JP_IS_STATE_HIST 1 -#define GLITE_JP_IS_STATE_CONT 2 -#define GLITE_JP_IS_STATE_DONE 4 -#define GLITE_JP_IS_STATE_ERROR 8 -#define GLITE_JP_IS_STATE_ERROR_STR "8" - -#define GLITE_JPIS_INDEX_LENGTH 255 - -#define GLITE_JPIS_PARAM(DEST, DEST_LEN, SRC) do { \ - (DEST)[sizeof((DEST)) - 1] = '\0'; \ - strncpy((DEST), (SRC), sizeof((DEST)) - 1); \ - (DEST_LEN) = strlen((SRC)); \ -} while(0) - - -char *glite_jpis_attr_name2id(const char *name); - -int glite_jpis_initDatabase(glite_jpis_context_t ctx); -int glite_jpis_initDatabaseFeeds(glite_jpis_context_t ctx); -int glite_jpis_dropDatabase(glite_jpis_context_t ctx); - -int glite_jpis_init_db(glite_jpis_context_t isctx); -void glite_jpis_free_db(glite_jpis_context_t ctx); - -int glite_jpis_lockSearchFeed(glite_jpis_context_t ctx, int initialized, long int *uinqueid, char **PS_URL, int *status, char **feedid); -int glite_jpis_initFeed(glite_jpis_context_t ctx, long int uniqueid, const char *feedId, time_t feedExpires, int status); -int glite_jpis_unlockFeed(glite_jpis_context_t ctx, long int uniqueid); -int glite_jpis_tryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time, int state); -int glite_jpis_destroyTryReconnectFeed(glite_jpis_context_t ctx, long int uniqueid, time_t reconn_time); - -int glite_jpis_insertAttrVal(glite_jpis_context_t ctx, const char *jobid, glite_jp_attrval_t *av); - -int glite_jpis_lazyInsertJob(glite_jpis_context_t ctx, const char *ps, const char *jobid, const char *owner); - -int glite_jpis_feeding(glite_jpis_context_t ctx, const char *fname, const char *dn); - -#endif diff --git a/org.glite.jp.index/src/simple_server.c b/org.glite.jp.index/src/simple_server.c deleted file mode 100644 index 593d05d..0000000 --- a/org.glite.jp.index/src/simple_server.c +++ /dev/null @@ -1,56 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include "glite/jp/types.h" -#include "glite/jp/context.h" - -#include "jp_H.h" - -int main() { - struct soap soap; - int i, m, s; // master and slave sockets - - glite_jp_context_t ctx; - - soap_init(&soap); - glite_jp_init_context(&ctx); - soap.user = (void *) ctx; - - srand48(time(NULL)); /* feed id generation */ - - m = soap_bind(&soap, NULL, 8902, 100); - if (m < 0) - soap_print_fault(&soap, stderr); - else - { - fprintf(stderr, "Socket connection successful: master socket = %d\n", m); - for (i = 1; ; i++) { - s = soap_accept(&soap); - if (s < 0) { - soap_print_fault(&soap, stderr); - break; - } - soap_serve(&soap); // process RPC request - soap_destroy(&soap); // clean up class instances - soap_end(&soap); // clean up everything and close socket - glite_jp_run_deferred(ctx); - } - } - soap_done(&soap); // close master socket - - return 0; -} diff --git a/org.glite.jp.index/src/soap_ops.c b/org.glite.jp.index/src/soap_ops.c deleted file mode 100644 index 60ba31c..0000000 --- a/org.glite.jp.index/src/soap_ops.c +++ /dev/null @@ -1,738 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "glite/jobid/strmd5.h" -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/attr.h" -#include "glite/jp/known_attr.h" -#include "glite/jp/indexdb.h" - -#include "jp_H.h" -#include "soap_version.h" -#include "glite/security/glite_gscompat.h" -#include "db_ops.h" -#include "ws_ps_typeref.h" -#include "ws_is_typeref.h" -#include "context.h" -#include "common.h" - -#define INDEXED_STRIDE 2 // how often realloc indexed attr result - // XXX: 2 is only for debugging, replace with e.g. 100 -#define JOBIDS_STRIDE 2 // how often realloc matched jobids result - -/*------------------*/ -/* Helper functions */ -/*------------------*/ - -#include "glite/jp/ws_fault.c" - - - -/*-----------------------------------------*/ -/* IS WSDL server function implementations */ -/*-----------------------------------------*/ - - -#define CONTEXT_FROM_SOAP(soap,ctx) glite_jpis_context_t ctx = (glite_jpis_context_t) ((slave_data_t *) (soap->user))->ctx - - -static int updateJob(glite_jpis_context_t ctx, const char *ps, struct jptype__jobRecord *jobAttrs) { - glite_jp_attrval_t av; - struct jptype__attrValue *attr; - int ret, iattrs; - - lprintf("jobid='%s', attrs=%d\n", jobAttrs->jobid, jobAttrs->__sizeattributes); - - if (jobAttrs->remove) assert(*(jobAttrs->remove) == GLITE_SECURITY_GSOAP_FALSE); - - if ((ret = glite_jpis_lazyInsertJob(ctx, ps, jobAttrs->jobid, jobAttrs->owner)) != 0) return ret; - for (iattrs = 0; iattrs < jobAttrs->__sizeattributes; iattrs++) { - attr = GLITE_SECURITY_GSOAP_LIST_GET(jobAttrs->attributes, iattrs); - glite_jpis_SoapToAttrVal(&av, attr); - if (!glite_jpis_find_attr(ctx->conf->attrs, av.name)) { - fprintf(stderr, "unkown attribute '%s'\n", av.name); - continue; - } - if ((ret = glite_jpis_insertAttrVal(ctx, jobAttrs->jobid, &av)) != 0) return ret; - } - - return 0; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__UpdateJobs( - struct soap *soap, - struct _jpelem__UpdateJobs *jpelem__UpdateJobs, - struct _jpelem__UpdateJobsResponse *jpelem__UpdateJobsResponse UNUSED) -{ - int ret, ijobs; - const char *feedid; - int status, done; - CONTEXT_FROM_SOAP(soap, ctx); - glite_jp_context_t jpctx = ctx->jpctx; - char *err, *ps; - char *res[3]; - long int uniqueid; - - // XXX: test client in examples/jpis-test - // sends to this function some data for testing - puts(__FUNCTION__); - glite_jp_clear_error(jpctx); - ps = NULL; - - // get info about the feed - feedid = jpelem__UpdateJobs->feedId; - lprintf("feedid='%s'\n", feedid); - - if ((ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->select_info_feed_stmt, 1, GLITE_LBU_DB_TYPE_CHAR, feedid)) != 1) { - fprintf(stderr, "can't get info about feed '%s', returned %d records", feedid, ret); - if (jpctx->error) fprintf(stderr, ": %s (%s)\n", jpctx->error->desc, jpctx->error->source); - else fprintf(stderr, "\n"); - goto fail; - } - if (glite_jp_db_FetchRow(ctx->jpctx, ctx->select_info_feed_stmt, 3, NULL, res) <= 0) { - fprintf(stderr, "can't fetch feed '%s'", feedid); - if (jpctx->error) fprintf(stderr, ": %s (%s)\n", jpctx->error->desc, jpctx->error->source); - else fprintf(stderr, "\n"); - glite_jpis_stack_error(ctx->jpctx, ENODATA, "can't fetch feed '%s'", feedid); - goto fail; - } - lprintf("uniqueid=%s, state=%s, source='%s'\n", res[0], res[1], res[2]); - uniqueid = atol(res[0]); free(res[0]); - status = atoi(res[1]); free(res[1]); - ps = res[2]; - - // update status, if needed (only orig) - done = jpelem__UpdateJobs->feedDone ? GLITE_JP_IS_STATE_DONE : 0; - if ((done != (status & GLITE_JP_IS_STATE_DONE)) && done) { - status |= done; - if ((ret = glite_jp_db_ExecPreparedStmt(ctx->jpctx, ctx->update_state_feed_stmt, 2, - GLITE_LBU_DB_TYPE_INT, status, - GLITE_LBU_DB_TYPE_INT, uniqueid)) != 1) { - fprintf(stderr, "can't update state of '%s', returned %d records", feedid, ret); - if (jpctx->error) fprintf(stderr, ": %s (%s)\n", jpctx->error->desc, jpctx->error->source); - else fprintf(stderr, "\n"); - goto fail; - } - } - - // insert all attributes - for (ijobs = 0; ijobs < jpelem__UpdateJobs->__sizejobAttributes; ijobs++) { - if (updateJob(ctx, (const char *) ps, GLITE_SECURITY_GSOAP_LIST_GET(jpelem__UpdateJobs->jobAttributes, ijobs)) != 0) goto fail; - } - free(ps); - - return SOAP_OK; - -fail: - free(ps); - if (ctx->jpctx->error) { - err = glite_jp_error_chain(ctx->jpctx); - fprintf(stderr, "%s:%s\n", __FUNCTION__, err); - free(err); - } - glite_jp_server_err2fault(ctx->jpctx, soap); - return SOAP_FAULT; -} - - -static int checkIndexedConditions(glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in) -{ - char **indexed_attrs = NULL, *res; - int i, j, k, ret; - glite_lbu_Statement stmt; - - - if ((ret = glite_jp_db_ExecSQL(ctx->jpctx, - "SELECT name FROM attrs WHERE (indexed=1)", &stmt)) < 0) goto end; - - i = 0; - while ( (ret = glite_jp_db_FetchRow(ctx->jpctx, stmt, 1, NULL, &res)) > 0 ) { - if (!(i % INDEXED_STRIDE)) { - indexed_attrs = realloc(indexed_attrs, - ((i / INDEXED_STRIDE + 1) * INDEXED_STRIDE) - * sizeof(*indexed_attrs)); - } - indexed_attrs[i++] = res; - } - if ( ret < 0 ) goto end; - - for (k=0; k < in->__sizeconditions; k++) { - for (j=0; j < i; j++) { - char *attr = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, k)->attr; - - if (!attr) { - glite_jpis_stack_error(ctx->jpctx, EINVAL, "condition attribute no %d is NULL", j); - ret = 0; - goto end; - } - if (!strcasecmp(attr, GLITE_JP_ATTR_JOBID) || !strcasecmp(attr, indexed_attrs[j])) { - ret = 0; - goto end; - } - } - } - ret = 1; - -end: - for (j=0; j < i; j++) free(indexed_attrs[j]); - free(indexed_attrs); - - return(ret); -} - - -static int checkConditions(glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in) { - int i, j; - char *attr; - - for (i = 0; i < in->__sizeconditions; i++) { - attr = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i)->attr; - if (!attr) return 1; - for (j = 0; ctx->conf->attrs[j] && strcasecmp(ctx->conf->attrs[j], attr) != 0; j++); - if (!ctx->conf->attrs[j]) return 1; - } - for (i = 0; i < in->__sizeattributes; i++) { - if ((attr = in->attributes[i]) == NULL) return 1; - for (j = 0; ctx->conf->attrs[j] && strcasecmp(ctx->conf->attrs[j], attr) != 0; j++); - if (!ctx->conf->attrs[j]) return 1; - } - - return 0; -} - - -/* adds attr table name to the list (null terminated) , iff unigue */ -static void add_attr_table(char *new, char ***attr_tables) -{ - int i; - - for (i=0; (*attr_tables && (*attr_tables)[i]); i++) { - if (!strcmp((*attr_tables)[i], new)) return; - } - - *attr_tables = realloc((*attr_tables), (i+2) * sizeof(**attr_tables)); - (*attr_tables)[i] = strdup(new); - (*attr_tables)[i+1] = NULL; -} - -/* transform soap enum queryOp to mysql equivalent */ -static int get_op(const enum jptype__queryOp in, char **out) -{ - char *qop; - glite_jp_queryop_t op; - - glite_jpis_SoapToQueryOp(in, &op); - switch (op) { - case GLITE_JP_QUERYOP_EQUAL: - qop = strdup("="); - break; - case GLITE_JP_QUERYOP_UNEQUAL: - qop = strdup("!="); - break; - case GLITE_JP_QUERYOP_GREATER: - qop = strdup(">"); - break; - case GLITE_JP_QUERYOP_LESS: - qop = strdup("<"); - break; - case GLITE_JP_QUERYOP_WITHIN: - qop = strdup("BETWEEN"); - break; - default: - // unsupported query operator - return(1); - break; - } - - *out = qop; - return(0); -} - - -static char *get_sql_stringvalue(struct jptype__stringOrBlob *value) { - if (!value) return NULL; - if (!GSOAP_ISSTRING(value)) return NULL; - return GSOAP_STRING(value); -} - - -static int get_sql_indexvalue(char **sql, glite_jpis_context_t ctx, struct jptype__indexQuery *condition, struct jptype__stringOrBlob *value) { - glite_jp_attrval_t attr; - - *sql = NULL; - if (!value) return 0; - memset(&attr, 0, sizeof attr); - attr.name = condition->attr; - if (GSOAP_ISSTRING(value)) { - attr.value = GSOAP_STRING(value); - attr.binary = 0; - } else if (GSOAP_ISBLOB(value)) { - attr.value = (char *)GSOAP_BLOB(value)->__ptr; - attr.size = GSOAP_BLOB(value)->__size; - attr.binary = 1; - } else return 0; - glite_jpis_SoapToAttrOrig(condition->origin, &(attr.origin)); - - *sql = glite_jp_attrval_to_db_index(ctx->jpctx, &attr, GLITE_JPIS_INDEX_LENGTH); - return 0; -} - - -static int get_sql_cond(char **sql, const char *attr_md5, enum jptype__queryOp op, char *value, char *value2) { - char *s, *qop, *column; - - *sql = NULL; - if (get_op(op, &qop) != 0) return 0; - if (attr_md5) trio_asprintf(&column, "attr_%|Ss.value", attr_md5); - else asprintf(&column, "jobs.dg_jobid"); - trio_asprintf(sql, "%s %s '%|Ss'", column, qop, value); - free(column); - free(qop); - if (op == jptype__queryOp__WITHIN) { - if (!value) { - free(*sql); - *sql = NULL; - return EINVAL; - } - trio_asprintf(&s, "%s AND '%|Ss'", *sql, value2); - free(*sql); *sql = s; - } - return 0; -} - - -static char *get_sql_or(glite_jpis_context_t ctx, struct jptype__indexQuery *condition, const char *attr_md5) { - struct jptype__indexQueryRecord *record; - char *sql, *cond, *s = NULL, *value, *value2; - int j; - - sql = strdup(""); - for (j=0; j < condition->__sizerecord; j++) { - record = GLITE_SECURITY_GSOAP_LIST_GET(condition->record, j); - if (record->op == jptype__queryOp__EXISTS) { - /* no additional conditions needed when existing is enough */ - } else { - if (strcasecmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { - value = get_sql_stringvalue(record->value); - if (!value) goto err; - value2 = get_sql_stringvalue(record->value2); - if (get_sql_cond(&cond, attr_md5, record->op, value, value2) != 0) goto err; - } else { - get_sql_indexvalue(&value, ctx, condition, record->value); - get_sql_indexvalue(&value2, ctx, condition, record->value2); - get_sql_cond(&cond, attr_md5, record->op, value, value2); - free(value); - free(value2); - if (!cond) goto err; - } - trio_asprintf(&s,"%s%s%s", sql, (sql[0] ? " OR " : ""), cond); - free(cond); - free(sql); sql = s; - } - } - - return sql; -err: - free(sql); - free(s); - return NULL; -} - - -/* get all jobids matching the query conditions */ -static int get_jobids(glite_jpis_context_t ctx, struct _jpelem__QueryJobs *in, char ***jobids, char *** ps_list) -{ - char *qa = NULL, *qb = NULL, *qor, *attr_md5, - *qwhere = NULL, *query = NULL, *res[2], - **jids = NULL, **pss = NULL, **attr_tables = NULL; - int i, ret; - glite_lbu_Statement stmt = NULL; - glite_jp_attr_orig_t orig; - - - qwhere = strdup(""); - for (i=0; i < in->__sizeconditions; i++) { - struct jptype__indexQuery *condition; - - condition = GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i); - - /* attr name */ - if (strcasecmp(condition->attr, GLITE_JP_ATTR_JOBID) == 0) { - /* no subset from attr_ table, used jobs table instead */ - attr_md5 = NULL; - qa = strdup(""); - } else { - attr_md5 = glite_jp_indexdb_attr2id(condition->attr); - add_attr_table(attr_md5, &attr_tables); - - /* origin */ - if (condition->origin) { - glite_jpis_SoapToAttrOrig(condition->origin, &orig); - trio_asprintf(&qb, "attr_%|Ss.origin = %d AND ", attr_md5, orig); - } else - trio_asprintf(&qb, ""); - - /* select given records in attr_ table */ - trio_asprintf(&qa,"%s%sjobs.jobid = attr_%|Ss.jobid", - (i ? "AND " : ""), qb, attr_md5); - - free(qb); - } - - /* inside part of the condition: record list (ORs) */ - if ((qor = get_sql_or(ctx, condition, attr_md5)) == NULL) goto err; - if (qor[0]) { - asprintf(&qb, "%s%s(%s)", qa, qa[0] ? " AND " : "", qor); - free(qa); - qa = qb; - } - free(qor); - - trio_asprintf(&qb,"%s%s%s", qwhere, qa[0] ? " " : "", qa); - free(qa); qwhere = qb; qb = NULL; qa = NULL; - free(attr_md5); - } - - qa = strdup(""); - - for (i=0; (attr_tables && attr_tables[i]); i++) { - trio_asprintf(&qb,"%s, attr_%s", qa, attr_tables[i]); - free(qa); qa = qb; qb = NULL; - } - - if (ctx->conf->no_auth) { - trio_asprintf(&query, "SELECT DISTINCT dg_jobid,ps FROM jobs%s WHERE%s", qa, qwhere); - } - else { - trio_asprintf(&query, "SELECT DISTINCT dg_jobid,ps FROM jobs,users%s WHERE (jobs.ownerid = users.userid AND users.cert_subj='%s') AND%s", qa, ctx->jpctx->peer, qwhere); - } - printf("Incomming QUERY:\n %s\n", query); - free(qwhere); - free(qa); - - if ((ret = glite_jp_db_ExecSQL(ctx->jpctx, query, &stmt)) < 0) goto err; - free(query); - - i = 0; - while ( (ret = glite_jp_db_FetchRow(ctx->jpctx, stmt, sizeof(res)/sizeof(res[0]), NULL, res)) > 0 ) { - if (!(i % JOBIDS_STRIDE)) { - jids = realloc(jids, - ((i / JOBIDS_STRIDE + 1) * JOBIDS_STRIDE + 1) - * sizeof(*jids)); - } - if (!(i % JOBIDS_STRIDE)) { - pss = realloc(pss, - ((i / JOBIDS_STRIDE + 1) * JOBIDS_STRIDE + 1) - * sizeof(*pss)); - } - jids[i] = res[0]; - jids[i+1] = NULL; - pss[i] = res[1]; - pss[i+1] = NULL; - i++; - } - - if ( ret < 0 ) goto err; - - glite_jp_db_FreeStmt(&stmt); - - *jobids = jids; - *ps_list = pss; - - return 0; - -err: - free(query); - for (i=0; (pss && pss[i]); i++) free(pss[i]); - free(pss); - for (i=0; (jids && jids[i]); i++) free(jids[i]); - free(jids); - glite_jp_db_FreeStmt(&stmt); - - return ret; -} - -static void freeAttval_t(glite_jp_attrval_t jav) -{ - free(jav.name); - free(jav.value); - free(jav.origin_detail); -} - - -/* get all values of a given attribute for a job with a given jobid */ -/* all values are soap_malloc-ated, exept of av (due to absence of */ -/* soap_realloc) */ -/* Needs to be copied to list using soap_malloc in calling function! */ - -static int get_attr(struct soap *soap, glite_jpis_context_t ctx, char *jobid, char *attr_name, int *size, struct jptype__attrValue **out) -{ - glite_jp_attrval_t jav; - struct jptype__attrValue *av; - enum jptype__attrOrig *origin; - char *query, *fv, *jobid_md5, *attr_md5; - int i, ret; - glite_lbu_Statement stmt; - - memset(&jav,0,sizeof(jav)); - jobid_md5 = str2md5(jobid); - attr_md5 = glite_jp_indexdb_attr2id(attr_name); - trio_asprintf(&query,"SELECT full_value FROM attr_%|Ss WHERE jobid = \"%s\"", - attr_md5, jobid_md5); - free(attr_md5); - free(jobid_md5); - - if ((ret = glite_jp_db_ExecSQL(ctx->jpctx, query, &stmt)) < 0) { - glite_jpis_stack_error(ctx->jpctx, EIO, "SELECT from attribute '%s' failed", attr_name); - goto err; - } - free(query); - - av = *out; - i = *size; - while ( (ret = glite_jp_db_FetchRow(ctx->jpctx, stmt, 1, NULL, &fv)) > 0 ) { - av = realloc(av, (i+1) * sizeof(*av)); - memset(&av[i], 0, sizeof(av[i])); - - memset(&jav,0,sizeof(jav)); - if (glite_jp_attrval_from_db(ctx->jpctx, fv, &jav)) goto err; - av[i].name = soap_strdup(soap, attr_name); - av[i].value = soap_malloc(soap, sizeof(*(av[i].value))); - memset(av[i].value, 0, sizeof(*(av[i].value))); - if (jav.binary) { - GSOAP_SETBLOB(av[i].value, soap_malloc(soap, sizeof(*(GSOAP_BLOB(av[i].value))))); - memset(GSOAP_BLOB(av[i].value), 0, sizeof(*(GSOAP_BLOB(av[i].value)))); - GSOAP_BLOB(av[i].value)->__ptr = soap_malloc(soap, jav.size); - memcpy(GSOAP_BLOB(av[i].value)->__ptr, jav.value, jav.size); - GSOAP_BLOB(av[i].value)->__size = jav.size; - // XXX: id, type, option - how to handle? - } - else { - GSOAP_SETSTRING(av[i].value, jav.value ? soap_strdup(soap, jav.value) : NULL); - } - av[i].timestamp = jav.timestamp; - glite_jpis_AttrOrigToSoap(soap, jav.origin, &origin); - // atribute has always origin - assert(origin != GLITE_JP_ATTR_ORIG_ANY); - av[i].origin = *origin; soap_dealloc(soap, origin); - if (jav.origin_detail) av[i].originDetail = soap_strdup(soap, jav.origin_detail); - - i++; - freeAttval_t(jav); - } - if (ret < 0) goto err; - - glite_jp_db_FreeStmt(&stmt); - *size = i; - *out = av; - - return 0; - -err: - glite_jp_db_FreeStmt(&stmt); - freeAttval_t(jav); - return 1; -} - - -/* return owner of job record */ -static int get_owner(glite_jpis_context_t ctx, char *jobid, char **owner) -{ - char *ownerid = NULL, *jobid_md5, *query, *fv = NULL; - glite_lbu_Statement stmt; - - - /* get ownerid correspondig to jobid */ - jobid_md5 = str2md5(jobid); - trio_asprintf(&query,"SELECT ownerid FROM jobs WHERE jobid = \"%s\"", - jobid_md5); - free(jobid_md5); - - if ((glite_jp_db_ExecSQL(ctx->jpctx, query, &stmt)) < 0) goto err; - free(query); - - if (glite_jp_db_FetchRow(ctx->jpctx, stmt, 1, NULL, &ownerid) <= 0 ) goto err; - - /* DB consistency check - only one record per jobid ! */ - assert (glite_jp_db_FetchRow(ctx->jpctx, stmt, 1, NULL, &fv) <=0); free(fv); - - - /* get cert_subj corresponding to ownerid */ - trio_asprintf(&query,"SELECT cert_subj FROM users WHERE userid = \"%s\"", - ownerid); - - if ((glite_jp_db_ExecSQL(ctx->jpctx, query, &stmt)) < 0) goto err; - free(query); - - if (glite_jp_db_FetchRow(ctx->jpctx, stmt, 1, NULL, owner) <= 0 ) goto err; - - /* DB consistency check - only one record per userid ! */ - assert (glite_jp_db_FetchRow(ctx->jpctx, stmt, 1, NULL, &fv) <=0); free(fv); - - - return 0; -err: - free(ownerid); - free(query); - return 1; -} - -/* fills structure jobRecord for a given jobid*/ -static int get_attrs(struct soap *soap, glite_jpis_context_t ctx, char *jobid, struct _jpelem__QueryJobs *in, struct jptype__jobRecord *out) -{ - struct jptype__attrValue *av = NULL; - int j, size = 0; - - - assert(out); - memset(out, 0, sizeof(*out)); - - /* jobid */ - out->jobid = soap_strdup(soap, jobid); - - /* sizeattributes & attributes */ - size = 0; - for (j=0; j < in->__sizeattributes; j++) - if (get_attr(soap, ctx, jobid, in->attributes[j], &size, &av) ) goto err; - if ( get_owner(ctx, jobid, &(out->owner)) ) goto err; - - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, attributes, struct jptype__attrValue, size); - for (j = 0; j < size; j++) - memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out->attributes, j), &av[j], sizeof(av[0])); - free(av); - - return 0; - -err: - return 1; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__QueryJobs( - struct soap *soap, - struct _jpelem__QueryJobs *in, - struct _jpelem__QueryJobsResponse *out) -{ - CONTEXT_FROM_SOAP(soap, ctx); - struct jptype__jobRecord *jr; - - char **jobids = NULL, **ps_list = NULL; - int i, size, err; - - - puts(__FUNCTION__); - glite_jp_clear_error(ctx->jpctx); - memset(out, 0, sizeof(*out)); - - /* test whether there is any indexed attribudes in the condition */ - if ( checkIndexedConditions(ctx, in) ) { - glite_jpis_stack_error(ctx->jpctx, EINVAL, "No indexed attribute in query"); - goto fail; - } - - /* test whether there is known attribudes in the condition */ - if ( checkConditions(ctx, in) ) { - glite_jpis_stack_error(ctx->jpctx, EINVAL, "Unknown attribute in query"); - goto fail; - } - - /* get all jobids matching the conditions */ - if ( (err = get_jobids(ctx, in, &jobids, &ps_list)) != 0 ) { - glite_jpis_stack_error(ctx->jpctx, err, "Error getting jobs"); - goto fail; - } - - /* get all requested attributes for matching jobids */ - for (i=0; (jobids && jobids[i]); i++); - size = i; - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, jobs, struct jptype__jobRecord, size); - for (i=0; (jobids && jobids[i]); i++) { - jr = GLITE_SECURITY_GSOAP_LIST_GET(out->jobs, i); - if ( (err = get_attrs(soap, ctx, jobids[i], in, jr)) != 0 ) { - glite_jpis_stack_error(ctx->jpctx, err, "Error getting attributes of the job '%s'", jobids[i]); - goto fail; - } - - // XXX: in prototype we return only first value of PS URL - // in future database should contain one more table with URLs - jr->__sizeprimaryStorage = 1; - jr->primaryStorage = soap_malloc(soap, sizeof(*(jr->primaryStorage))); - jr->primaryStorage[0] = soap_strdup(soap, ps_list[i]); - free(ps_list[i]); - free(jobids[i]); - } - free(jobids); - free(ps_list); - - return SOAP_OK; -fail: - glite_jp_server_err2fault(ctx->jpctx, soap); - return SOAP_ERR; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__AddFeed( - struct soap *soap UNUSED, - struct _jpelem__AddFeed *in UNUSED, - struct _jpelem__AddFeedResponse *out UNUSED) -{ - // XXX: test client in examples/jpis-test - // sends to this function some data for testing - puts(__FUNCTION__); - return SOAP_OK; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetFeedIDs( - struct soap *soap UNUSED, - struct _jpelem__GetFeedIDs *in UNUSED, - struct _jpelem__GetFeedIDsResponse *out UNUSED) -{ - // XXX: test client in examples/jpis-test - // sends to this function some data for testing - puts(__FUNCTION__); - return SOAP_OK; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__DeleteFeed( - struct soap *soap UNUSED, - struct _jpelem__DeleteFeed *in UNUSED, - struct _jpelem__DeleteFeedResponse *out UNUSED) -{ - // XXX: test client in examples/jpis-test - // sends to this function some data for testing - puts(__FUNCTION__); - return SOAP_OK; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__ServerConfiguration( - struct soap *soap UNUSED, - struct _jpelem__ServerConfiguration *in UNUSED, - struct _jpelem__ServerConfigurationResponse *out UNUSED) -{ - // empty, just for deserializer generation - puts(__FUNCTION__); - return SOAP_OK; -} diff --git a/org.glite.jp.index/src/soap_ps_calls.c b/org.glite.jp.index/src/soap_ps_calls.c deleted file mode 100644 index a9a125e..0000000 --- a/org.glite.jp.index/src/soap_ps_calls.c +++ /dev/null @@ -1,197 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include "soap_version.h" -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/security/glite_gss.h" -#include "glite/security/glite_gsplugin.h" -#include "glite/security/glite_gscompat.h" - -#include "jp_H.h" - -#include "conf.h" -#include "db_ops.h" -#include "ws_ps_typeref.h" -#include "context.h" -#include "common.h" - -#include "stdsoap2.h" - - -extern struct Namespace jp__namespaces[]; - - -/*------------------*/ -/* Helper functions */ -/*------------------*/ - -#define dprintf(FMT, ARGS...) do {fprintf(stderr, "[%d] %s: ", getpid(), __FUNCTION__); fprintf(stderr, FMT, ##ARGS); } while(0); -#include "glite/jp/ws_fault.c" -#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0) - - -/*----------------------*/ -/* PS WSDL client calls */ -/*----------------------*/ - -static int find_dest_index(glite_jp_is_conf *conf, long int uniqueid) -{ - int i; - - for (i=0; conf->feeds[i]; i++) - if (conf->feeds[i]->uniqueid == uniqueid) return(i); - - return -1; -} - - -static int refresh_gsoap(glite_jpis_context_t ctx, struct soap *soap) { - edg_wll_GssCred cred; - edg_wll_GssStatus gss_code; - char *et; - // preventive very long timeout - static const struct timeval to = {tv_sec: 7200, tv_usec: 0}; - glite_gsplugin_Context plugin_ctx; - - if (edg_wll_gss_acquire_cred_gsi(ctx->conf->server_cert, ctx->conf->server_key, &cred, &gss_code) != 0) { - edg_wll_gss_get_error(&gss_code,"",&et); - glite_jpis_stack_error(ctx->jpctx, EINVAL, "can't refresh certificates (%s)", et); - free(et); - return EINVAL; - //printf("[%d] %s: %s\n", getpid(), __FUNCTION__, err.desc); - } - - plugin_ctx = glite_gsplugin_get_context(soap); - glite_gsplugin_set_timeout(plugin_ctx, &to); - glite_gsplugin_use_credential(plugin_ctx, cred); - - return 0; -} - - -// call PS FeedIndex for a given destination -int MyFeedIndex(struct soap *soap, glite_jpis_context_t ctx, long int uniqueid, const char *dest) -{ - struct _jpelem__FeedIndex in; - struct _jpelem__FeedIndexResponse out; -// struct jptype__primaryQuery query; -// struct jptype__stringOrBlob value; -// struct xsd__base64Binary blob; - int i, dest_index, status; - glite_jp_is_conf *conf = ctx->conf; - - lprintf("(%ld) for %s called\n", uniqueid, dest); - - if (refresh_gsoap(ctx, soap) != 0) - return glite_jpis_stack_error(ctx->jpctx, EINVAL, "can't refresh credentials"); - - memset(&in, 0, sizeof(in)); - - for (i=0; conf->attrs[i]; i++) ; - in.__sizeattributes = i; - in.attributes = conf->attrs; - - if ((dest_index = find_dest_index(conf, uniqueid)) < 0) - return glite_jpis_stack_error(ctx->jpctx, EINVAL, "internal error (feed index %ld not found)", uniqueid); - - soap_begin(soap); - for (i=0; conf->feeds[dest_index]->query[i].attr; i++); - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, &in, conditions, struct jptype__primaryQuery, i); - - for (i=0; conf->feeds[dest_index]->query[i].attr; i++) { - if (glite_jpis_QueryCondToSoap(soap, &conf->feeds[dest_index]->query[i], - GLITE_SECURITY_GSOAP_LIST_GET(in.conditions, i)) != SOAP_OK) { - soap_end(soap); - return glite_jpis_stack_error(ctx->jpctx, EINVAL, "error during conds conversion"); - } - } - - in.history = conf->feeds[dest_index]->history; - in.continuous = conf->feeds[dest_index]->continuous; - in.destination = ctx->hname; - lprintf("(%ld) destination IS: '%s'\n", uniqueid, ctx->hname); - - if (check_fault(soap,soap_call___jpsrv__FeedIndex(soap,dest,"", &in, &out)) != 0) { - fprintf(stderr, "\n"); - glite_jpis_unlockFeed(ctx, uniqueid); - glite_jpis_stack_error(ctx->jpctx, EIO, "soap_call___jpsrv__FeedIndex() returned error %d", soap->error); - soap_end(soap); - return EIO; - } - else { - status = (conf->feeds[dest_index]->history ? GLITE_JP_IS_STATE_HIST : 0) | (conf->feeds[dest_index]->continuous ? GLITE_JP_IS_STATE_CONT : 0); - lprintf("(%ld) FeedId: %s\n", uniqueid, out.feedId); - lprintf("(%ld) Expires: %s", uniqueid, ctime(&out.feedExpires)); - glite_jpis_initFeed(ctx, uniqueid, out.feedId, time(NULL) + (out.feedExpires - time(NULL)) / 2, status); - glite_jpis_unlockFeed(ctx, uniqueid); - } - - soap_end(soap); - - return 0; -} - - -int MyFeedRefresh(struct soap *soap, glite_jpis_context_t ctx, long int uniqueid, const char *dest, int status, const char *feedid) -{ - struct _jpelem__FeedIndexRefresh in; - struct _jpelem__FeedIndexRefreshResponse out; - - lprintf("(%ld) for %s called, status = %d\n", uniqueid, feedid, status); - - if (refresh_gsoap(ctx, soap) != 0) - return glite_jpis_stack_error(ctx->jpctx, EINVAL, "can't refresh credentials"); - - soap_begin(soap); - memset(&in, 0, sizeof(in)); - in.feedId = soap_strdup(soap, feedid); - if (check_fault(soap,soap_call___jpsrv__FeedIndexRefresh(soap,dest,"", &in, &out)) != 0) { - fprintf(stderr, "\n"); - glite_jpis_unlockFeed(ctx, uniqueid); - glite_jpis_stack_error(ctx->jpctx, EIO, "soap_call___jpsrv__FeedRefresh() returned error %d", soap->error); - soap_end(soap); - return EIO; - } - else { - status &= (~GLITE_JP_IS_STATE_ERROR); - lprintf("(%ld) FeedId: %s\n", uniqueid, feedid); - lprintf("(%ld) Expires: %s", uniqueid, ctime(&out.feedExpires)); - glite_jpis_initFeed(ctx, uniqueid, feedid, time(NULL) + (out.feedExpires - time(NULL)) / 2, status); - glite_jpis_unlockFeed(ctx, uniqueid); - } - - soap_end(soap); - return 0; -} - - -int __jpsrv__RegisterJob(struct soap* soap UNUSED, struct _jpelem__RegisterJob *jpelem__RegisterJob UNUSED, struct _jpelem__RegisterJobResponse *jpelem__RegisterJobResponse UNUSED) { return 0; } -int __jpsrv__StartUpload(struct soap* soap UNUSED, struct _jpelem__StartUpload *jpelem__StartUpload UNUSED, struct _jpelem__StartUploadResponse *jpelem__StartUploadResponse UNUSED) { return 0; } -int __jpsrv__CommitUpload(struct soap* soap UNUSED, struct _jpelem__CommitUpload *jpelem__CommitUpload UNUSED, struct _jpelem__CommitUploadResponse *jpelem__CommitUploadResponse UNUSED) { return 0; } -int __jpsrv__RecordTag(struct soap* soap UNUSED, struct _jpelem__RecordTag *jpelem__RecordTag UNUSED, struct _jpelem__RecordTagResponse *jpelem__RecordTagResponse UNUSED) { return 0; } -int __jpsrv__FeedIndex(struct soap* soap UNUSED, struct _jpelem__FeedIndex *jpelem__FeedIndex UNUSED, struct _jpelem__FeedIndexResponse *jpelem__FeedIndexResponse UNUSED) { return 0; } -int __jpsrv__FeedIndexRefresh(struct soap* soap UNUSED, struct _jpelem__FeedIndexRefresh *jpelem__FeedIndexRefresh UNUSED, struct _jpelem__FeedIndexRefreshResponse *jpelem__FeedIndexRefreshResponse UNUSED) { return 0; } -int __jpsrv__GetJobFiles(struct soap* soap UNUSED, struct _jpelem__GetJobFiles *jpelem__GetJobFiles UNUSED, struct _jpelem__GetJobFilesResponse *jpelem__GetJobFilesResponse UNUSED) { return 0; } -int __jpsrv__GetJobAttributes(struct soap* soap UNUSED, struct _jpelem__GetJobAttributes *jpelem__GetJobAttributes UNUSED, struct _jpelem__GetJobAttributesResponse *jpelem__GetJobAttributesResponse UNUSED) { return 0; } - -int __jpsrv__RecordMultiTags(struct soap* soap UNUSED, struct _jpelem__RecordMultiTags *jpelem__RecordMultiTags UNUSED, struct _jpelem__RecordMultiTagsResponse *jpelem__RecordMultiTagsResponse UNUSED) { return 0; } diff --git a/org.glite.jp.index/src/soap_ps_calls.h b/org.glite.jp.index/src/soap_ps_calls.h deleted file mode 100644 index 8ec2b18..0000000 --- a/org.glite.jp.index/src/soap_ps_calls.h +++ /dev/null @@ -1,29 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#ifndef _SOAP_PS_CALLS_H -#define _SOAP_PS_CALLS_H - -#include "context.h" -#include "conf.h" - -int MyFeedIndex(struct soap *soap, glite_jpis_context_t ctx, long int uniqueid, const char *dest); -int MyFeedRefresh(struct soap *soap, glite_jpis_context_t ctx, long int uniqueid, const char *dest, int status, const char *feedid); - -#endif diff --git a/org.glite.jp.index/src/type_plugin.c b/org.glite.jp.index/src/type_plugin.c deleted file mode 100644 index cbf42d5..0000000 --- a/org.glite.jp.index/src/type_plugin.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include -#include -#include "glite/jp/type_plugin.h" - -int glite_jp_typeplugin_load(glite_jp_context_t ctx,const char *so){ -/* XXX: not stored but we never dlclose() yet */ - void *dl_handle = dlopen(so,RTLD_NOW); - - glite_jp_error_t err; - const char *e; - glite_jp_tplug_data_t *data; - int i; - - glite_jp_tplug_init_t init; - memset(&err,0,sizeof err); - - if (!dl_handle) { - err.source = "dlopen()"; - err.code = EINVAL; - err.desc = dlerror(); - return glite_jp_stack_error(ctx,&err); - } - - dlerror(); - init = dlsym(dl_handle,"init"); - e = dlerror(); - if (e) { - char buf[300]; - snprintf(buf,sizeof buf,"dlsym(\"%s\",\"init\")",so); - buf[299] = 0; - err.source = buf; - err.code = ENOENT; - err.desc = e; - return glite_jp_stack_error(ctx,&err); - } - - data = calloc(1,sizeof *data); - - if (init(ctx, NULL, data)) return -1; - - i = 0; - if (ctx->type_plugins) for (i=0; ctx->type_plugins[i]; i++); - ctx->type_plugins = realloc(ctx->type_plugins, - (i+2) * sizeof *ctx->type_plugins); - ctx->type_plugins[i] = data; - ctx->type_plugins[i+1] = NULL; - - /* TODO: check consistency of uri+class pairs wrt. previous plugins */ - - return 0; -} - diff --git a/org.glite.jp.index/src/typemap.dat b/org.glite.jp.index/src/typemap.dat deleted file mode 100644 index e86b875..0000000 --- a/org.glite.jp.index/src/typemap.dat +++ /dev/null @@ -1,4 +0,0 @@ -jpsrv = http://glite.org/wsdl/services/jp -jptype = http://glite.org/wsdl/types/jp -jpelem = http://glite.org/wsdl/elements/jp -jpisclient = http://glite.org/xsd/types/jpisclient diff --git a/org.glite.jp.index/src/ws_is_typeref.c b/org.glite.jp.index/src/ws_is_typeref.c deleted file mode 100644 index 3319934..0000000 --- a/org.glite.jp.index/src/ws_is_typeref.c +++ /dev/null @@ -1,231 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include -#include "soap_version.h" - -#include "jp_H.h" -#include "ws_typemap.h" -#include -#include "ws_is_typeref.h" - -#include "glite/jp/ws_fault.c" - - -void glite_jpis_SoapToQueryOp(const enum jptype__queryOp in, glite_jp_queryop_t *out) -{ - switch ( in ) - { - case EQUAL: *out = GLITE_JP_QUERYOP_EQUAL; break; - case UNEQUAL: *out = GLITE_JP_QUERYOP_UNEQUAL; break; - case LESS: *out = GLITE_JP_QUERYOP_LESS; break; - case GREATER: *out = GLITE_JP_QUERYOP_GREATER; break; - case WITHIN: *out = GLITE_JP_QUERYOP_WITHIN; break; - case EXISTS: *out = GLITE_JP_QUERYOP_EXISTS; break; - default: assert(0); break; - } -} - -void glite_jpis_SoapToAttrOrig(const enum jptype__attrOrig *in, glite_jp_attr_orig_t *out) -{ - assert(out); - - if (!in) { - *out = GLITE_JP_ATTR_ORIG_ANY; - return; - } - - switch ( *in ) - { - case SYSTEM: *out = GLITE_JP_ATTR_ORIG_SYSTEM; break; - case USER: *out = GLITE_JP_ATTR_ORIG_USER; break; - case FILE_: *out = GLITE_JP_ATTR_ORIG_FILE; break; - default: assert(0); break; - } -} - -static int SoapToQueryRecordVal( - struct jptype__stringOrBlob *in, - int *binary, - size_t *size, - char **value) -{ - - assert(in); - if (GSOAP_ISSTRING(in)) { - *binary = 0; - *size = 0; - *value = strdup(GSOAP_STRING(in)); - - return 0; - } - else if (GSOAP_ISBLOB(in)) { - *binary = 1; - *size = GSOAP_BLOB(in)->__size; - memcpy(*value, GSOAP_BLOB(in)->__ptr, GSOAP_BLOB(in)->__size); - // XXX how to handle id, type, option? - - return 0; - } - else - // malformed value - return 1; -} - - -#if 0 -static int SoapToQueryCond( - struct jptype__indexQuery *in, - glite_jp_query_rec_t **out) -{ - glite_jp_query_rec_t *qr; - int i; - struct jptype__indexQueryRecord *record; - - assert(in); assert(out); - qr = calloc(in->__sizerecord + 1, sizeof(*qr)); - - for (i=0; i < in->__sizerecord; i++) { - record = GLITE_SECURITY_GSOAP_LIST_GET(in->record, i); - qr[i].attr = strdup(in->attr); - glite_jpis_SoapToQueryOp(record->op, &(qr[i].op)); - - switch (qr[i].op) { - case GLITE_JP_QUERYOP_EXISTS: - break; - - case GLITE_JP_QUERYOP_WITHIN: - SoapToQueryRecordVal(record->value2, &(qr[i].binary), - &(qr[i].size2), &(qr[i].value2)); - // fall through - default: - if ( SoapToQueryRecordVal(record->value, &(qr[i].binary), - &(qr[i].size), &(qr[i].value)) ) { - *out = NULL; - return 1; - } - break; - } - - glite_jpis_SoapToAttrOrig(in->origin, &(qr[i].origin) ); - } - - *out = qr; - - return 0; -} - -/** - * Translate JP index query conditions from soap to C query_rec - * - * \param OUT array of glite_jp_query_rec_t query records - */ -int glite_jpis_SoapToQueryConds( - int size, - struct jptype__indexQuery **in, - glite_jp_query_rec_t ***out) -{ - glite_jp_query_rec_t **qr; - int i; - - assert(in); assert(out); - qr = calloc(size+1, sizeof(*qr)); - - for (i=0; iattr); assert(out); - qr = out; - - qr[0].attr = strdup(in->attr); - glite_jpis_SoapToQueryOp(in->op, &(qr[0].op)); - - switch (qr[0].op) { - case GLITE_JP_QUERYOP_EXISTS: - break; - - case GLITE_JP_QUERYOP_WITHIN: - SoapToQueryRecordVal(in->value2, &(qr[0].binary), - &(qr[0].size2), &(qr[0].value2)); - // fall through - default: - if ( SoapToQueryRecordVal(in->value, &(qr[0].binary), - &(qr[0].size), &(qr[0].value)) ) { - return 1; - } - break; - } - - glite_jpis_SoapToAttrOrig(in->origin, &(qr[0].origin) ); - - return 0; -} - - - -/** - * Translate JP primary query conditions from soap to C query_rec - * - * \param IN Soap structure - * \param OUT array of glite_jp_query_rec_t query records - */ -int glite_jpis_SoapToPrimaryQueryConds( - int size, - GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) in, - glite_jp_query_rec_t **out) -{ - glite_jp_query_rec_t *qr; - int i; - - assert(in || !size); assert(out); - qr = calloc(size+1, sizeof(*qr)); - - for (i=0; i -#include -#include -#include - -#include - -#include "jp_H.h" -#include "ws_typemap.h" -#include "ws_ps_typeref.h" -#include "glite/jp/ws_fault.c" - - -static void QueryOpToSoap(const glite_jp_queryop_t in, enum jptype__queryOp *out) -{ - switch ( in ) - { - case GLITE_JP_QUERYOP_EQUAL: *out = EQUAL; break; - case GLITE_JP_QUERYOP_UNEQUAL: *out = UNEQUAL; break; - case GLITE_JP_QUERYOP_LESS: *out = LESS; break; - case GLITE_JP_QUERYOP_GREATER: *out = GREATER; break; - case GLITE_JP_QUERYOP_WITHIN: *out = WITHIN; break; - case GLITE_JP_QUERYOP_EXISTS: *out = EXISTS; break; - default: assert(0); break; - } -} - -void glite_jpis_AttrOrigToSoap(struct soap *soap, const glite_jp_attr_orig_t in, enum jptype__attrOrig **out) -{ - enum jptype__attrOrig *o = soap_malloc(soap, sizeof(*o)); - - switch ( in ) - { - case GLITE_JP_ATTR_ORIG_ANY: o = NULL; break; - case GLITE_JP_ATTR_ORIG_SYSTEM: *o = SYSTEM; break; - case GLITE_JP_ATTR_ORIG_USER: *o = USER; break; - case GLITE_JP_ATTR_ORIG_FILE: *o = FILE_; break; - default: assert(0); break; - } - - *out = o; -} - -static int QueryRecordValToSoap( - struct soap *soap, - int binary, - size_t size, - char *in, - struct jptype__stringOrBlob **out) -{ - struct jptype__stringOrBlob *val; - - - assert(out); - if ( !(val = soap_malloc(soap, sizeof(*val))) ) return SOAP_FAULT; - memset(val, 0, sizeof(*val) ); - - if (binary) { - GSOAP_SETBLOB(val, soap_malloc(soap, sizeof(*GSOAP_BLOB(val)))); - if ( !GSOAP_BLOB(val) ) return SOAP_FAULT; - GSOAP_BLOB(val)->__size = size; - if ( !(GSOAP_BLOB(val)->__ptr = soap_malloc(soap, GSOAP_BLOB(val)->__size)) ) return SOAP_FAULT; - memcpy(GSOAP_BLOB(val)->__ptr, in, GSOAP_BLOB(val)->__size); - // XXX how to handle id, type, option? - } - else { - GSOAP_SETSTRING(val, soap_strdup(soap, in)); - if ( !(GSOAP_STRING(val) ) ) return SOAP_FAULT; - } - - *out = val; - - return SOAP_OK; -} - -/** - * Translate JP query condition from C query_rec to Soap - * - * \param IN in glite_jp_query_rec_t query record - * \param OUT Soap structure - */ -int glite_jpis_QueryCondToSoap( - struct soap *soap, - glite_jp_query_rec_t *in, - struct jptype__primaryQuery *out) -{ - struct jptype__primaryQuery *qr; - - assert(in); assert(out); - qr = out; - memset(qr, 0, sizeof(*qr)); - - if ( !(qr->attr = soap_strdup(soap, in->attr)) ) return SOAP_FAULT; - QueryOpToSoap(in->op, &(qr->op)); - glite_jpis_AttrOrigToSoap(soap, in->origin, &(qr->origin)); - - switch ( in->op ) { - case GLITE_JP_QUERYOP_WITHIN: - if (QueryRecordValToSoap(soap, in->binary, in->size2, in->value2, &qr->value2)) - return SOAP_FAULT; - case GLITE_JP_QUERYOP_EQUAL: - case GLITE_JP_QUERYOP_UNEQUAL: - case GLITE_JP_QUERYOP_LESS: - case GLITE_JP_QUERYOP_GREATER: - if (QueryRecordValToSoap(soap, in->binary, in->size, in->value, &qr->value)) - return SOAP_FAULT; - case GLITE_JP_QUERYOP_EXISTS: - break; - default: - assert(0); // unknown or undefined operation - break; - } - - *out = *qr; - - return SOAP_OK; -} - -static void SoapToAttrOrig(glite_jp_attr_orig_t *out, const enum jptype__attrOrig in) -{ - switch ( in ) - { - case jptype__attrOrig__SYSTEM: *out = GLITE_JP_ATTR_ORIG_SYSTEM; break; - case jptype__attrOrig__USER: *out = GLITE_JP_ATTR_ORIG_USER; break; - case jptype__attrOrig__FILE_: *out = GLITE_JP_ATTR_ORIG_FILE; break; - default: assert(0); break; - } -} - -void glite_jpis_SoapToAttrVal(glite_jp_attrval_t *av, const struct jptype__attrValue *attr) { - memset(av, 0, sizeof(*av)); - av->name = attr->name; - av->binary = GSOAP_ISBLOB(attr->value); - if (av->binary) { - av->value = GSOAP_BLOB(attr->value)->__ptr; - av->size = GSOAP_BLOB(attr->value)->__size ; - } else { - av->size = -1; - av->value = GSOAP_STRING(attr->value); - } - SoapToAttrOrig(&av->origin, attr->origin); - av->origin_detail = attr->originDetail; - av->timestamp = attr->timestamp; -} diff --git a/org.glite.jp.index/src/ws_ps_typeref.h b/org.glite.jp.index/src/ws_ps_typeref.h deleted file mode 100644 index 04165d0..0000000 --- a/org.glite.jp.index/src/ws_ps_typeref.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JPIS_TYPEREF_H -#define GLITE_JPIS_TYPEREF_H - -int glite_jpis_QueryCondToSoap(struct soap *soap, glite_jp_query_rec_t *in, struct jptype__primaryQuery *out); - -void glite_jpis_AttrOrigToSoap(struct soap *soap, const glite_jp_attr_orig_t in, enum jptype__attrOrig **out); - -void glite_jpis_SoapToAttrVal(glite_jp_attrval_t *av, const struct jptype__attrValue *attr); - -#endif diff --git a/org.glite.jp.index/src/ws_typemap.h b/org.glite.jp.index/src/ws_typemap.h deleted file mode 100644 index 39d9232..0000000 --- a/org.glite.jp.index/src/ws_typemap.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -// XXX: may be glued with org.glite.jp.primary/src/jptype_map.h? - -#include "soap_version.h" - -#if GSOAP_VERSION >= 20700 - -#define SYSTEM jptype__attrOrig__SYSTEM -#define USER jptype__attrOrig__USER -#define FILE_ jptype__attrOrig__FILE_ - -#define EQUAL jptype__queryOp__EQUAL -#define UNEQUAL jptype__queryOp__UNEQUAL -#define LESS jptype__queryOp__LESS -#define GREATER jptype__queryOp__GREATER -#define WITHIN jptype__queryOp__WITHIN -#define EXISTS jptype__queryOp__EXISTS - -#else - -#define __jpsrv__UpdateJobs __ns1__UpdateJobs -#define __jpsrv__QueryJobs __ns1__QueryJobs -#define __jpsrv__AddFeed __ns1__AddFeed -#define __jpsrv__GetFeeds __ns1__getFeedIDs -#define __jpsrv__DeleteFeed __ns1__DeleteFeed -#define __jpsrv__ServerConfiguration __ns1__ServerConfiguration - -#endif - diff --git a/org.glite.jp.primary/.cvsignore b/org.glite.jp.primary/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.jp.primary/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.jp.primary/Makefile b/org.glite.jp.primary/Makefile deleted file mode 100644 index 6c53b25..0000000 --- a/org.glite.jp.primary/Makefile +++ /dev/null @@ -1,223 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -globalprefix=glite -jpprefix=jp -package=glite-jp-primary -version=0.0.0 -PREFIX=/opt/glite - -glite_location=/opt/glite -nothrflavour=gcc32 -thrflavour=gcc32pthr -gsoap_prefix=/software/gsoap-2.6 - -CC=gcc - --include Makefile.inc - - -VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${stagedir}/interface - -archlib:=lib -host_cpu:=${shell uname -m} -ifeq (${host_cpu},x86_64) - archlib:=lib64 -endif - -archlib:=lib -host_cpu:=${shell uname -m} -ifeq (${host_cpu},x86_64) - archlib:=lib64 -endif - - -ifneq (${classads_prefix},/usr) - classadslib := -L${classads_prefix}/${archlib} -L${classads_prefix}/lib -lclassad -endif - -CLASSADPLUGIN_LIBS:= ${classadslib} -lstdc++ - -CLASSADPLUGIN_LOBJS:= classad_plugin.lo - -GLOBUS_CFLAGS:=-I${globus_prefix}/include/${nothrflavour} - -DEBUG:=-g -O0 -DDEBUG - -CFLAGS:=${DEBUG} -I. -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include -I${classads_prefix}/include -I${classads_prefix}/include/classad -I${libtar_prefix}/include ${GLOBUS_CFLAGS} -# 3.1 CFLAGS:=${DEBUG} -I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${gsoap_prefix}/include -I${gsoap_prefix} -I${stagedir}/include ${GLOBUS_CFLAGS} -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql -I${classads_prefix}/include -I${libtar_prefix}/include - -LDFLAGS:=-L${stagedir}/lib - -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -LTCOMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -SOLINK:=libtool --mode=link ${CC} -module ${LDFLAGS} -rpath ${stagedir}/lib -LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} -INSTALL:=libtool --mode=install install - -daemon:=glite-jp-primarystoraged -example:=jpps-test dag-deps -ps_prefix:=jpps_ -is_prefix:=jpis_ -sample_jobs:=sample_job_aborted sample_job_cleared sample_job_tagged_done sample_job_waiting - -plugins:=glite-jp-ftpdauth.la glite-jp-classad.la glite-jp-sandbox.la glite-jp-callouts_${nothrflavour}.la - -SRCS:= bones_server.c soap_ops.c \ - new_ftp_backend.c file_plugin.c \ - feed.c authz.c attrs.c \ - tags.c\ - is_client.c \ - soap_switch.c - -# ${ps_prefix}ServerLib.c \ -# ${is_prefix}ClientLib.c jpps_C.c - -TEST_SRCS:=jpps-test.c ${ps_prefix}C.c ${ps_prefix}Client.c -DAG_SRCS:=dag-deps.c ${ps_prefix}C.c ${ps_prefix}Client.c - -gsoap_bin_prefix:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then echo ${gsoap_prefix}/bin; else echo ${gsoap_prefix}; fi } - -OBJS:=${SRCS:.c=.o} -TEST_OBJS:=${TEST_SRCS:.c=.o} -DAG_OBJS:=${DAG_SRCS:.c=.o} - -dotless_gsoap_ver:=${shell echo ${gsoap_default_version} | tr -d . } -ifeq ($(shell test -f ${stagedir}/lib/libglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}_c.so && echo ok),ok) - langflavour:=_c -endif -COMMONLIB:=-lglite_jp_common_${nothrflavour} -SRVCOMMONLIB:=-lglite_jp_server_common -BONESLIB:=-lglite_lbu_server_bones -GSOAPLIB:=-L${stagedir}/lib -lglite_security_gsoap_plugin_${dotless_gsoap_ver}_${nothrflavour}${langflavour} -TRIOLIB:=-lglite_lbu_trio -LIBTARLIB:=-L${libtar_prefix}/lib -ltar -GSSLIB:=-lglite_security_gss_${nothrflavour} - -default all: compile - -compile: ${daemon} ${example} ${plugins} - -${daemon}: ${OBJS} - ${LINK} -o $@ -export-dynamic ${OBJS} ${BONESLIB} ${TRIOLIB} ${COMMONLIB} ${GSOAPLIB} ${GSSLIB} ${SRVCOMMONLIB} - -jpps-test: ${TEST_OBJS} - ${LINK} -o $@ ${TEST_OBJS} ${GSOAPLIB} - -dag-deps: ${DAG_OBJS} - ${LINKXX} -o $@ ${DAG_OBJS} ${classadslib} ${GSOAPLIB} - -JobProvenancePS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat - cp ${stagedir}/interface/JobProvenanceTypes.wsdl . - ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< - rm -f JobProvenanceTypes.wsdl - -JobProvenanceIS.xh: %.xh: %.wsdl JobProvenanceTypes.wsdl typemap.dat - cp ${stagedir}/interface/JobProvenanceTypes.wsdl . - ${gsoap_bin_prefix}/wsdl2h -t ${top_srcdir}/src/typemap.dat -c -o $@ $< - rm -f JobProvenanceTypes.wsdl - -glite-jp-classad.la: ${CLASSADPLUGIN_LOBJS} - ${SOLINK} -o $@ ${CLASSADPLUGIN_LOBJS} ${CLASSADPLUGIN_LIBS} - -${ps_prefix}Client.c ${ps_prefix}ClientLib.c \ -${ps_prefix}Server.c ${ps_prefix}ServerLib.c \ -${ps_prefix}C.c ${ps_prefix}H.h: JobProvenancePS.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${ps_prefix} JobProvenancePS.xh - -${is_prefix}ClientLib.c ${is_prefix}Client.c \ -${is_prefix}C.c ${is_prefix}H.h: JobProvenanceIS.xh - ${gsoap_bin_prefix}/soapcpp2 -n -w -c -p ${is_prefix} JobProvenanceIS.xh - -soap_ops.o: ${ps_prefix}ServerLib.c soap_util.c soap_env_ctx.c soap_env_ctx.h - -is_client.o: ${is_prefix}ClientLib.c soap_util.c soap_env_ctx.c soap_env_ctx.h - -env_C.c env_Server.c: - touch env.xh - ${gsoap_bin_prefix}/soapcpp2 -w -c -p env_ env.xh - -#$(SOAP_PREFIX)H.h $(SOAP_PREFIX)C.c: LB.xh -# $(GSOAP_BIN_PATH)/soapcpp2 -w -c -p $(SOAP_PREFIX) LB.xh -# -#LB.xh: LB.wsdl typemap.dat -# $(GSOAP_BIN_PATH)/wsdl2h -c -o $@ LB.wsdl -# - - -bones_server.o simple_server.o: ${is_prefix}H.h ${ps_prefix}H.h - -check: - -echo nothing yet - -doc: - -stage: compile - ${MAKE} PREFIX=${stagedir} DOSTAGE=yes install - -install: - -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/examples ${PREFIX}/etc/init.d ${PREFIX}/lib - ${INSTALL} -m 755 ${daemon} ${PREFIX}/bin - ${INSTALL} -m 755 jpps-test ${PREFIX}/examples/glite-jp-primary-test - ${INSTALL} -m 755 ${top_srcdir}/examples/getjobattr.pl ${PREFIX}/examples/glite-jpps-getjobattr.pl - for plugin in ${plugins}; do \ - ${INSTALL} -m 755 $$plugin ${PREFIX}/lib; \ - done - ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-jp-primary - ${INSTALL} -m 755 ${top_srcdir}/config/glite-jp-primary-dbsetup.sql ${PREFIX}/etc - ${INSTALL} -m 755 ${top_srcdir}/config/glite-jp-primary-dbsetup.sh ${PREFIX}/etc - ${INSTALL} -m 755 ${top_srcdir}/examples/jpps_store_test ${PREFIX}/examples/glite-jp-primary-store-test - ${INSTALL} -m 755 ${top_srcdir}/config/gsi_authz.conf.example ${PREFIX}/etc/gsi_authz.conf - for i in ${sample_jobs}; do \ - ${INSTALL} -m 644 ${top_srcdir}/examples/$$i ${PREFIX}/examples/glite-jp-primary-$$i.lb; \ - done - -mkdir -p ${PREFIX}/yaim/functions/ - -mkdir -p ${PREFIX}/yaim/node-info.d - -mkdir -p ${PREFIX}/yaim/defaults - -mkdir -m 0700 -p ${PREFIX}/yaim/examples/siteinfo/services - ${INSTALL} -m 0644 ${top_srcdir}/config/functions/config* ${PREFIX}/yaim/functions - ${INSTALL} -m 0644 ${top_srcdir}/config/node-info.d/glite* ${PREFIX}/yaim/node-info.d - ${INSTALL} -m 0644 ${top_srcdir}/config/defaults/glite* ${PREFIX}/yaim/defaults - ${INSTALL} -m 0600 ${top_srcdir}/config/site-info.def.example ${PREFIX}/yaim/examples/siteinfo/services/glite_jpps -clean: - -simple_server.o soap_ops.o jpps-test.o: ${ps_prefix}H.h - -# we have no real config.h but have to force gSoap not to use -# linux ftime with broken (aka obsolete) DST information - -# stdsoap2.o: ${gsoap_prefix}/devel/stdsoap2.c -# test -f config.h || touch config.h -# @echo 'The following warning "time_t (de)serialization is not MT safe on this platform" is harmless' -# ${CC} -o $@ -c -DWITH_NONAMESPACES -DHAVE_CONFIG_H ${CFLAGS} ${gsoap_prefix}/devel/stdsoap2.c -# - -glite-jp-sandbox.la: sandbox_plugin.lo - ${SOLINK} -o $@ sandbox_plugin.lo ${LIBTARLIB} - -glite-jp-ftpdauth.la: ftpd_auth.lo - ${SOLINK} -o $@ ftpd_auth.lo ${COMMONLIB} ${TRIOLIB} ${SRVCOMMONLIB} - -glite-jp-callouts_${nothrflavour}.la: jp_callouts.lo - ${SOLINK} -o $@ $^ ${COMMONLIB} ${TRIOLIB} ${SRVCOMMONLIB} - -#glite-jp-classad.lo: classad_plugin.c -# ${LTCOMPILE} -DPLUGIN_DEBUG -o $@ -c $< - -#glite-jp-classad.lo: classad_plugin.c -# ${LTCOMPILE} -DPLUGIN_DEBUG -o $@ -c $< - -%.lo: %.c - ${LTCOMPILE} -o $@ -c $< - -soap_ops.o bones_server.o: soap_version.h - -soap_version.h: - ${gsoap_bin_prefix}/soapcpp2 /dev/null - perl -ne '$$. == 2 && /.*([0-9]+)\.([0-9]+)\.([0-9]+)([a-z])?.*/ && printf "#define GSOAP_VERSION %d%02d%02d\n#define GSOAP_VERSION_LETTER '\''".($$4?$$4:"\\0")."'\''\n",$$1,$$2,$$3' soapH.h >$@ - -rm soapC.cpp soapH.h soapStub.h soapClient.cpp soapServer.cpp soapClientLib.cpp soapServerLib.cpp - -soap_env_ctx.c soap_env_ctx.h soap_switch.c: env_C.c mk_soap_switch.pl - ${top_srcdir}/src/mk_soap_switch.pl env_C.c >soap_switch.c diff --git a/org.glite.jp.primary/build.xml b/org.glite.jp.primary/build.xml deleted file mode 100755 index d6081d8..0000000 --- a/org.glite.jp.primary/build.xml +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.primary/config/defaults/glite-jpps.pre b/org.glite.jp.primary/config/defaults/glite-jpps.pre deleted file mode 100644 index fe17ac7..0000000 --- a/org.glite.jp.primary/config/defaults/glite-jpps.pre +++ /dev/null @@ -1,2 +0,0 @@ -### Default values to some glite-JPPS variables -GLITE_USER=glite diff --git a/org.glite.jp.primary/config/functions/config_glite_jpps b/org.glite.jp.primary/config/functions/config_glite_jpps deleted file mode 100644 index 811fef5..0000000 --- a/org.glite.jp.primary/config/functions/config_glite_jpps +++ /dev/null @@ -1,126 +0,0 @@ -function config_glite_jpps_check(){ - requires MYSQL_PASSWORD -} - -function config_glite_jpps_setenv(){ - - yaimgridenv_set GLITE_LOCATION ${INSTALL_ROOT:-opt}/glite - yaimgridenv_set GLITE_LOCATION_VAR ${GLITE_LOCATION_VAR:-/var/glite} - yaimgridenv_set GLOBUS_LOCATION ${GLOBUS_LOCATION:-/opt/globus} - yaimgridenv_set GLITE_USER ${GLITE_USER:-glite} - yaimgridenv_set GLITE_HOST_CERT ${GLITE_USER_HOME:-/home/glite}/.certs/hostcert.pem - yaimgridenv_set GLITE_HOST_KEY ${GLITE_USER_HOME:-/home/glite}/.certs/hostkey.pem - yaimgridenv_set X509_CERT_DIR /etc/grid-security/certificates - yaimgridenv_set GLITE_JP_PRIMARY_PORT ${GLITE_JP_PRIMARY_PORT:-8901} - yaimgridenv_set GLITE_JP_PRIMARY_PEERS ${GLITE_JP_PRIMARY_PEERS:-$GLITE_LOCATION/etc/JPPS-peers} - yaimgridenv_set GLITE_JP_PRIMARY_FTP_PORT ${GLITE_JP_PRIMARY_FTP_PORT:-8911} - yaimgridenv_set GLITE_JP_PRIMARY_INTERNAL ${GLITE_USER_HOME:-/home/glite}/jpps - yaimgridenv_set GLITE_JP_PRIMARY_EXTERNAL gsiftp://`hostname -f`:${GLITE_JP_PRIMARY_FTP_PORT:-8911}${GLITE_USER_HOME:-/home/glite}/jpps - yaimgridenv_set GLITE_JP_PRIMARY_DBCS ${GLITE_JP_PRIMARY_DBCS:-jpps/@localhost:jpps} - yaimgridenv_set GLITE_JP_PRIMARY_SPECIAL ${GLITE_JP_PRIMARY_SPECIAL:-} - yaimgridenv_set GLITE_JP_GSI_AUTHZ ${GLITE_JP_GSI_AUTHZ:-$GLITE_LOCATION/etc/gsi_authz.conf} - - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/glite/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/globus/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/c-ares/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/classads/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/libtar/lib -} - -function config_glite_jpps() { - - #################################################### - # Job Provenance Primary Storage configuration # - #################################################### - - HOSTNAME=`hostname -f` - - chmod og+rx /var/lib/mysql/ - chown mysql:mysql /var/run/mysqld/ - - # add option --max_allowed_packet=17M - if [ ! -f /etc/my.cnf ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - else - grep "^[mysqld]" /etc/my.cnf > /dev/null - if [ ! $? = 0 ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - fi - fi - - /sbin/chkconfig mysqld on - ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - /etc/init.d/mysqld start - sleep 1 - fi - - ls /tmp/mysql.sock > /dev/null 2>&1 - if [ ! $? = 0 ]; then - ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock - fi - - # set mysql password - set_mysql_passwd || return 1 # the function uses $MYSQL_PASSWORD - - # Check if database exist - mysqlshow --password="$MYSQL_PASSWORD" | grep "jpps" > /dev/null 2>&1 - - if [ ! $? = 0 ]; then - mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE jpps" - mysql --password="$MYSQL_PASSWORD" jpps < ${INSTALL_ROOT}/glite/etc/glite-jp-primary-dbsetup.sql - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpps.* to jpps IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpps.* to jpps@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on jpps.* to jpps@localhost IDENTIFIED BY '' WITH GRANT OPTION;" - else - yaimlog "Database jpps already exists" - fi - - . /opt/glite/etc/profile.d/grid-env.sh - mkdir -p $GLITE_LOCATION_VAR # Needed to store PID of JPPS - chown $GLITE_USER:$GLITE_USER $GLITE_LOCATION_VAR - chmod 0755 $GLITE_LOCATION_VAR - - mkdir -p $GLITE_JP_PRIMARY_INTERNAL - chown $GLITE_USER:$GLITE_USER $GLITE_JP_PRIMARY_INTERNAL - chmod 0755 $GLITE_JP_PRIMARY_INTERNAL - - mkdir -p $GLITE_USER_HOME/.certs - chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs - chmod 0755 $GLITE_USER_HOME/.certs - cp -f /etc/grid-security/hostcert.pem /etc/grid-security/hostkey.pem $GLITE_USER_HOME/.certs/ - if [ ! $? = 0 ] ; then - echo "Please copy host certificate and key into /etc/grid-security and" - echo " $GLITE_USER_HOME/.certs/, change the owner of the ones in" - echo " $GLITE_USER_HOME/.certs/ to $GLITE_USER" - fi - chown $GLITE_USER:$GLITE_USER $GLITE_USER_HOME/.certs/hostcert.pem $GLITE_USER_HOME/.certs/hostkey.pem - chmod 0644 $GLITE_USER_HOME/.certs/hostcert.pem - chmod 0400 $GLITE_USER_HOME/.certs/hostkey.pem - - # Start services - if [ ! -f ${GLITE_LOCATION}/etc/gLiteservices ] ; then - touch ${GLITE_LOCATION}/etc/gLiteservices - fi - - grep glite-jp-primary ${GLITE_LOCATION}/etc/gLiteservices > /dev/null - if [ ! $? = 0 ] ; then - echo "${GLITE_LOCATION}/etc/init.d/glite-jp-primary" >> ${GLITE_LOCATION}/etc/gLiteservices - fi - - touch ${GLITE_JP_PRIMARY_PEERS} - - . /opt/glite/etc/profile.d/grid-env.sh - ${GLITE_LOCATION}/etc/init.d/glite-jp-primary stop - ${GLITE_LOCATION}/etc/init.d/glite-jp-primary start - - if [ ! $? = 0 ] ; then - yaimlog ABORT "Service glite-jp-primary failed to start!" - return 1 - fi - - return 0 - -} diff --git a/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sh b/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sh deleted file mode 100644 index 39a73e7..0000000 --- a/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sh +++ /dev/null @@ -1,30 +0,0 @@ -#! /bin/sh -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# -# Shell example of preparing the database for JP Index Server -# - -# database -mysqladmin -u root -p create jpps - -# user -mysql -u root -p -e 'GRANT ALL on jpps.* to jpps@localhost' - -# tables -mysql -u jpps jpps < `dirname $0`/glite-jp-primary-dbsetup.sql diff --git a/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql b/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql deleted file mode 100644 index 0e2dc70..0000000 --- a/org.glite.jp.primary/config/glite-jp-primary-dbsetup.sql +++ /dev/null @@ -1,63 +0,0 @@ -create table jobs ( - jobid char(32) binary not null, - dg_jobid varchar(255) binary not null, - owner char(32) binary not null, - - reg_time datetime not null, - - primary key (jobid), - unique (dg_jobid), - index (owner), - index (owner,reg_time) -); - -create table files ( - jobid char(32) binary not null, - filename varchar(255) binary not null, - int_path mediumblob null, - ext_url mediumblob null, - - state char(32) binary not null, - deadline datetime null, - ul_userid char(32) binary not null, - - primary key (jobid,filename), - index (ext_url(255)) -); - -create table attrs ( - jobid char(32) binary not null, - name varchar(255) binary not null, - value mediumblob null, - - primary key (jobid,name) -); - -create table users ( - userid char(32) binary not null, - cert_subj varchar(255) binary not null, - - primary key (userid), - unique (cert_subj) -); - -create table backend_info ( - version char(32) binary not null -); - -create table feeds ( - feedid char(32) binary not null, - destination varchar(255) binary not null, - expires datetime not null, - cols mediumblob not null, - query mediumblob not null, - - primary key (feedid) -); - -create table fed_jobs ( - feedid char(32) binary not null, - jobid char(32) binary not null, - - primary key (jobid,feedid) -); diff --git a/org.glite.jp.primary/config/gsi_authz.conf.example b/org.glite.jp.primary/config/gsi_authz.conf.example deleted file mode 100644 index 7f87c98..0000000 --- a/org.glite.jp.primary/config/gsi_authz.conf.example +++ /dev/null @@ -1,6 +0,0 @@ -GLOBUS_GSI_AUTHZ_SYSTEM_INIT glite-jp-callouts authz_jp_system_init_callout -GLOBUS_GSI_AUTHZ_SYSTEM_DESTROY glite-jp-callouts authz_jp_system_destroy_callout -GLOBUS_GSI_AUTHZ_HANDLE_INIT glite-jp-callouts authz_jp_handle_init_callout -GLOBUS_GSI_AUTHZ_HANDLE_DESTROY glite-jp-callouts authz_jp_handle_destroy_callout -GLOBUS_GSI_AUTHORIZE_ASYNC glite-jp-callouts authz_jp_authorize_async_callout -globus_mapping glite-jp-callouts authz_jp_globus_mapping diff --git a/org.glite.jp.primary/config/node-info.d/glite-jpps b/org.glite.jp.primary/config/node-info.d/glite-jpps deleted file mode 100644 index 6b707d4..0000000 --- a/org.glite.jp.primary/config/node-info.d/glite-jpps +++ /dev/null @@ -1,6 +0,0 @@ -JPPS_FUNCTIONS=" -config_host_certs -config_edgusers -config_globus_clients -config_glite_jpps -config_glite_initd" diff --git a/org.glite.jp.primary/config/site-info.def.example b/org.glite.jp.primary/config/site-info.def.example deleted file mode 100755 index ac95cdd..0000000 --- a/org.glite.jp.primary/config/site-info.def.example +++ /dev/null @@ -1,64 +0,0 @@ -# -# site-info.def example, part for org.glite.jp.primary -# -# options configured by YAIM can be overriden by: -# - /etc/glite.conf -# - $GLITE_LOCATION/etc/glite-wms.conf -# - $HOME/.glite.conf # of root user -# - -# -# required minimum set of YAIM options given from -# /opt/glite/yaim/examples/siteinfo/site-info.def -# -YAIM_LOGGING_LEVEL=INFO -MY_DOMAIN=civ.zcu.cz -INSTALL_ROOT=/opt -CRON_DIR=/etc/cron.d -GLOBUS_TCP_PORT_RANGE="20000,25000" -MYSQL_PASSWORD=set_this_to_a_good_password - -# -# default values of basic options -# - -#GLITE_LOCATION=${INSTALL_ROOT:-opt}/glite -#GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite} -#GLITE_USER=${GLITE_USER:-glite} -#GLITE_HOST_CERT=${GLITE_USER_HOME:-/home/glite}/.certs/hostcert.pem -#GLITE_HOST_KEY=${GLITE_USER_HOME:-/home/glite}/.certs/hostkey.pem -#X509_CERT_DIR=/etc/grid-security/certificates - - -# -# required external options -# - -#GLOBUS_LOCATION=/opt/globus -#CARES_LOCATION=/opt/c-ares - -# -# JPPS configuration default values -# - -# pidfile -#GLITE_JP_PRIMARY_PIDFILE=$GLITE_LOCATION_VAR/glite-jp-primarystoraged.pid - -# port -#GLITE_JP_PRIMARY_PORT=8901 - -# FTP port -#GLITE_JP_PRIMARY_FTP_PORT=8911 - -#FTP authz configuration file -#GLITE_JP_GSI_AUTHZ=$GLITE_LOCATION/etc/gsi_authz.conf - -# List of privileged DN subjects -#GLITE_JP_PRIMARY_PEERS=$GLITE_LOCATION/etc/JPPS-peers - -# connection string to database (USER/PASSWORD@HOST:DBNAME) -# If the default is changed, the database has to be created manually ! -#GLITE_JP_PRIMARY_DBCS=jpps/@localhost:jpps - -# Additional switches for JPPS. -#GLITE_JP_PRIMARY_SPECIAL="" diff --git a/org.glite.jp.primary/config/startup b/org.glite.jp.primary/config/startup deleted file mode 100644 index e901c96..0000000 --- a/org.glite.jp.primary/config/startup +++ /dev/null @@ -1,169 +0,0 @@ -#!/bin/sh - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-${GLITE_LOCATION}/var} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf - -[ -f $GLITE_LOCATION/etc/jp.conf ] && . $GLITE_LOCATION/etc/jp.conf -[ -f $GLITE_LOCATION_VAR/etc/jp.conf ] && . $GLITE_LOCATION_VAR/etc/jp.conf - -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -[ -n "$GLITE_JP_PRIMARY_PIDFILE" ] && pidfile=$GLITE_JP_PRIMARY_PIDFILE || - pidfile="$GLITE_LOCATION_VAR/glite-jp-primarystoraged.pid" - -unset creds - -test -n "$GLITE_JP_PRIMARY_PORT" || GLITE_JP_PRIMARY_PORT=8901 - -start() -{ - if test -z "$GLITE_USER" ;then - echo 'Error: GLITE_USER is not set' - echo FAILED - return 1 - fi - if test -z "$GLOBUS_LOCATION" ;then - echo 'Error: GLOBUS_LOCATION is not set' - echo FAILED - return 1 - fi - if test -z "$GLITE_JP_PRIMARY_PEERS" ;then - echo 'Error: incomplete configuration (GLITE_JP_PRIMARY_PEERS is not set)' - echo FAILED - return 1 - fi - if test -z "$GLITE_JP_PRIMARY_FTP_PORT" -o \ - -z "$GLITE_JP_PRIMARY_INTERNAL" -o -z "$GLITE_JP_PRIMARY_EXTERNAL" ;then - echo 'Error: incomplete configuration (GLITE_JP_PRIMARY_FTP_PORT,' \ - 'GLITE_JP_PRIMARY_INTERNAL, or GLITE_JP_PRIMARY_EXTERNAL is not set)' - echo FAILED - return 1 - fi - - if [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] ;then - creds="-c '$GLITE_HOST_CERT' -k '$GLITE_HOST_KEY'" - X509_USER_CERT="$GLITE_HOST_CERT" - X509_USER_KEY="$GLITE_HOST_KEY" - fi - - if test -z "$creds"; then - if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then - echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER" - creds="-c /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem" - X509_USER_CERT=/etc/grid-security/hostcert.pem - X509_USER_KEY=/etc/grid-security/hostkey.pem - fi - fi - - - [ -z "$creds" ] && echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2 - - unset GLITE_JP_PRIMARY_DBCS_OPTION - if test -n "$GLITE_JP_PRIMARY_DBCS"; then - GLITE_JP_PRIMARY_DBCS_OPTION="-BD,'$GLITE_JP_PRIMARY_DBCS'" - fi - - echo -n Starting glite-jp-primarystoraged ... - su - $GLITE_USER -c "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLOBUS_LOCATION/lib:$GLITE_LOCATION/lib \ - $GLITE_LOCATION/bin/glite-jp-primarystoraged \ - $GLITE_JP_DEBUG \ - -P $GLITE_LOCATION/lib/glite_lb_plugin.so -P $GLITE_LOCATION/lib/glite-jp-sandbox.so \ - $creds -a '$GLITE_JP_PRIMARY_PEERS' \ - -i '$pidfile' -p $GLITE_JP_PRIMARY_PORT $GLITE_JP_PRIMARY_SPECIAL \ - -BI,'$GLITE_JP_PRIMARY_INTERNAL' -BE,'$GLITE_JP_PRIMARY_EXTERNAL' \ - ${GLITE_JP_PRIMARY_DBCS_OPTION} " && echo " done" - if [ $? != 0 ]; then - echo " FAILED" - return 1 - fi - - echo -n Starting JP gridftp server ... - su - $GLITE_USER -c "X509_USER_CERT=\"$X509_USER_CERT\" \ - X509_USER_KEY=\"$X509_USER_KEY\" \ - GLITE_USER=\"$GLITE_USER\" \ - FTPBE_INT_PREFIX=\"$GLITE_JP_PRIMARY_INTERNAL\" \ - LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLOBUS_LOCATION/lib:$GLITE_LOCATION/lib \ - FTPBE_DB_CS=$GLITE_JP_PRIMARY_DBCS \ - GSI_AUTHZ_CONF=$GLITE_JP_GSI_AUTHZ \ - $GLOBUS_LOCATION/sbin/globus-gridftp-server -debug -s -p $GLITE_JP_PRIMARY_FTP_PORT & \ - pid=\$!; echo \$pid > $pidfile.ftpd; sleep 2; true kill -0 \$pid" && echo " done" || echo " FAILED" -} - -stop() -{ - if [ -f "$pidfile" ]; then - pid=`cat "$pidfile"` - kill $pid - echo -n Stopping glite-jp-primarystoraged \($pid\) ... - try=0 - while ps p $pid >/dev/null 2>&1; do - sleep 1; - try=`expr $try + 1` - if [ $try = 20 ]; then - echo " giving up after $try retries" - return 1 - fi - done - kill -9 $pid >/dev/null 2>&1 - echo " done" - rm -f "$pidfile" - else - echo "$pidfile" does not exist - glite-jp-primarystoraged not running? >&2 - return 1 - fi - if [ -f "$pidfile.ftpd" ]; then - pid=`cat "$pidfile.ftpd"` - kill $pid - echo -n Stopping JP ftp server \($pid\) ... - try=0 - while ps p $pid >/dev/null 2>&1; do - sleep 1; - try=`expr $try + 1` - if [ $try = 20 ]; then - echo " giving up after $try retries" - return 1 - fi - done - kill -9 $pid >/dev/null 2>&1 - echo " done" - rm -f "$pidfile.ftpd" - else - echo "$pidfile.ftpd" does not exist - JP ftp server not running? >&2 - return 1 - fi - - return 0 -} - -status() -{ - retval=0 - # XXX pidfile? - if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_JP_PRIMARY_PORT} .*LISTEN" >/dev/null 2>&1 ;then - echo glite-jp-primarystoraged running - else - echo glite-jp-primarystoraged not running - retval=1 - fi - - if netstat -an --inet | grep "^tcp .* 0.0.0.0:${GLITE_JP_PRIMARY_FTP_PORT} .*LISTEN" >/dev/null 2>&1 ;then - echo JP gridftp server running - else - echo JP gridftp server not running - retval=1 - fi - - return $retval -} - -case x$1 in - xstart) start;; - xstop) stop;; - xrestart) stop; start;; - xstatus) status;; - x*) echo usage: $0 start,stop,restart,status >&2 - exit 1;; -esac diff --git a/org.glite.jp.primary/configure b/org.glite.jp.primary/configure deleted file mode 100755 index 0bf1a3f..0000000 --- a/org.glite.jp.primary/configure +++ /dev/null @@ -1,701 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp.primary/doc/README.install b/org.glite.jp.primary/doc/README.install deleted file mode 100644 index 17d0d27..0000000 --- a/org.glite.jp.primary/doc/README.install +++ /dev/null @@ -1,59 +0,0 @@ -0. install glite-jp-primary package - -1. create MySQL database of the service, preferably using - ${GLITE_LOCATION}/etc/glite-jp-primary-dbsetup.sh - (the script prompts two times for MySQL root password) - -2. create a directory where JPPS files will be stored and configure - gridftp server so that this directory is accessible via gridftp - -3. create the configuration file $GLITE_LOCATION/etc/jp.conf, it should - contain /bin/sh syntax assignment to the following variables (or they - have to be set in the environment of the startup script by other means: - - GLITE_USER the unix user running the service - - GLOBUS_LOCATION where is Globus installed - - GLITE_JP_PRIMARY_FTP_PORT - port for the ftp JPPS interface (bulk file transfers) - - GLITE_JP_PRIMARY_INTERNAL - directory where the JPPS files are stored (local path) - - GLITE_JP_PRIMARY_EXTERNAL - URL prefix which is mapped by gridftp to the directory, - eg. gsiftp://this.host.name:$GLITE_JP_PRIMARY_FTP_PORT/some/directory - - - GLITE_JP_PRIMARY_PEERS - file with list (one per line) of X509 certificate subjects of "trusted peers", i.e. L&B servers which may upload data to this JPPS - - -4. start the service with - $GLITE_LOCATION/etc/init.d/glite-jp-primary start - - -5. This step taints the database with testing data. Don't do it if it is an issue. -It is not necessary for the service operation, it's just checking its basic functionality. - -$ JOB=https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng -$ TEST=$GLITE_LOCATION/examples/glite-jp-primary-test -$ export X5O9_USER_PROXY=/some/proxy.pem # must be among $GLITE_JP_PRIMARY_PEERS - -$ $TEST registerjob $JOB '/the/job/owner/x509/cert' - -$ $TEST startupload "urn:org.glite.jp.primary:lb" 1 text/plain - responds with destination gsiftp url - -$ globus-url-copy file:///$GLITE_LOCATION/examples/glite-jp-primary-sample_job.lb $DESTINATION_URL - -$ $TEST commitupload $DESTINATION_URL - -$ $TEST getjobattr $JOB http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus - -The command should output: - - Waiting FILE Mon Oct 10 23:48:47 2005 - --- diff --git a/org.glite.jp.primary/examples/README.test b/org.glite.jp.primary/examples/README.test deleted file mode 100644 index 9b939b7..0000000 --- a/org.glite.jp.primary/examples/README.test +++ /dev/null @@ -1,94 +0,0 @@ -Create database: ----------------- - -$ mysqladmin -u root -p create jpps -$ mysql -u root -p -mysql> grant all privileges on jpps.* to jpps@localhost identified by ''; - -$ mysql -p -u jpps jpps -#include - -#include -#include -#include - -#include - -#include "glite/jp/known_attr.h" - -#include "jpps_H.h" -#include "jpps_.nsmap" - -#include "jptype_map.h" -#include "glite/security/glite_gsplugin.h" -#include "glite/security/glite_gscompat.h" - -#if GSOAP_VERSION <= 20602 -#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob -#define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload -#define soap_call___jpsrv__CommitUpload soap_call___ns1__CommitUpload -#define soap_call___jpsrv__RecordTag soap_call___ns1__RecordTag -#define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex -#define soap_call___jpsrv__FeedIndexRefresh soap_call___ns1__FeedIndexRefresh -#define soap_call___jpsrv__GetJob soap_call___ns1__GetJob -#endif - -#define dprintf(FMT, ARGS...) fprintf(stderr, (FMT), ##ARGS) -#include "glite/jp/ws_fault.c" -#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0) - - -static void usage(const char *me) -{ - fprintf(stderr,"%s: [-s server-url] jobid\n",me); - - exit (EX_USAGE); -} - -static const char *orig2str(enum jptype__attrOrig orig) -{ - switch (orig) { - case jptype__attrOrig__SYSTEM: return "SYSTEM"; - case jptype__attrOrig__USER: return "USER"; - case jptype__attrOrig__FILE_: return "FILE"; - default: return "unknown"; - } -} - - -int main(int argc,char *argv[]) -{ - char *server = NULL; - int opt,ret = 0,i; - struct soap *soap = soap_new(); - struct _jpelem__GetJobAttributes in; - struct _jpelem__GetJobAttributesResponse out; - char *aname = "http://egee.cesnet.cz/en/Schema/LB/Attributes:JDL"; - struct cclassad *ad; - struct { char *a,*s; } *deps = calloc(1,sizeof *deps); - int ndeps = 0; - char *dep_s,*where,*end,*tmp_a,*tmp_s,*wa,*wa_r,*ws,*ws_r; - - if (argc < 2) usage(argv[0]); - - soap_init(soap); - soap_set_namespaces(soap, jpps__namespaces); - - soap_register_plugin(soap,glite_gsplugin); - - while ((opt = getopt(argc,argv,"s:")) >= 0) switch (opt) { - case 's': server = optarg; - break; - case '?': usage(argv[0]); - } - - if (server) { - argv += 2; - argc -= 2; - } - else server = "http://localhost:8901"; - - - - in.jobid = argv[1]; - in.__sizeattributes = 1; - in.attributes = &aname; - - puts("Retrieving JDL ..."); - if ((ret = check_fault(soap,soap_call___jpsrv__GetJobAttributes(soap,server,"",&in,&out)))) - return 1; - - ad = cclassad_create(GSOAP_STRING(GLITE_SECURITY_GSOAP_LIST_GET(out.attrValues, 0)->value)); - if (!ad) { - fputs("Can't parse JDL\n",stderr); - return 1; - } - - // cclassad_evaluate_to_string(ad,"dependencies",&dep_s); - cclassad_evaluate_to_expr(ad,"dependencies",&dep_s); - - /* XXX: assumes syntacticly correct dependencies = { ... } */ - where = strchr(dep_s,'{'); assert(where); - where++; - - while ((where = strchr(where, '{'))) { /* 2nd level */ - for (where++; isspace(*where); where++); - - if (*where == '{') end = strchr(where, '}')+1; /* more ancestors */ - else for (end = where; !isspace(*end) && *end != ','; end++); - tmp_a = strndup(where,end - where); - where = end++; - - while(isspace(*where)) where++; - where++; /* comma */ - while(isspace(*where)) where++; - - if (*where == '{') end = strchr(where, '}')+1; /* more successors */ - else for (end = where; !isspace(*end) && *end != ','; end++); - tmp_s = strndup(where,end - where); - where = strchr(end+1,'}'); - -#define DELIM "{} ,\t\n" - for (ws = strtok_r(tmp_s,DELIM,&ws_r); ws; ws = strtok_r(NULL,DELIM,&ws_r)) - for (wa = strtok_r(tmp_a,DELIM,&wa_r); wa; wa = strtok_r(NULL,DELIM,&wa_r)) { - deps[ndeps].a = strdup(wa); - deps[ndeps].s = strdup(ws); - deps = realloc(deps, (ndeps+2) * sizeof *deps); - ndeps++; - deps[ndeps].a = deps[ndeps].s = NULL; - } - free(tmp_a); free(tmp_s); - } - - for (i=0; deps[i].a; i++) { - char attr[1000],*ja,*js; - int have_a,have_s; - - printf("node: %s -> %s\n",deps[i].a,deps[i].s); - sprintf(attr,"nodes.%s.description.edg_jobid",deps[i].a); - have_a = cclassad_evaluate_to_string(ad,attr,&ja); - - sprintf(attr,"nodes.%s.description.edg_jobid",deps[i].s); - have_s = cclassad_evaluate_to_string(ad,attr,&js); - - printf("jobid: %s -> %s\n",ja,js); - - if (have_a && have_s) { - struct _jpelem__RecordTag in; - struct _jpelem__RecordTagResponse empty; - struct jptype__tagValue tagval; - struct jptype__stringOrBlob val; - - in.jobid = ja; - in.tag = &tagval; - tagval.name = GLITE_JP_ATTR_WF_SUCCESSOR; - tagval.value = &val; - memset(&val, 0, sizeof(val)); - GSOAP_SETSTRING(&val, js); - - printf("Register successor ...\n"); - ret = check_fault(soap,soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)); - in.jobid = js; - tagval.name = GLITE_JP_ATTR_WF_ANCESTOR; - GSOAP_SETSTRING(&val, ja); - - printf("Register ancestor ...\n"); - ret = check_fault(soap,soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)); - putchar(10); - } - } - - return ret; -} diff --git a/org.glite.jp.primary/examples/getjobattr.pl b/org.glite.jp.primary/examples/getjobattr.pl deleted file mode 100644 index 5f7609b..0000000 --- a/org.glite.jp.primary/examples/getjobattr.pl +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use SOAP::Lite; -use Data::Dumper; - -$ENV{HTTPS_CA_DIR}='/etc/grid-security/certificates'; -$ENV{HTTPS_VERSION}='3'; - -$cred = $ENV{X509_USER_PROXY} ? $ENV{X509_USER_PROXY} : "/tmp/x509up_u$<"; -$ENV{HTTPS_CERT_FILE}= $ENV{HTTPS_KEY_FILE} = $ENV{HTTPS_CA_FILE} = $cred; - -$proxy = shift; -$job = shift; - -die "usage: $0 https://jp.primary.storage.org:8901/jpps https://some.nice.job/id attr attr ...\n" - unless $ARGV[0]; - -$c = SOAP::Lite - -> proxy($proxy) - -> uri('http://glite.org/wsdl/services/jp'); - -service $c 'http://egee.cesnet.cz/cms/export/sites/egee/en/WSDL/3.1/JobProvenancePS.wsdl' or die "service: $1\n"; - -ns $c 'http://glite.org/wsdl/elements/jp'; - -print "WSDL OK\n"; - -push @attr,SOAP::Data->name(attributes => $_) for (@ARGV); - -$req = SOAP::Data->value( - SOAP::Data->name(jobid => $job), - @attr -# SOAP::Data->name(attributes => 'http://egee.cesnet.cz/en/Schema/LB/Attributes:CE'), -# SOAP::Data->name(attributes => 'http://egee.cesnet.cz/en/Schema/JP/System:owner') -); - - - -on_fault $c sub { print Dumper($_[1]->fault); $fault = 1; }; - -$resp = GetJobAttributes $c $req; - -print Dumper $resp->body unless $fault; - diff --git a/org.glite.jp.primary/examples/job_template b/org.glite.jp.primary/examples/job_template deleted file mode 100644 index 14b312d..0000000 --- a/org.glite.jp.primary/examples/job_template +++ /dev/null @@ -1,14 +0,0 @@ -DG.ARRIVED=20051010210927.000000 DATE=20051010210926.978300 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="UserInterface" DG.SRC_INSTANCE="" DG.EVNT="RegJob" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000001:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.REGJOB.JDL="blabla" DG.REGJOB.NS="NNNSSSS" DG.REGJOB.PARENT="" DG.REGJOB.JOBTYPE="SIMPLE" DG.REGJOB.NSUBJOBS="0" DG.REGJOB.SEED="uLU0BArrdV98O41PLThJ5Q" -DG.ARRIVED=20051010210928.000000 DATE=20051010210928.871099 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ACCEPTED.FROM="UserInterface" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DG.ARRIVED=20051010210928.000000 DATE=20051010210928.917822 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DG.ARRIVED=20051010210928.000000 DATE=20051010210928.947076 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DG.ARRIVED=20051010210928.000000 DATE=20051010210928.980395 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperCall" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.HELPERCALL.HELPER_NAME="name of the called component" DG.HELPERCALL.HELPER_PARAMS="parameters of the call" DG.HELPERCALL.SRC_ROLE="CALLING" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.011781 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="Match" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.MATCH.DEST_ID="destination CE/queue" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.283947 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Done" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000007:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.DONE.STATUS_CODE="OK" DG.DONE.REASON="reason for the change" DG.DONE.EXIT_CODE="0" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.042443 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperReturn" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.HELPERRETURN.HELPER_NAME="name of the called component" DG.HELPERRETURN.RETVAL="returned data" DG.HELPERRETURN.SRC_ROLE="CALLING" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.071034 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.101204 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000001:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.132080 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="Transfer" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000003:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.TRANSFER.DESTINATION="LRMS" DG.TRANSFER.DEST_HOST="destination hostname" DG.TRANSFER.DEST_INSTANCE="destination instance" DG.TRANSFER.JOB="(nil)" DG.TRANSFER.RESULT="OK" DG.TRANSFER.REASON="detailed description of transfer" DG.TRANSFER.DEST_JOBID="destination internal jobid" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.167712 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000001:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ACCEPTED.FROM="JobController" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.203602 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Transfer" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000003:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.TRANSFER.DESTINATION="LRMS" DG.TRANSFER.DEST_HOST="destination hostname" DG.TRANSFER.DEST_INSTANCE="destination instance" DG.TRANSFER.JOB="(nil)" DG.TRANSFER.RESULT="OK" DG.TRANSFER.REASON="detailed description of transfer" DG.TRANSFER.DEST_JOBID="destination internal jobid" -DG.ARRIVED=20051010210929.000000 DATE=20051010210929.249042 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Running" DG.JOBID="_CHANGE_ME_JOBID_" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000005:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.RUNNING.NODE="worker node" diff --git a/org.glite.jp.primary/examples/jpps-test.c b/org.glite.jp.primary/examples/jpps-test.c deleted file mode 100644 index e7fd993..0000000 --- a/org.glite.jp.primary/examples/jpps-test.c +++ /dev/null @@ -1,303 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include "jpps_H.h" -#include "jpps_.nsmap" - -#include "jptype_map.h" -#include "glite/security/glite_gsplugin.h" -#include "glite/security/glite_gscompat.h" - -#if GSOAP_VERSION <= 20602 -#define soap_call___jpsrv__RegisterJob soap_call___ns1__RegisterJob -#define soap_call___jpsrv__StartUpload soap_call___ns1__StartUpload -#define soap_call___jpsrv__CommitUpload soap_call___ns1__CommitUpload -#define soap_call___jpsrv__RecordTag soap_call___ns1__RecordTag -#define soap_call___jpsrv__FeedIndex soap_call___ns1__FeedIndex -#define soap_call___jpsrv__FeedIndexRefresh soap_call___ns1__FeedIndexRefresh -#define soap_call___jpsrv__GetJob soap_call___ns1__GetJob -#endif - -#define dprintf(FMT, ARGS...) printf(FMT, ##ARGS) -#include "glite/jp/ws_fault.c" -#define check_fault(SOAP, ERR) glite_jp_clientCheckFault((SOAP), (ERR), NULL, 0) - -static void usage(const char *me) -{ - fprintf(stderr,"%s: [-s server-url] operation args \n\n" - " operations are:\n" - " RegisterJob jobid owner\n" - " StartUpload jobid class commit_before mimetype\n" - " CommitUpload destination\n" - " RecordTag jobid tagname stringvalue ...\n" - " GetJobFiles jobid\n" - " GetJobAttr jobid attr\n" - " FeedIndex [yes (history)]\n" - " FeedIndexRefresh feedid\n" - ,me); - - exit (EX_USAGE); -} - -/* FIXME: new wsdl */ -#if 0 -static struct jptype__Attribute sample_attr[] = { - { OWNER, NULL }, - { TIME, "submitted" }, - { TAG, "test" }, -}; - -static struct jptype__PrimaryQueryElement sample_query[][5] = { - { - { sample_attr+OWNER, EQUAL, "unknown", NULL }, - { NULL, 0, NULL, NULL } - }, -}; -#endif - -static const char *orig2str(enum jptype__attrOrig orig) -{ - switch (orig) { - case jptype__attrOrig__SYSTEM: return "SYSTEM"; - case jptype__attrOrig__USER: return "USER"; - case jptype__attrOrig__FILE_: return "FILE"; - default: return "unknown"; - } -} - -int main(int argc,char *argv[]) -{ - char *server = NULL; - int opt,ret = 0; - struct soap *soap = soap_new2(SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE); - - if (argc < 2) usage(argv[0]); - -/* soap_init(soap); */ - soap_set_namespaces(soap, jpps__namespaces); - - soap_register_plugin(soap,glite_gsplugin); - - /*while ((opt = getopt(argc,argv,"s:")) >= 0) switch (opt) { - case 's': server = optarg; - break; - //case '?': usage(argv[0]); - }*/ - int i; - for (i = 0; i < argc-1; i++) - if (strcmp(argv[i], "-s") == 0) - server = argv[i+1]; - - if (server) { - argv += 2; - argc -= 2; - } - else server = "http://localhost:8901"; - - - if (!strcasecmp(argv[1],"RegisterJob")) { - struct _jpelem__RegisterJob in; - struct _jpelem__RegisterJobResponse empty; - - if (argc != 4) usage(argv[0]); - in.job = argv[2]; - in.owner = argv[3]; - ret = check_fault(soap, - soap_call___jpsrv__RegisterJob(soap,server,"",&in,&empty)); - } else if (!strcasecmp(argv[1], "StartUpload")) { - struct _jpelem__StartUpload in; - struct _jpelem__StartUploadResponse out; - - in.job = argv[2]; - in.class_ = argv[3]; - in.name = NULL; - in.commitBefore = atoi(argv[4]) + time(NULL); - in.contentType = argv[5]; - - if (argc != 6) usage(argv[0]); - if (!(ret = check_fault(soap, - soap_call___jpsrv__StartUpload(soap, server, "",&in,&out)))) - { - printf("Destination: %s\nCommit before: %s\n", out.destination, ctime(&out.commitBefore)); - } - } else if (!strcasecmp(argv[1], "CommitUpload")) { - struct _jpelem__CommitUpload in; - struct _jpelem__CommitUploadResponse empty; - - in.destination = argv[2]; - - if (argc != 3) usage(argv[0]); - if (!(ret = check_fault(soap, - soap_call___jpsrv__CommitUpload(soap, server, "",&in,&empty)))) { - /* OK */ - } - } else if (!strcasecmp(argv[1], "RecordTag")) { - struct _jpelem__RecordTag in; - struct _jpelem__RecordTagResponse empty; - struct jptype__tagValue tagval; - struct jptype__stringOrBlob val; - int idx; - - if (argc < 5 && argc % 2 == 0) usage(argv[0]); - - in.jobid = argv[2]; - in.tag = &tagval; - tagval.value = &val; - - for (idx = 3; idx < argc; idx += 2) { - tagval.name = argv[idx]; - memset(&val, 0, sizeof(val)); - GSOAP_SETSTRING(&val, argv[idx+1]); - - printf("%s ... ",tagval.name); - if (!(ret = check_fault(soap, - soap_call___jpsrv__RecordTag(soap, server, "",&in, &empty)))) { - /* OK */ - } - } - } - else if (!strcasecmp(argv[1],"FeedIndex")) { - char *ap[2] = { - "http://egee.cesnet.cz/en/Schema/LB/Attributes:RB", - "http://egee.cesnet.cz/en/Schema/JP/System:owner" - }; - int sizepq; - - struct jptype__stringOrBlob vals[2]; - memset(vals, 0, sizeof vals); - GSOAP_SETSTRING(vals, "/O=CESNET/O=Masaryk University/CN=Ales Krenek"); - GSOAP_SETSTRING(vals + 1, "Done"); - - struct jptype__primaryQuery q[] = { - { - "http://egee.cesnet.cz/en/Schema/JP/System:owner", - jptype__queryOp__EQUAL, - NULL, vals, NULL - }, - { - "http://egee.cesnet.cz/en/Schema/LB/Attributes:finalStatus", - jptype__queryOp__UNEQUAL, - NULL, vals+1, NULL - } - }; - GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, primaryQuery) pq; - - GLITE_SECURITY_GSOAP_LIST_CREATE0(soap, pq, sizepq, struct jptype__primaryQuery, 2); - memcpy(GLITE_SECURITY_GSOAP_LIST_GET(pq, 0), &q[0], sizeof(q[0])); - memcpy(GLITE_SECURITY_GSOAP_LIST_GET(pq, 1), &q[1], sizeof(q[1])); - struct _jpelem__FeedIndex in = { - "http://some.index//", - 2,ap, - sizepq,pq, - 0, - 1 - }; - struct _jpelem__FeedIndexResponse out; - - in.history = argc >= 3 && !strcasecmp(argv[2],"yes"); - - if (!(ret = check_fault(soap,soap_call___jpsrv__FeedIndex(soap,server,"",&in,&out)))) - { - printf("FeedId: %s\nExpires: %s\n",out.feedId,ctime(&out.feedExpires)); - } - GLITE_SECURITY_GSOAP_LIST_DESTROY(soap, &in, conditions); - } -/* FIXME: new wsdl */ -#if 0 - } else if (!strcasecmp(argv[1], "FeedIndexRefresh")) { - struct jpsrv__FeedIndexRefreshResponse r; - - if (argc != 3) usage(argv[0]); - if (!check_fault(soap, - soap_call_jpsrv__FeedIndexRefresh(soap, server, "", - argv[2], &r))) { - printf("FeedId: %s\nExpires: %s\n",r.feedId,ctime(&r.expires)); - } - } -#endif - else if (!strcasecmp(argv[1],"GetJobFiles")) { - struct _jpelem__GetJobFiles in; - struct _jpelem__GetJobFilesResponse out; - struct jptype__jppsFile *outf; - - if (argc != 3) usage(argv[0]); - in.jobid = argv[2]; - - if (!(ret = check_fault(soap,soap_call___jpsrv__GetJobFiles(soap,server,"", - &in,&out)))) - { - int i; - - printf("JobFiles:\n"); - - for (i=0; iclass_, - outf->name, - outf->url); - } - } - - } - else if (!strcasecmp(argv[1],"GetJobAttr")) { - struct _jpelem__GetJobAttributes in; - struct _jpelem__GetJobAttributesResponse out; - struct jptype__attrValue *outav; - - int rep = 1; - - if (argc < 4 || argc > 5) usage(argv[0]); - - if (argc == 5) rep = atoi(argv[4]); - - in.jobid = argv[2]; - in.__sizeattributes = 1; - in.attributes = &argv[3]; - - for (;rep;rep--) if (!(ret = check_fault(soap,soap_call___jpsrv__GetJobAttributes(soap,server,"",&in,&out)))) - { - int i; - - puts("Attribute values:"); - for (i=0; ivalue) ? - GSOAP_STRING(outav->value) : - "binary", - orig2str(outav->origin), - outav->originDetail, - ctime(&outav->timestamp)); - } - - } - - } - else { usage(argv[0]); ret = 1; } - - return ret; -} - - -/* XXX: we don't use it */ -SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} }; diff --git a/org.glite.jp.primary/examples/jpps_store_test b/org.glite.jp.primary/examples/jpps_store_test deleted file mode 100755 index c461739..0000000 --- a/org.glite.jp.primary/examples/jpps_store_test +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/bash - -# usage: -# -# $ export X509_USER_PROXY=/trusted/peer/credentials -# $ /where/it/is/jpps_store_test \ -# -s jppps.host.name:port \ # default localhost:8901 -# -o '/job/owner/DN' \ # mandatory -# -t "name=value" ... \ # may occur multiple times -# -d /dump/file/template # optional -# -# in /dump/file/template occurences of _CHANGE_ME_JOBID_ are substituted with -# fake jobid generated by this script - -echodo() -{ - echo '**' $@ - "$@" || exit 1 -} - -if [ -f jpps-test ]; -then - jpps="./jpps-test" -elif [ -f glite-jp-primary-test ]; -then - jpps="./glite-jp-primary-test" -else - echo "glite-jp-primary-test or jpps-test not found!" - exit 1; -fi - -#getopt -s sh o:d:t:s: "$@" -#set -- `getopt -s sh o:d:t:s: "$@"` -while [ "x$1" != x ]; do case $1 in - -s) shift; jpps="$jpps -s $1";; - -o) shift; owner="$1";; - -d) shift; dump="$1";; - -t) shift; tags="$1|$tags";; -esac; shift; done - -[ x"$owner" = x ] && { echo -o required; exit 1; } - -jobid="https://nonexistent.test.server/jpps_store_test_$$" - -echodo $jpps RegisterJob $jobid "$owner" - -echodo $jpps GetJobAttr $jobid http://egee.cesnet.cz/en/Schema/JP/System:owner - -echodo $jpps GetJobAttr $jobid http://egee.cesnet.cz/en/Schema/JP/System:regtime - - -if [ -f "$dump" ]; then - sed "s|_CHANGE_ME_JOBID_|$jobid|" $dump >job.$$ - echodo $jpps StartUpload $jobid urn:org.glite.jp.primary:lb 1234 text/plain >start.$$ - cat start.$$ - dest=`grep '^Destination:' start.$$ | cut -d' ' -f2` - rm start.$$ - echodo globus-url-copy "file:$PWD/job.$$" $dest -# rm job.$$ - echodo $jpps CommitUpload "$dest" - -# does not pass authz check -- probably OK -# echodo $jpps GetJobFiles $jobid - - lbprefix="http://egee.cesnet.cz/en/Schema/LB/Attributes" - echodo $jpps GetJobAttr $jobid "$lbprefix:user" - echodo $jpps GetJobAttr $jobid "$lbprefix:finalStatus" -fi - -if [ "x$tags" != x ]; then - oIFS=$IFS - IFS='|' - set -- $tags - IFS=$oIFS - - while [ x$1 != x ]; do - value=`echo $1 | sed 's/^.*=//'` - name=`echo $1 | sed 's/=.*$//'` - - echodo $jpps RecordTag $jobid $name $value - - echodo $jpps GetJobAttr $jobid $name - - shift - done -fi diff --git a/org.glite.jp.primary/examples/recordmultitags.pl b/org.glite.jp.primary/examples/recordmultitags.pl deleted file mode 100755 index e7f05f0..0000000 --- a/org.glite.jp.primary/examples/recordmultitags.pl +++ /dev/null @@ -1,77 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use SOAP::Lite; -use Data::Dumper; - -$ENV{HTTPS_CA_DIR}='/etc/grid-security/certificates'; -$ENV{HTTPS_VERSION}='3'; - -$cred = $ENV{X509_USER_PROXY} ? $ENV{X509_USER_PROXY} : "/tmp/x509up_u$<"; -$ENV{HTTPS_CERT_FILE}= $ENV{HTTPS_KEY_FILE} = $ENV{HTTPS_CA_FILE} = $cred; - -$proxy = shift; - -die "usage: $0 https://jp.primary.storage.org:8901/jpps https://some.nice.job/id attr=value ...\n\t\thttps://another.nice.job/id attr=value ...\n" - unless $ARGV[0]; - -$c = SOAP::Lite - -> proxy($proxy) - -> uri('http://glite.org/wsdl/services/jp'); - -service $c 'http://egee.cesnet.cz/cms/export/sites/egee/en/WSDL/HEAD/JobProvenancePS.wsdl' or die "service: $1\n"; - -ns $c 'http://glite.org/wsdl/elements/jp'; - -print "WSDL OK\n"; - -push @ARGV,'__KONEC__'; -$job = shift; -while ($_ = shift) { - if (! /(.*)=(.*)/) { - push @j,SOAP::Data->name(jobs => \SOAP::Data->value( - SOAP::Data->name(jobid=>$job), - @a - )); - - break if $_ eq '__KONEC__'; - - $job = $_; - @a = (); - } - else { - $name = $1; $value = $2; - print "$job: $name = $value\n"; - - push @a, SOAP::Data->name(attributes=>\SOAP::Data->value( - SOAP::Data->name(name=>$name), - SOAP::Data->name(value=> \SOAP::Data->value(SOAP::Data->name(string=>$value))) - )) - } -} - - -$req = SOAP::Data->value(@j); -print Dumper($req); - -on_fault $c sub { print Dumper($_[1]->fault); $fault = 1; }; - -$resp = RecordMultiTags $c $req; - -print Dumper $resp->body unless $fault; - diff --git a/org.glite.jp.primary/examples/sample_job_aborted b/org.glite.jp.primary/examples/sample_job_aborted deleted file mode 100644 index daf2674..0000000 --- a/org.glite.jp.primary/examples/sample_job_aborted +++ /dev/null @@ -1,9 +0,0 @@ -DATE=20060313114012.259501 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="UserInterface" DG.SRC_INSTANCE="" DG.EVNT="RegJob" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000001:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.REGJOB.JDL="blabla" DG.REGJOB.NS="NNNSSSS" DG.REGJOB.PARENT="" DG.REGJOB.JOBTYPE="SIMPLE" DG.REGJOB.NSUBJOBS="0" DG.REGJOB.SEED="uLU0BArrdV98O41PLThJ5Q" -DATE=20060313114012.332573 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ACCEPTED.FROM="UserInterface" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DATE=20060313114012.421854 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DATE=20060313114012.527562 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DATE=20060313114012.629873 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperCall" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.HELPERCALL.HELPER_NAME="name of the called component" DG.HELPERCALL.HELPER_PARAMS="parameters of the call" DG.HELPERCALL.SRC_ROLE="CALLING" -DATE=20060313114012.730207 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="Match" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.MATCH.DEST_ID="destination CE/queue" -DATE=20060313114012.835673 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperReturn" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.HELPERRETURN.HELPER_NAME="name of the called component" DG.HELPERRETURN.RETVAL="returned data" DG.HELPERRETURN.SRC_ROLE="CALLING" -DATE=20060313114012.940723 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DATE=20060313114013.040365 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="Abort" DG.JOBID="https://scientific.civ.zcu.cz:9000/c63-U-RaOAAHp8YV8QMipw" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000001:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ABORT.REASON="just to test" diff --git a/org.glite.jp.primary/examples/sample_job_cleared b/org.glite.jp.primary/examples/sample_job_cleared deleted file mode 100644 index 65793b8..0000000 --- a/org.glite.jp.primary/examples/sample_job_cleared +++ /dev/null @@ -1,15 +0,0 @@ -DATE=20060313113718.964280 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="UserInterface" DG.SRC_INSTANCE="" DG.EVNT="RegJob" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000001:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.REGJOB.JDL="blabla" DG.REGJOB.NS="NNNSSSS" DG.REGJOB.PARENT="" DG.REGJOB.JOBTYPE="SIMPLE" DG.REGJOB.NSUBJOBS="0" DG.REGJOB.SEED="uLU0BArrdV98O41PLThJ5Q" -DATE=20060313113719.131973 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ACCEPTED.FROM="UserInterface" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DATE=20060313113719.202155 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DATE=20060313113719.316644 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DATE=20060313113719.442051 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperCall" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.HELPERCALL.HELPER_NAME="name of the called component" DG.HELPERCALL.HELPER_PARAMS="parameters of the call" DG.HELPERCALL.SRC_ROLE="CALLING" -DATE=20060313113719.542691 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="Match" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.MATCH.DEST_ID="destination CE/queue" -DATE=20060313113719.632697 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperReturn" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.HELPERRETURN.HELPER_NAME="name of the called component" DG.HELPERRETURN.RETVAL="returned data" DG.HELPERRETURN.SRC_ROLE="CALLING" -DATE=20060313113719.739851 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DATE=20060313113719.839754 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000001:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DATE=20060313113719.955172 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="Transfer" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000003:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.TRANSFER.DESTINATION="LRMS" DG.TRANSFER.DEST_HOST="destination hostname" DG.TRANSFER.DEST_INSTANCE="destination instance" DG.TRANSFER.JOB="(nil)" DG.TRANSFER.RESULT="OK" DG.TRANSFER.REASON="detailed description of transfer" DG.TRANSFER.DEST_JOBID="destination internal jobid" -DATE=20060313113720.062341 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000001:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ACCEPTED.FROM="JobController" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DATE=20060313113720.158744 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Transfer" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000003:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.TRANSFER.DESTINATION="LRMS" DG.TRANSFER.DEST_HOST="destination hostname" DG.TRANSFER.DEST_INSTANCE="destination instance" DG.TRANSFER.JOB="(nil)" DG.TRANSFER.RESULT="OK" DG.TRANSFER.REASON="detailed description of transfer" DG.TRANSFER.DEST_JOBID="destination internal jobid" -DATE=20060313113720.261956 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Running" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000005:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.RUNNING.NODE="worker node" -DATE=20060313113720.371040 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Done" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000007:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DONE.STATUS_CODE="OK" DG.DONE.REASON="reason for the change" DG.DONE.EXIT_CODE="0" -DATE=20060313113720.473822 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Clear" DG.JOBID="https://scientific.civ.zcu.cz:9000/Zziy0_yoV0-j9dtlNl1h7w" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000009:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.CLEAR.REASON="USER" diff --git a/org.glite.jp.primary/examples/sample_job_tagged_done b/org.glite.jp.primary/examples/sample_job_tagged_done deleted file mode 100644 index 1c0d57d..0000000 --- a/org.glite.jp.primary/examples/sample_job_tagged_done +++ /dev/null @@ -1,15 +0,0 @@ -DATE=20060313114125.327248 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="UserInterface" DG.SRC_INSTANCE="" DG.EVNT="RegJob" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000001:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.REGJOB.JDL="blabla" DG.REGJOB.NS="NNNSSSS" DG.REGJOB.PARENT="" DG.REGJOB.JOBTYPE="SIMPLE" DG.REGJOB.NSUBJOBS="0" DG.REGJOB.SEED="uLU0BArrdV98O41PLThJ5Q" -DATE=20060313114125.449249 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ACCEPTED.FROM="UserInterface" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DATE=20060313114125.577238 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DATE=20060313114125.708618 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DATE=20060313114125.817613 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperCall" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.HELPERCALL.HELPER_NAME="name of the called component" DG.HELPERCALL.HELPER_PARAMS="parameters of the call" DG.HELPERCALL.SRC_ROLE="CALLING" -DATE=20060313114125.913634 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="Match" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.MATCH.DEST_ID="destination CE/queue" -DATE=20060313114126.015139 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperReturn" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.HELPERRETURN.HELPER_NAME="name of the called component" DG.HELPERRETURN.RETVAL="returned data" DG.HELPERRETURN.SRC_ROLE="CALLING" -DATE=20060313114126.132840 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DATE=20060313114126.254850 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000001:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DATE=20060313114126.359397 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="JobController" DG.SRC_INSTANCE="" DG.EVNT="Transfer" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000003:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.TRANSFER.DESTINATION="LRMS" DG.TRANSFER.DEST_HOST="destination hostname" DG.TRANSFER.DEST_INSTANCE="destination instance" DG.TRANSFER.JOB="(nil)" DG.TRANSFER.RESULT="OK" DG.TRANSFER.REASON="detailed description of transfer" DG.TRANSFER.DEST_JOBID="destination internal jobid" -DATE=20060313114126.462961 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000001:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.ACCEPTED.FROM="JobController" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DATE=20060313114126.564692 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Transfer" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000003:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.TRANSFER.DESTINATION="LRMS" DG.TRANSFER.DEST_HOST="destination hostname" DG.TRANSFER.DEST_INSTANCE="destination instance" DG.TRANSFER.JOB="(nil)" DG.TRANSFER.RESULT="OK" DG.TRANSFER.REASON="detailed description of transfer" DG.TRANSFER.DEST_JOBID="destination internal jobid" -DATE=20060313114126.665625 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Running" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000005:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.RUNNING.NODE="worker node" -DATE=20060313114126.775084 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="LogMonitor" DG.SRC_INSTANCE="" DG.EVNT="Done" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000007:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.DONE.STATUS_CODE="OK" DG.DONE.REASON="reason for the change" DG.DONE.EXIT_CODE="0" -DATE=20060313114936.079576 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="Application" DG.SRC_INSTANCE="" DG.EVNT="UserTag" DG.JOBID="https://scientific.civ.zcu.cz:9000/rQn3lfqMWxWz3Dpm7kypqQ" DG.SEQCODE="UI=000002:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000007:LRMS=000000:APP=000002" DG.USER="/O=CESNET/O=Masaryk University/CN=Milos Mulac" DG.USERTAG.NAME="color" DG.USERTAG.VALUE="green" diff --git a/org.glite.jp.primary/examples/sample_job_waiting b/org.glite.jp.primary/examples/sample_job_waiting deleted file mode 100644 index f9b515f..0000000 --- a/org.glite.jp.primary/examples/sample_job_waiting +++ /dev/null @@ -1,8 +0,0 @@ -DG.ARRIVED=20051010204845.000000 DATE=20051010204845.409455 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="UserInterface" DG.SRC_INSTANCE="" DG.EVNT="RegJob" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000001:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.REGJOB.JDL="blabla" DG.REGJOB.NS="NNNSSSS" DG.REGJOB.PARENT="" DG.REGJOB.JOBTYPE="SIMPLE" DG.REGJOB.NSUBJOBS="0" DG.REGJOB.SEED="uLU0BArrdV98O41PLThJ5Q" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.451986 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="DeQueued" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.DEQUEUED.QUEUE="queue name" DG.DEQUEUED.LOCAL_JOBID="new jobId assigned by the receiving component" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.485702 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperCall" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.HELPERCALL.HELPER_NAME="name of the called component" DG.HELPERCALL.HELPER_PARAMS="parameters of the call" DG.HELPERCALL.SRC_ROLE="CALLING" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.520663 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="Match" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.MATCH.DEST_ID="destination CE/queue" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.552015 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="HelperReturn" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.HELPERRETURN.HELPER_NAME="name of the called component" DG.HELPERRETURN.RETVAL="returned data" DG.HELPERRETURN.SRC_ROLE="CALLING" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.584267 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="WorkloadManager" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.381506 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="Accepted" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ACCEPTED.FROM="UserInterface" DG.ACCEPTED.FROM_HOST="sending component hostname" DG.ACCEPTED.FROM_INSTANCE="sending component instance" DG.ACCEPTED.LOCAL_JOBID="new jobId (Condor Globus ...)" -DG.ARRIVED=20051010204847.000000 DATE=20051010204847.409422 HOST="scientific.civ.zcu.cz" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=0 DG.SOURCE="NetworkServer" DG.SRC_INSTANCE="" DG.EVNT="EnQueued" DG.JOBID="https://scientific.civ.zcu.cz:9200/1Yjk3Wlaspl07y45iX8Tng" DG.SEQCODE="UI=000002:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000" DG.USER="/O=CESNET/O=Masaryk University/CN=Ales Krenek" DG.ENQUEUED.QUEUE="destination queue" DG.ENQUEUED.JOB="job description in receiver language" DG.ENQUEUED.RESULT="OK" DG.ENQUEUED.REASON="detailed description of transfer" diff --git a/org.glite.jp.primary/project/ChangeLog b/org.glite.jp.primary/project/ChangeLog deleted file mode 100644 index 072a7ec..0000000 --- a/org.glite.jp.primary/project/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -1.5.0-1 -- Initial version - -1.5.0-2 -- configure updated - diff --git a/org.glite.jp.primary/project/build.number b/org.glite.jp.primary/project/build.number deleted file mode 100644 index 17d7d4d..0000000 --- a/org.glite.jp.primary/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Sat Oct 15 06:52:14 CEST 2005 -module.build=39 diff --git a/org.glite.jp.primary/project/build.properties b/org.glite.jp.primary/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.jp.primary/project/configure.properties.xml b/org.glite.jp.primary/project/configure.properties.xml deleted file mode 100644 index cfa060a..0000000 --- a/org.glite.jp.primary/project/configure.properties.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -expat_prefix=${with.expat.prefix} -gsoap_prefix=${with.gsoap.prefix} -gsoap_version=${ext.gsoap.version} -mysql_prefix=${with.mysql.prefix} -mysql_version=${ext.mysql.version} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -cppunit=${with.cppunit.prefix} -jpproject=${subsystem.project.dir} -project=${component.project.dir} -classads_prefix=${with.classads.prefix} -libtar_prefix=${with.libtar.prefix} - - - diff --git a/org.glite.jp.primary/project/properties.xml b/org.glite.jp.primary/project/properties.xml deleted file mode 100755 index 2149dd4..0000000 --- a/org.glite.jp.primary/project/properties.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.primary/project/tar_exclude b/org.glite.jp.primary/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.jp.primary/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.jp.primary/project/version.properties b/org.glite.jp.primary/project/version.properties deleted file mode 100644 index 5cacd92..0000000 --- a/org.glite.jp.primary/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.5.0 -module.age=2 diff --git a/org.glite.jp.primary/src/attrs.c b/org.glite.jp.primary/src/attrs.c deleted file mode 100644 index 6762102..0000000 --- a/org.glite.jp.primary/src/attrs.c +++ /dev/null @@ -1,278 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "glite/jp/types.h" -#include "glite/jp/attr.h" -#include "glite/jp/backend.h" -#include "glite/jp/file_plugin.h" -#include "glite/jp/builtin_plugins.h" - -#include "feed.h" -#include "attrs.h" - -static struct { - char *namespace; - glite_jpps_fplug_data_t **plugins; - int nplugins; - char **opened_classes; // for each plugin contains name of the open class (NULL for no open file) - char **opened_files; // for each plugin contains name of the open file (NULL for no open file) - void **plugin_handles; // contains handle for each opened plugin (NULL for not opened) - void **file_handles; // contains handle for each opened file by plugin (NULL for not opened) -} *known_namespaces; - -static void scan_namespaces(glite_jp_context_t ctx) -{ - int i,j,k; - glite_jpps_fplug_data_t *pd; - - if (!ctx->plugins) return; - - for (i=0; ctx->plugins[i]; i++) { - pd = ctx->plugins[i]; - - if (pd->namespaces){ - for (j=0; pd->namespaces[j]; j++) { - for (k=0; known_namespaces && known_namespaces[k].namespace - && strcmp(pd->namespaces[j],known_namespaces[k].namespace); k++) {}; - - if (known_namespaces && known_namespaces[k].namespace) { - printf("Adding new plugin into namespace %s\n", known_namespaces[k].namespace); - known_namespaces[k].plugins = realloc(known_namespaces[k].plugins, - (known_namespaces[k].nplugins + 2) * sizeof(glite_jpps_fplug_data_t *)); - known_namespaces[k].plugins[known_namespaces[k].nplugins++] = pd; - known_namespaces[k].plugins[known_namespaces[k].nplugins] = NULL; - known_namespaces[k].namespace = pd->namespaces[j]; - known_namespaces[k].opened_classes = realloc(known_namespaces[k].opened_classes, - (known_namespaces[k].nplugins + 1) * sizeof(char*)); - known_namespaces[k].opened_classes[known_namespaces[k].nplugins-1] = NULL; - known_namespaces[k].opened_files = realloc(known_namespaces[k].opened_files, - (known_namespaces[k].nplugins + 1) * sizeof(char*)); - known_namespaces[k].opened_files[known_namespaces[k].nplugins-1] = NULL; - known_namespaces[k].plugin_handles = realloc(known_namespaces[k].plugin_handles, - (known_namespaces[k].nplugins + 1) * sizeof(void*)); - known_namespaces[k].plugin_handles[known_namespaces[k].nplugins-1] = NULL; - known_namespaces[k].file_handles = realloc(known_namespaces[k].file_handles, - (known_namespaces[k].nplugins + 1) * sizeof(void*)); - known_namespaces[k].file_handles[known_namespaces[k].nplugins-1] = NULL; - } - else { - printf("Adding new namespace %s\n", pd->namespaces[j]); - known_namespaces = realloc(known_namespaces,(k+2) * sizeof *known_namespaces); - known_namespaces[k].plugins = malloc(2 * sizeof(glite_jpps_fplug_data_t *)); - known_namespaces[k].plugins[0] = pd; - known_namespaces[k].plugins[1] = NULL; - known_namespaces[k].nplugins = 1; - known_namespaces[k].namespace = pd->namespaces[j]; - memset(known_namespaces+k+1,0,sizeof *known_namespaces); - known_namespaces[k].opened_classes = calloc(1, sizeof(char*)); - known_namespaces[k].opened_files = calloc(1, sizeof(char*)); - known_namespaces[k].plugin_handles = calloc(1, sizeof(void*)); - known_namespaces[k].file_handles = calloc(1, sizeof(void*)); - } - } - } - } -} - -static int merge_attrvals(glite_jp_attrval_t **out,int nout,const glite_jp_attrval_t *in) -{ - int nin; - - if (!in) return nout; - - for (nin=0; in[nin].name; nin++); - *out = realloc(*out,(nout+nin+1) * sizeof **out); - memcpy(*out + nout,in,(nin+1) * sizeof **out); - memset(*out + nout+nin, 0, sizeof **out); - return nout+nin; -} - -static void process_files(glite_jp_context_t ctx, const char *job, glite_jp_attrval_t** out, int* nout, const char* attr, const glite_jpps_fplug_data_t* plugin, const char* class, const char* uri, char **opened_class, char **opened_file, void **op_handle, void **of_handle){ - void *ph, *beh; - char** names = NULL; - int nnames; - int n; - glite_jp_error_t *keep_err = NULL; - - nnames = glite_jppsbe_get_names(ctx, job, class, &names); - - for (n = 0; n < nnames; n++){ - int plugin_ok = 0; - if (*opened_class && !strcmp(*opened_class, class) && ((!*opened_file && !names[n]) || !strcmp(*opened_file, names[n]))){ - ph = *op_handle; - beh = *of_handle; - plugin_ok = 1; - } - else{ - if (*opened_class){ - free(*opened_class); - *opened_class = NULL; - free(*opened_file); - *opened_file = NULL; - plugin->ops.close(plugin->fpctx, *op_handle); - *op_handle = NULL; - glite_jppsbe_close_file(ctx, *of_handle); - *of_handle = NULL; - } - if (! glite_jppsbe_open_file(ctx,job,class, names[n], O_RDONLY, &beh) - && !plugin->ops.open(plugin->fpctx,beh,uri,&ph)){ - plugin_ok = 1; - *opened_class = strdup(class); - if (names[n]) - *opened_file = strdup(names[n]); - else - *opened_file = NULL; - *op_handle = (void*)ph; - *of_handle = (void*)beh; - printf("opening plugin %i at class %s, file %s\n", *op_handle, class, names[n]); - } - } - if (plugin_ok){ - glite_jp_attrval_t* myattr; - // XXX: ignore errors - if (!plugin->ops.attr(plugin->fpctx,ph,attr,&myattr) && myattr) { - int k; - for (k=0; myattr[k].name; k++) { - myattr[k].origin = GLITE_JP_ATTR_ORIG_FILE; - if (!myattr[k].origin_detail) - trio_asprintf(&myattr[k].origin_detail,"%s %s", uri, names[n] ? names[n] : ""); - } - *nout = merge_attrvals(out,*nout,myattr); - free(myattr); - } - keep_err = ctx->error; ctx->error = NULL; - if (keep_err) { ctx->error = keep_err; keep_err = NULL; } - } - keep_err = ctx->error; ctx->error = NULL; - if (keep_err) { ctx->error = keep_err; keep_err = NULL; } - } - - for (n = 0; n < nnames; n++) - free(names[n]); - free(names); -} - -int glite_jpps_get_attrs(glite_jp_context_t ctx,const char *job,char **attr,int nattr,glite_jp_attrval_t **attrs_out) -{ - glite_jp_attrval_t *meta = NULL,*out = NULL,*tag_out = NULL; - char const **other = NULL; - int i,j,nmeta,nother,err = 0,nout = 0; - - nmeta = nother = 0; - glite_jp_clear_error(ctx); - -/* sort the queried attributes to backend metadata and others -- retrived by plugins - * XXX: assumes unique values for metadata. - */ - - for (i=0; iclasses[l]; l++) - process_files(ctx, job, &out, &nout, other[i], known_namespaces[j].plugins[k] - , known_namespaces[j].plugins[k]->classes[l] - , known_namespaces[j].plugins[k]->uris[l] - , &known_namespaces[j].opened_classes[k] - , &known_namespaces[j].opened_files[k] - , &known_namespaces[j].plugin_handles[k] - , &known_namespaces[j].file_handles[k]); - break; - } - } - free(attr_namespace); - } - -/* close plugins */ - for (i = 0; known_namespaces && known_namespaces[i].namespace; i++) - for (j = 0; known_namespaces[i].plugins[j]; j++) - if (known_namespaces[i].opened_classes[j]){ - known_namespaces[i].plugins[j]->ops.close(known_namespaces[i].plugins[j]->fpctx - , known_namespaces[i].plugin_handles[j]); - printf("closing plugin %i at class %s, file %s\n", known_namespaces[i].plugin_handles[j], known_namespaces[i].opened_classes[j], known_namespaces[i].opened_files[j]); - glite_jppsbe_close_file(ctx, known_namespaces[i].file_handles[j]); - if (known_namespaces[i].opened_classes[j]){ - free(known_namespaces[i].opened_classes[j]); - known_namespaces[i].opened_classes[j] = NULL; - } - if (known_namespaces[i].opened_files[j]){ - free(known_namespaces[i].opened_files[j]); - known_namespaces[i].opened_files[j] = NULL; - } - known_namespaces[i].plugin_handles[j] = NULL; - known_namespaces[i].file_handles[j] = NULL; - } - - nout = merge_attrvals(&out,nout,meta); - - free(meta); meta = NULL; - - if (nout) { - *attrs_out = out; - err = 0; - } - else { - glite_jp_error_t e; - e.code = ENOENT; - e.source = __FUNCTION__; - e.desc = "no attributes found"; - err = glite_jp_stack_error(ctx,&e); - } - -cleanup: - if (meta) for (i=0; i -#include -#include -#include - -#include "glite/jp/types.h" -#include "glite/jp/context.h" - -#include "jpps_H.h" -#include "jptype_map.h" - -int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner) -{ - glite_jp_error_t err; - char buf[200]; - int i; - - memset(&err,0,sizeof err); - glite_jp_clear_error(ctx); - err.source = __FUNCTION__; - err.code = EPERM; - - switch (op) { - case SOAP_TYPE___jpsrv__RegisterJob: - case SOAP_TYPE___jpsrv__StartUpload: - case SOAP_TYPE___jpsrv__CommitUpload: - for (i=0; ctx->trusted_peers && ctx->trusted_peers[i]; i++) - if (!strcmp(ctx->trusted_peers[i],ctx->peer)) return 0; - err.desc = "you are not a trusted peer"; - return glite_jp_stack_error(ctx,&err); - - case SOAP_TYPE___jpsrv__GetJobFiles: - case SOAP_TYPE___jpsrv__GetJobAttributes: - case SOAP_TYPE___jpsrv__RecordTag: - assert(owner); - if (!ctx->noauth && strcmp(owner,ctx->peer)) { - err.desc = "you are not a job owner"; - glite_jp_stack_error(ctx,&err); - return 1; - } - return 0; - break; - - default: - snprintf(buf,sizeof buf,"%d: unknown operation",op); - err.desc = buf; - err.code = EINVAL; - return glite_jp_stack_error(ctx,&err); - } -} - -int glite_jpps_readauth(glite_jp_context_t ctx,const char *file) -{ - FILE *f = fopen(file,"r"); - glite_jp_error_t err; - int cnt = 0; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - if (!f) { - err.code = errno; - err.desc = file; - return glite_jp_stack_error(ctx,&err); - } - - ctx->trusted_peers = NULL; - while (!feof(f)) { - char buf[BUFSIZ]; - - if (fscanf(f,"%[^\n]\n",buf) != 1) { - err.code = EINVAL; - err.desc = file; - fclose(f); - return glite_jp_stack_error(ctx,&err); - } - - ctx->trusted_peers = realloc(ctx->trusted_peers, (cnt+2) * sizeof *ctx->trusted_peers); - ctx->trusted_peers[cnt++] = strdup(buf); - ctx->trusted_peers[cnt] = NULL; - } - fclose(f); - return 0; -} - diff --git a/org.glite.jp.primary/src/authz.h b/org.glite.jp.primary/src/authz.h deleted file mode 100644 index dae14b2..0000000 --- a/org.glite.jp.primary/src/authz.h +++ /dev/null @@ -1,35 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/** - * Check authorisation of JPPS operation on job. - * - * \param[in] ctx JP context including peer name & other credentials (VOMS etc.) - * \param[in] op operation, one of SOAP_TYPE___jpsrv__* - * \param[in] job jobid of the job to decide upon - * \param[in] owner current known owner of the job (may be NULL), shortcut to avoid - * unnecessary database query. - * - * \retval 0 OK, operation permitted - * \retval EPERM denied - * \retval other error - */ - -int glite_jpps_authz(glite_jp_context_t ctx,int op,const char *job,const char *owner); - -int glite_jpps_readauth(glite_jp_context_t ctx,const char *file); - diff --git a/org.glite.jp.primary/src/backend.h b/org.glite.jp.primary/src/backend.h deleted file mode 100644 index 96b3ace..0000000 --- a/org.glite.jp.primary/src/backend.h +++ /dev/null @@ -1,180 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_BACKEND_H -#define GLITE_JP_BACKEND_H - -#include -#include -#include - -#include "feed.h" - -int glite_jppsbe_init( - glite_jp_context_t ctx, - int argc, - char *argv[] -); - -int glite_jppsbe_init_slave( - glite_jp_context_t ctx -); - -int glite_jppsbe_register_job( - glite_jp_context_t ctx, - const char *job, - const char *owner -); - -int glite_jppsbe_start_upload( - glite_jp_context_t ctx, - const char *job, - const char *class, /* must be filesystem-friendly */ - const char *name, /* optional name within the class */ - const char *content_type, - char **destination_out, - time_t *commit_before_inout -); - -int glite_jppsbe_commit_upload( - glite_jp_context_t ctx, - const char *destination -); - -int glite_jppsbe_get_names( - glite_jp_context_t ctx, - const char *job, - const char *class, - char ***names_out -); - -int glite_jppsbe_destination_info( - glite_jp_context_t ctx, - const char *destination, - char **job_out, - char **class_out, - char **name_out -); - -int glite_jppsbe_get_job_url( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name, /* optional within class */ - char **url_out -); - -int glite_jppsbe_open_file( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name, /* optional within class */ - int mode, - void **handle_out -); - -int glite_jppsbe_close_file( - glite_jp_context_t ctx, - void *handle -); - -int glite_jppsbe_file_attrs( - glite_jp_context_t ctx, - void *handle, - struct stat *buf -); - -int glite_jppsbe_pread( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset, - ssize_t *nbytes_ret -); - -int glite_jppsbe_pwrite( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset -); - -int glite_jppsbe_append( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes -); - -int glite_jppsbe_is_metadata( - glite_jp_context_t ctx, - const char *attr -); - -int glite_jppsbe_get_job_metadata( - glite_jp_context_t ctx, - const char *job, - glite_jp_attrval_t attrs_inout[] -); - -int glite_jppsbe_query( - glite_jp_context_t ctx, - const glite_jp_query_rec_t query[], - char *attrs[], - void *arg, - int (*callback)( - glite_jp_context_t ctx, - const char *job, - const glite_jp_attrval_t metadata[], - void *arg - ) -); - -/** mark the job as sent to this feed */ -int glite_jppsbe_set_fed( - glite_jp_context_t ctx, - const char *feed, - const char *job -); - -/** check whether the job has been already sent to this feed */ -int glite_jppsbe_check_fed( - glite_jp_context_t ctx, - const char *feed, - const char *job, - int *result -); - -/** store the feed to database */ -int glite_jppsbe_store_feed( - glite_jp_context_t ctx, - struct jpfeed *feed -); - -/** purge expired feeds */ -int glite_jppsbe_purge_feeds( - glite_jp_context_t ctx -); - -/** read stored feed into context */ -int glite_jppsbe_read_feeds( - glite_jp_context_t ctx -); - -#endif /* GLITE_JP_BACKEND_H */ diff --git a/org.glite.jp.primary/src/backend_private.h b/org.glite.jp.primary/src/backend_private.h deleted file mode 100644 index ceed681..0000000 --- a/org.glite.jp.primary/src/backend_private.h +++ /dev/null @@ -1,93 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_BACKEND_PRIVATE_H -#define GLITE_JP_BACKEND_PRIVATE_H - -#include -#include -#include - -#include "feed.h" - -#include "glite/jp/backend.h" - -int glite_jppsbe_init( - glite_jp_context_t ctx, - int argc, - char *argv[] -); - -int glite_jppsbe_init_slave( - glite_jp_context_t ctx -); - -int glite_jppsbe_register_job( - glite_jp_context_t ctx, - const char *job, - const char *owner -); - -int glite_jppsbe_start_upload( - glite_jp_context_t ctx, - const char *job, - const char *class, /* must be filesystem-friendly */ - const char *name, /* optional name within the class */ - const char *content_type, - char **destination_out, - time_t *commit_before_inout -); - -int glite_jppsbe_commit_upload( - glite_jp_context_t ctx, - const char *destination -); - -int glite_jppsbe_append_tags(void *fpctx, char *jobid, glite_jp_attrval_t *attr); - -/** mark the job as sent to this feed */ -int glite_jppsbe_set_fed( - glite_jp_context_t ctx, - const char *feed, - const char *job -); - -/** check whether the job has been already sent to this feed */ -int glite_jppsbe_check_fed( - glite_jp_context_t ctx, - const char *feed, - const char *job, - int *result -); - -/** store the feed to database */ -int glite_jppsbe_store_feed( - glite_jp_context_t ctx, - struct jpfeed *feed -); - -/** purge expired feeds */ -int glite_jppsbe_purge_feeds( - glite_jp_context_t ctx -); - -/** read stored feed into context */ -int glite_jppsbe_read_feeds( - glite_jp_context_t ctx -); - -#endif /* GLITE_JP_BACKEND_PRIVATE_H */ diff --git a/org.glite.jp.primary/src/bones_server.c b/org.glite.jp.primary/src/bones_server.c deleted file mode 100644 index 3f27989..0000000 --- a/org.glite.jp.primary/src/bones_server.c +++ /dev/null @@ -1,436 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/file_plugin.h" - -#include "glite/lbu/srvbones.h" -#include "glite/security/glite_gss.h" - -#include -#include "glite/security/glite_gsplugin.h" - -#include "feed.h" -#include "backend_private.h" - -#include "soap_version.h" -#include "jpps_H.h" - -#define CONN_QUEUE 20 - -extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[]; - -static int newconn(int,struct timeval *,void *); -static int request(int,struct timeval *,void *); -static int reject(int); -static int disconn(int,struct timeval *,void *); -static int data_init(void **data); - -static struct glite_srvbones_service stab = { - "JP Primary Storage", -1, newconn, request, reject, disconn -}; - -static time_t cert_mtime; -char *server_cert, *server_key, *cadir; -char file_prefix[PATH_MAX] = "/var/glite/log/dglogd.log"; -char *il_sock = NULL; -edg_wll_GssCred mycred = NULL; -static char *mysubj; - -static char *port = "8901"; -static int debug = 0; - -static glite_jp_context_t ctx; - -static int call_opts(glite_jp_context_t,char *,char *,int (*)(glite_jp_context_t,int,char **)); - -const char *glite_jp_default_namespace; - -pid_t master; - -int main(int argc, char *argv[]) -{ - int one = 1,opt,i; - edg_wll_GssStatus gss_code; - struct sockaddr_in a; - char *b_argv[20] = { "backend" },*p_argv[20] = { "plugins" },*com; - int b_argc,p_argc; - char buf[1000]; - int slaves = 10; - char *logfile = "/dev/null"; - char pidfile[PATH_MAX] = "/var/run/glite-jp-primarystoraged.pid"; - FILE *fpid; - - glite_jp_init_context(&ctx); - edg_wll_gss_gethostname(buf,sizeof buf); - buf[999] = 0; - ctx->myURL = buf; - - if (geteuid()) snprintf(pidfile,sizeof pidfile,"%s/glite-jp-primarystoraged.pid",getenv("HOME")); - - b_argc = p_argc = 1; - - while ((opt = getopt(argc,argv,"B:P:a:p:s:dl:i:c:k:nf:w:")) != EOF) switch (opt) { - case 'B': - assert(b_argc < 20); - if (com = strchr(optarg,',')) *com = 0; - - /* XXX: memleak -- who cares for once */ - asprintf(&b_argv[b_argc++],"-%s",optarg); - if (com) b_argv[b_argc++] = com+1; - - break; - case 'P': - assert(p_argc < 20); - p_argv[p_argc++] = optarg; - - break; - case 'a': - if (glite_jpps_readauth(ctx,optarg)) { - fprintf(stderr,"%s: %s\n",argv[0],glite_jp_error_chain(ctx)); - exit (1); - } - break; - case 'p': - port = optarg; - break; - case 'd': debug = 1; break; - case 's': slaves = atoi(optarg); - if (slaves <= 0) { - fprintf(stderr,"%s: -s %s: invalid number\n",argv[0],optarg); - exit(1); - } - break; - case 'l': logfile = optarg; break; - case 'i': strncpy(pidfile,optarg,PATH_MAX); pidfile[PATH_MAX-1] = 0; break; - case 'c': server_cert = optarg; break; - case 'k': server_key = optarg; break; - case 'n': ctx->noauth = 1; break; - case 'f': strncpy(file_prefix, optarg, PATH_MAX); file_prefix[PATH_MAX-1] = 0; break; - case 'w': il_sock = strdup(optarg); break; - case '?': fprintf(stderr,"usage: %s: -Bb,val ... -Pplugin.so ...\n" - "b is backend option\n",argv[0]); - exit (1); - } - - if (b_argc == 1) { - fputs("-B required\n",stderr); - exit (1); - } - - optind = 0; /* XXX: getopt used internally */ - if (glite_jppsbe_init(ctx,b_argc,b_argv)) { - fputs(glite_jp_error_chain(ctx), stderr); - exit(1); - } - - optind = 0; /* XXX: getopt used internally */ - if (b_argc > 1 && glite_jpps_fplug_load(ctx,p_argc,p_argv)) { - fputs(glite_jp_error_chain(ctx), stderr); - exit(1); - } - - srand48(time(NULL)); /* feed id generation */ - -#if GSOAP_VERSION <= 20602 - for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"ns1"); i++); -#else - for (i=0; jpps__namespaces[i].id && strcmp(jpps__namespaces[i].id,"jpsrv"); i++); -#endif - assert(jpps__namespaces[i].id); - glite_jp_default_namespace = jpps__namespaces[i].ns; - - stab.conn = socket(PF_INET, SOCK_STREAM, 0); - if (stab.conn < 0) { - perror("socket"); - return 1; - } - - setsockopt(stab.conn,SOL_SOCKET, SO_REUSEADDR, &one, sizeof(one)); - - a.sin_family = AF_INET; - a.sin_addr.s_addr = INADDR_ANY; - a.sin_port = htons(atoi(port)); - if (bind(stab.conn,(struct sockaddr *) &a, sizeof(a)) ) { - char buf[200]; - - snprintf(buf,sizeof(buf),"bind(%d)",atoi(port)); - perror(buf); - return 1; - } - - if (listen(stab.conn,CONN_QUEUE)) { - perror("listen()"); - return 1; - } - - if (!server_cert || !server_key) - fprintf(stderr, "%s: WARNING: key or certificate file not specified, " - "can't watch them for changes\n", - argv[0]); - - if ( cadir ) setenv("X509_CERT_DIR", cadir, 1); - edg_wll_gss_watch_creds(server_cert, &cert_mtime); - - if ( !edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &mycred, &gss_code)) { - mysubj = strdup(mycred->name); - fprintf(stderr,"Server idenity: %s\n",mysubj); - } - else fputs("WARNING: Running unauthenticated\n",stderr); - - /* XXX: daemonise */ - - if (!debug) { - int lfd = open(logfile,O_CREAT|O_TRUNC|O_WRONLY,0600); - if (lfd < 0) { - fprintf(stderr,"%s: %s: %s\n",argv[0],logfile,strerror(errno)); - exit(1); - } - daemon(0,1); - dup2(lfd,1); - dup2(lfd,2); - } - - setpgrp(); /* needs for signalling */ - master = getpid(); - fpid = fopen(pidfile,"r"); - if ( fpid ) - { - int opid = -1; - - if ( fscanf(fpid,"%d",&opid) == 1 ) - { - if ( !kill(opid,0) ) - { - fprintf(stderr,"%s: another instance running, pid = %d\n",argv[0],opid); - return 1; - } - else if (errno != ESRCH) { perror("kill()"); return 1; } - } - fclose(fpid); - } else if (errno != ENOENT) { perror(pidfile); return 1; } - - fpid = fopen(pidfile, "w"); - if (!fpid) { perror(pidfile); return 1; } - fprintf(fpid, "%d", getpid()); - fclose(fpid); - - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT,slaves); - glite_srvbones_run(data_init,&stab,1 /* XXX: entries in stab */,debug); - - return 0; -} - -static int data_init(void **data) -{ - *data = (void *) soap_new(); - - printf("[%d] slave started\n",getpid()); - glite_jpps_srv_init(ctx); - glite_jppsbe_init_slave(ctx); /* XXX: global but slave's */ - //sleep(10); - if (glite_jppsbe_purge_feeds(ctx) || /* XXX: is there a better place for the call? */ - glite_jppsbe_read_feeds(ctx)) fputs(glite_jp_error_chain(ctx),stderr); - printf("[%d] slave init done\n",getpid()); - - return 0; -} - -static int newconn(int conn,struct timeval *to,void *data) -{ - struct soap *soap = (struct soap *) data; - glite_gsplugin_Context plugin_ctx; - - edg_wll_GssCred newcred = NULL; - edg_wll_GssStatus gss_code; - edg_wll_GssPrincipal client = NULL; - edg_wll_GssConnection connection; - - int ret = 0; - - soap_init2(soap,SOAP_IO_KEEPALIVE,SOAP_IO_KEEPALIVE); - soap_set_omode(soap, SOAP_IO_BUFFER); // set buffered response - // buffer set to SOAP_BUFLEN (default = 8k) - - soap_set_namespaces(soap,jpps__namespaces); - soap->user = (void *) ctx; /* XXX: one instance per slave */ - - switch (edg_wll_gss_watch_creds(server_cert,&cert_mtime)) { - case 0: break; - case 1: if (!edg_wll_gss_acquire_cred_gsi(server_cert,server_key, - &newcred,&gss_code)) - { - - printf("[%d] reloading credentials\n",getpid()); /* XXX: log */ - edg_wll_gss_release_cred(&mycred, NULL); - mycred = newcred; - - /* drop it too, it is recreated and reloads creds when necessary */ - if (ctx->other_soap) { - soap_end(ctx->other_soap); - soap_free(ctx->other_soap); - ctx->other_soap = NULL; - } - } - break; - case -1: - printf("[%d] edg_wll_gss_watch_creds failed\n", getpid()); /* XXX: log */ - break; - } - - /* TODO: DNS paranoia etc. */ - - if (edg_wll_gss_accept(mycred,conn,to,&connection,&gss_code)) { - char *et; - - edg_wll_gss_get_error(&gss_code,"",&et); - - fprintf(stderr,"[%d] GSS connection accept failed: %s\nClosing connection.\n",getpid(),et); - free(et); - ret = 1; - goto cleanup; - } - - ret = edg_wll_gss_get_client_conn(&connection, &client, NULL); - - if (ctx->peer) free(ctx->peer); - if (ret || client->flags & EDG_WLL_GSS_FLAG_ANON) { - printf("[%d] annonymous client\n",getpid()); - ctx->peer = NULL; - } - else { - printf("[%d] client DN: %s\n",getpid(),client->name); /* XXX: log */ - - ctx->peer = strdup(client->name); - edg_wll_gss_free_princ(client); - } - - glite_gsplugin_init_context(&plugin_ctx); - glite_gsplugin_set_connection(plugin_ctx, &connection); - soap_register_plugin_arg(soap,glite_gsplugin,plugin_ctx); - - return 0; - -cleanup: - soap_end(soap); - - return ret; -} - -static int request(int conn,struct timeval *to,void *data) -{ - struct soap *soap = data; - glite_jp_context_t ctx = soap->user; - - glite_gsplugin_set_timeout(glite_gsplugin_get_context(soap),to); - - soap->max_keep_alive = 1; /* XXX: prevent gsoap to close connection */ - soap_begin(soap); - if (soap_begin_recv(soap)) { - if (soap->error < SOAP_STOP) { - soap_send_fault(soap); - return EIO; - } - return ENOTCONN; - } - - soap->keep_alive = 1; - if (soap_envelope_begin_in(soap) - || soap_recv_header(soap) - || soap_body_begin_in(soap) - || jpps__serve_request(soap) -#if GSOAP_VERSION >= 20700 - || (soap->fserveloop && soap->fserveloop(soap)) -#endif - ) - { - soap_send_fault(soap); // sets soap->keep_alive back to 0 :( - // and closes connection - if (ctx->error) { - /* XXX: shall we die on some errors? */ - int err = ctx->error->code; - glite_jp_clear_error(ctx); - return err; - } - return ECANCELED; // let srv_bones know something is wrong - } -//printf("Ja cekam %d\n", getpid()); -//sleep(10); - if (glite_jp_run_deferred(ctx)) { - char *e; - fprintf(stderr,"[%d] %s\n",getpid(),e = glite_jp_error_chain(ctx)); - free(e); - } - return 0; -} - -static int reject(int conn) -{ - int flags = fcntl(conn, F_GETFL, 0); - - fcntl(conn,F_SETFL,flags | O_NONBLOCK); - edg_wll_gss_reject(conn); - - return 0; -} - -static int disconn(int conn,struct timeval *to,void *data) -{ - struct soap *soap = (struct soap *) data; - glite_jp_context_t ctx = soap->user; - - soap_end(soap); // clean up everything and close socket - if (ctx->other_soap) { - soap_end(ctx->other_soap); - soap_free(ctx->other_soap); - ctx->other_soap = NULL; - } - - return 0; -} - -#define WSPACE "\t\n " - -static int call_opts(glite_jp_context_t ctx,char *opt,char *name,int (*f)(glite_jp_context_t,int,char **)) -{ - int ac = 1,ret,my_optind; - char **av = malloc(sizeof *av),*ap; - - *av = name; - for (ap = strtok(opt,WSPACE); ap; ap = strtok(NULL,WSPACE)) { - av = realloc(av,(ac+1) * sizeof *av); - av[ac++] = ap; - } - - my_optind = optind; - optind = 0; - ret = f(ctx,ac,av); - optind = my_optind; - free(av); - return ret; -} - - -/* XXX: we don't use it */ -SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} }; diff --git a/org.glite.jp.primary/src/classad_plugin.c b/org.glite.jp.primary/src/classad_plugin.c deleted file mode 100644 index 573f1a7..0000000 --- a/org.glite.jp.primary/src/classad_plugin.c +++ /dev/null @@ -1,232 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* -#include "glite/lb/context.h" -#include "glite/lb/jobstat.h" -#include "glite/lb/events.h" -#include "glite/lb/events_parse.h" -#include "glite/lb/trio.h" -*/ -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/attr.h" -#include "glite/jp/known_attr.h" - -#include "glite/jp/file_plugin.h" -#include "glite/jp/backend.h" -#include "glite/jp/builtin_plugins.h" - -//#define INITIAL_NUMBER_EVENTS 100 -//#define INITIAL_NUMBER_STATES EDG_WLL_NUMBER_OF_STATCODES -//#define LB_PLUGIN_NAMESPACE "urn:org.glite.lb" - -//extern int processEvent(intJobStat *, edg_wll_Event *, int, int, char **); - - -typedef struct _classad_handle{ - char* data; - struct cclassad* ad; - time_t timestamp; -} classad_handle; - -static int classad_query(void *fpctx, void *handle, const char *attr, glite_jp_attrval_t **attrval); -static int classad_open(void *fpctx, void *bhandle, const char *uri, void **handle); -static int classad_open_str(void *fpctx, const char *str, const char *uri, const char *ns, void **handle); -static int classad_close(void *fpctx, void *handle); -static int classad_filecom(void *fpctx, void *handle); - -int init(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data) { - data->fpctx = ctx; - - data->uris = calloc(2,sizeof *data->uris); - data->uris[0] = strdup(GLITE_JP_FILETYPE_CLASSAD); - - data->classes = calloc(2,sizeof *data->classes); - data->classes[0] = strdup("classad"); - - data->namespaces = calloc(2, sizeof *data->namespaces); - data->namespaces[0] = strdup(GLITE_JP_JDL_NS); - - data->ops.open = classad_open; - data->ops.close = classad_close; - data->ops.attr = classad_query; - data->ops.open_str = classad_open_str; - data->ops.filecom = classad_filecom; - -#ifdef PLUGIN_DEBUG - fprintf(stderr,"classad_plugin: init OK\n"); -#endif - - return 0; -} - - -void done(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data) { - free(data->uris[0]); - free(data->classes[0]); - free(data->uris); - free(data->classes); - memset(data, 0, sizeof(*data)); -} - - -static int classad_open(void *fpctx, void *bhandle, const char *uri, void **handle) { - glite_jp_context_t ctx = (glite_jp_context_t) fpctx; - glite_jp_error_t err; - classad_handle* h; - void* fh; - int retval = 0; - - glite_jp_clear_error(ctx); - h = calloc(1, sizeof(classad_handle)); - h->data = NULL; - struct stat fattr; - glite_jppsbe_file_attrs(ctx, bhandle, &fattr); - h->timestamp = fattr.st_mtime; - - // read the classad file - char buf[1024]; - size_t nbytes; - off_t offset = 0; - - do{ - if (! (retval = glite_jppsbe_pread(ctx, bhandle, buf, sizeof buf, offset, &nbytes))){ - h->data = realloc(h->data, offset + nbytes); - memcpy(h->data + offset, buf, nbytes); - offset += nbytes; - } - else - goto fail; - }while(nbytes); - - h->ad = cclassad_create(h->data); - -#ifdef PLUGIN_DEBUG - fprintf(stderr,"classad_plugin: opened\n"); -#endif - - *handle = h; - - return 0; - -fail: - err.code = EIO; - err.desc = NULL; - err.source = __FUNCTION__; - glite_jp_stack_error(ctx,&err); - - return retval; -} - -static int classad_open_str(void *fpctx,const char *str,const char *uri,const char *ns,void **handle){ - classad_handle* h; - - h = calloc(1, sizeof(classad_handle)); - h->data = strdup(str); - h->ad = cclassad_create(h->data); - h->timestamp = 0; - -#ifdef PLUGIN_DEBUG - fprintf(stderr,"classad_plugin: opened\n"); -#endif - - *handle = h; - - return 0; - -} - -static int classad_close(void *fpctx,void *handle) { - classad_handle *h = (classad_handle *) handle; - - cclassad_delete(h->ad); - free(h->data); - free(h); - -#ifdef PLUGIN_DEBUG - fprintf(stderr,"classad plugin: close OK\n"); -#endif - return 0; -} - - -static int classad_query(void *fpctx,void *handle, const char *attr,glite_jp_attrval_t **attrval) { - glite_jp_context_t ctx = (glite_jp_context_t) fpctx; - glite_jp_error_t err; - glite_jp_attrval_t *av = NULL; - classad_handle* h = (classad_handle*)handle; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - char *str = NULL; - - if (! h->ad){ - err.code = ENOENT; - err.desc = strdup("Classad plugin: No classad string, cannot get attr!"); - *attrval = NULL; - printf("Exiting classat_query...\n"); - return glite_jp_stack_error(ctx,&err); - } - - if (!cclassad_evaluate_to_string(h->ad, strrchr(attr, ':')+1, &str) && - cclassad_evaluate_to_expr(h->ad, strrchr(attr, ':')+1, &str) && - !strcasecmp(str,"undefined")) { free(str); str = NULL; } - - if (str) { - //struct stat fattr; - /*XXX ignore error */ - //glite_jppsbe_file_attrs(ctx, h->bhandle, &fattr); - av = calloc(2, sizeof(glite_jp_attrval_t)); - av[0].name = strdup(attr); - av[0].value = str; str = NULL; - av[0].size = -1; - av[0].timestamp = h->timestamp; - av[0].origin = GLITE_JP_ATTR_ORIG_FILE; - } - else{ - printf("Classad plugin: bad attr!\n"); - } - - if (str) free(str); - - *attrval = av; - - if (av) - return 0; - else{ - err.code = ENOENT; - err.desc = attr; - return glite_jp_stack_error(ctx,&err); - } -} - -static int classad_filecom(void *fpctx, void *handle){ - return -1; -} - diff --git a/org.glite.jp.primary/src/feed.c b/org.glite.jp.primary/src/feed.c deleted file mode 100644 index f8b649f..0000000 --- a/org.glite.jp.primary/src/feed.c +++ /dev/null @@ -1,995 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glite/jobid/strmd5.h" -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/known_attr.h" -#include "glite/jp/file_plugin.h" -#include "glite/jp/builtin_plugins.h" - -#include "feed.h" -#include "is_client.h" -#include "backend_private.h" - -extern pid_t master; - -/* - * seconds before feed expires: should be - * XXX: should be configurable, default for real deployment sort of 1 hour - */ -#define FEED_TTL 360 - -/* XXX: configurable */ -#define BATCH_FEED_SIZE 200 - -static int check_qry_item( - glite_jp_context_t ctx, - const glite_jp_query_rec_t *qry, - const glite_jp_attrval_t *attr -) -{ - int cmp,cmp2; - long scmp,ucmp; - glite_jp_attrval_t qattr; - - if (strcmp(qry->attr,attr->name)) return 0; - - if (qry->origin != GLITE_JP_ATTR_ORIG_ANY && qry->origin != attr->origin) return 0; - - memset(&qattr,0,sizeof qattr); - qattr.name = qry->attr; - qattr.value = qry->value; - qattr.binary = qry->binary; - qattr.size = qry->size; - qattr.origin = qry->origin; - - /* XXX: don't assert */ - assert(glite_jp_attrval_cmp(ctx,attr,&qattr,&cmp) == 0); - - switch (qry->op) { - case GLITE_JP_QUERYOP_EQUAL: return !cmp; - case GLITE_JP_QUERYOP_UNEQUAL: return cmp; - case GLITE_JP_QUERYOP_LESS: return cmp < 0; - case GLITE_JP_QUERYOP_GREATER: return cmp > 0; - - case GLITE_JP_QUERYOP_WITHIN: - qattr.value = qry->value2; - qattr.size = qry->size2; - /* XXX: assert */ - assert(glite_jp_attrval_cmp(ctx,attr,&qattr,&cmp2) == 0); - return cmp >= 0 && cmp2 <= 0; - } -} - -/* retrieve all attributes for a feed */ -int full_feed( - glite_jp_context_t ctx, - const struct jpfeed *feed, - const char *job, - glite_jp_attrval_t **attrs) -{ - int i,ret,no_owner = 1; - char **ma = NULL; - - for (i=0; feed->attrs[i]; i++) - if (!strcmp(feed->attrs[i],GLITE_JP_ATTR_OWNER)) no_owner = 0; - - if (no_owner) { - ma = malloc((i+2) * sizeof *ma); - ma[0] = GLITE_JP_ATTR_OWNER; - memcpy(ma+1,feed->attrs,(i+1) * sizeof *ma); - } - ret = glite_jpps_get_attrs(ctx,job, - no_owner ? ma : feed->attrs, - i+no_owner,attrs); - free(ma); - return ret; -} - -/* XXX: limit on query size -- I'm lazy to malloc() */ -#define QUERY_MAX 100 - -static int is_feed_matching( - glite_jp_context_t ctx, - const struct jpfeed *feed, - const char *job, - -/* XXX: not checked for correctness, - assuming single occurence only */ - const glite_jp_attrval_t attrs[] -) -{ - int i,fed,ret = 0; - int qi[QUERY_MAX]; - char *owner = NULL; - glite_jp_attrval_t *attr_out = NULL; - glite_jp_attrval_t *newattr = NULL; - - glite_jp_clear_error(ctx); - - if (feed->qry) { - int j,complete = 1; - - memset(qi,0,sizeof qi); - for (i=0; feed->qry[i].attr; i++) { - int sat = 0; - assert(iqry[i].attr)) { - if (check_qry_item(ctx,feed->qry+i,attrs+j)) { - qi[i] = 1; - sat = 1; /* matched, needn't loop further */ - } - else return -1; /* can't be satisfied either */ - } - - if (!sat) complete = 0; - } - - /* not all attributes in query are known from input - * we have to retrieve job metadata from the backend - * - * XXX: It is not optimal to retrieve it here without sharing - * over multiple invocations of match_feed() for the same job. - */ - - if (!complete) { - char **attr = NULL; - - j=0; - for (i=0; feed->qry[i].attr; i++) if (!qi[i]) { - assert(jqry[i].attr; - j++; - } - - int err = glite_jpps_get_attrs(ctx, job, attr, j, &attr_out); - int k; - if (! err) for (k = 0; attr_out[k].name; k++); - if (!err && (k < j)){ - glite_jp_error_t err; - - memset(&err,0,sizeof err); - err.code = EIO; - err.source = __FUNCTION__; - err.desc = "complete query"; - ret = glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - for (i=0; feed->qry[i].attr; i++) { - for (j = 0; j < k; j++) - if (strcmp(feed->qry[i].attr, attr_out[j].name) == 0){ - if (!check_qry_item(ctx, feed->qry+i, attr_out+j)) { - ret = -1; - goto cleanup; - } - if (!strcmp(attr_out[i].name,GLITE_JP_ATTR_OWNER)) owner = attr_out[i].value; - break; - } - } - } - } - -cleanup: - if (attr_out){ - //for (i = 0; attr_out[i].name; i++) - // glite_jp_attrval_free(&(attr_out[i])); - free(attr_out); - } - return ret; -} - -static int match_feed( - glite_jp_context_t ctx, - const struct jpfeed *feed, - const char *job, - -/* XXX: not checked for correctness, - assuming single occurence only */ - const glite_jp_attrval_t attrs[] -) -{ - if (is_feed_matching(ctx, feed, job, attrs)) - return 0; - - glite_jp_attrval_t meta[QUERY_MAX+1]; - char *owner = NULL; - int fed, i; - - glite_jppsbe_check_fed(ctx,feed->id,job,&fed); - if (!fed) { - glite_jp_attrval_t *a; - full_feed(ctx,feed,job,&a); - for (i=0; a[i].name && strcmp(a[i].name,GLITE_JP_ATTR_OWNER); i++); - owner = a[i].value; - - /* XXX: better error handling ? */ - if (!glite_jpps_single_feed(ctx,feed->id,0,feed->destination,job,owner,a)) - glite_jppsbe_set_fed(ctx,feed->id,job); /* XXX: on error? */ - - for (i=0; a[i].name; i++) glite_jp_attrval_free(a+i,0); - free(a); - } - else { - int mf = 0; - if (!owner) { - mf = 1; - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - glite_jppsbe_get_job_metadata(ctx,job,meta); - owner = meta[0].value; - } - glite_jpps_single_feed(ctx,feed->id,0,feed->destination,job,owner,attrs); - if (mf) - for (i=0; meta[i].name; i++) glite_jp_attrval_free(meta+i,0); - } - - return 0; -} - -static int match_feed_multi( - glite_jp_context_t ctx, - const struct jpfeed *feed, - const char **jobs, - const glite_jp_attrval_t **attrs -) -{ - glite_jp_attrval_t meta[QUERY_MAX+1]; - char **owners = NULL; - int *fed = NULL; - glite_jp_attrval_t **attrs_to_feed = NULL; - char **jobs_to_feed = NULL; - int i, k; - int j = 0; - - for (i = 0; jobs[i]; i++){ - if (! is_feed_matching(ctx, feed, jobs[i], attrs[i])){ - owners = realloc(owners, (j+1)*sizeof(*owners)); - attrs_to_feed = realloc(attrs_to_feed, (j+1)*sizeof(attrs_to_feed)); - jobs_to_feed = realloc(jobs_to_feed, (j+1)*sizeof(jobs_to_feed)); - fed = realloc(fed, (j+1)*sizeof(*fed)); - attrs_to_feed[j] = attrs[i]; - jobs_to_feed[j] = jobs[i]; - glite_jppsbe_check_fed(ctx,feed->id,jobs[i],&fed[j]); - if (!fed){ - glite_jp_attrval_t *a; - full_feed(ctx,feed,jobs[i],&a); - int k; - for (k=0; a[k].name && strcmp(a[k].name,GLITE_JP_ATTR_OWNER); k++); - owners[j] = strdup(a[k].value); - for (k=0; a[k].name; k++) glite_jp_attrval_free(a+k, 0); - free(a); - } - else{ - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - glite_jppsbe_get_job_metadata(ctx,jobs[i],meta); - owners[j] = strdup(meta[0].value); - for (k = 0; meta[k].name; k++) glite_jp_attrval_free(meta+k,0); - } - j++; - } - } - - if (! glite_jpps_multi_feed(ctx, feed->id, 0, j, - feed->destination, jobs_to_feed, owners, attrs_to_feed)) - for (i = 0; i < j; i++) - if (fed[i]) - glite_jppsbe_set_fed(ctx,feed->id,jobs_to_feed[i]); - - for (i = 0; i < j; i++){ - free(owners[i]); - //free(jobs_to_feed[i]); - //glite_jp_attrval_free(attrs_to_feed[i],0); - } - free(jobs_to_feed); - free(owners); - free(attrs_to_feed); - free(fed); - - return 0; -} - -/* TODO: overit, ze do dalsich atributu se leze az kdyz matchuji metadata - * kdyby ne, stejne se to nepovede ; - * totez pro match_file */ - -typedef struct{ - char *job; - glite_jp_attrval_t *attrs; -} match_attr; - - -static int match_attr_deferred( - glite_jp_context_t ctx, - void *ma -) -{ - char *job = ((match_attr*)ma)->job; - glite_jp_attrval_t *attrs = ((match_attr*)ma)->attrs; - - struct jpfeed *f = (struct jpfeed *) ctx->feeds; - int i,j,doit; - - for (;f; f = f->next) { - doit = 0; - - for (i=0; !doit && f->attrs[i]; i++) - for (j=0; !doit && attrs[j].name; j++) - if (!strcmp(f->attrs[i],attrs[j].name)) doit = 1; - - /* XXX: ignore any errors */ - if (doit) match_feed(ctx,f,job,attrs); - } - - free(((match_attr*)ma)->job); - //free(((match_attr*)ma)->attrs); - - return glite_jp_clear_error(ctx); -} - -int glite_jpps_match_attr( - glite_jp_context_t ctx, - const char *job, - const glite_jp_attrval_t attrs[] -) -{ - match_attr *ma = malloc(sizeof *ma); - ma->job = strdup(job); - ma->attrs = malloc(sizeof(*ma->attrs)); - ma->attrs[0].name = NULL; - int i; - for (i = 0; attrs[i].name; i++){ - ma->attrs = realloc(ma->attrs, (i+2)*sizeof(*ma->attrs)); - - memcpy(&(ma->attrs[i]), &(attrs[i]), sizeof(*ma->attrs)); - ma->attrs[i].name = strdup(attrs[i].name); - ma->attrs[i].value = strdup(attrs[i].value); - - ma->attrs[i+1].name = NULL; - } - glite_jp_add_deferred(ctx, match_attr_deferred, ma); -} - -typedef struct{ - char **jobs; - glite_jp_attrval_t **attrs; -} match_attr_multi; - -static int match_attr_multi_deferred( - glite_jp_context_t ctx, - void *m -) -{ - match_attr_multi *mam = (match_attr_multi*)m; - struct jpfeed *f = (struct jpfeed *) ctx->feeds; - int i, j, k, doit; - - for (;f; f = f->next) { - doit = 0; - for (i = 0; !doit && f->attrs[i]; i++) - for (j = 0; !doit && mam->attrs[j]; j++) - for (k = 0; !doit && mam->attrs[j][k].name; k++) - if (!strcmp(f->attrs[i],mam->attrs[j][k].name)) doit = 1; - - if (doit) match_feed_multi(ctx, f, mam->jobs, mam->attrs); - } - - for (i=0; mam->jobs[i]; i++){ - free(mam->jobs[i]); - if (mam->attrs[i]) - for (j = 0; mam->attrs[i][j].name; j++) - glite_jp_attrval_free(&(mam->attrs[i][j]), 0); - free(mam->attrs[i]); - } - free(mam->jobs); - free(mam->attrs); - - return 0; -} - -int glite_jpps_match_attr_multi( - glite_jp_context_t ctx, - const char **jobs, - const glite_jp_attrval_t **attrs -) -{ - int i, j; - - match_attr_multi *mam = malloc(sizeof *mam); - mam->jobs = NULL; - mam->attrs = NULL; - for (i = 0; jobs[i]; i++) { - mam->jobs = realloc(mam->jobs, (i+2)*sizeof(*mam->jobs)); - mam->jobs[i] = strdup(jobs[i]); - mam->attrs = realloc(mam->attrs, (i+2)*sizeof(*mam->attrs)); - mam->attrs[i] = calloc(0, sizeof(**mam->attrs)); - for (j = 0; attrs[i][j].name; j++){ - mam->attrs[i] = realloc(mam->attrs[i], (j+2)*sizeof(**mam->attrs)); - memcpy(&(mam->attrs[i][j]), &(attrs[i][j]), sizeof(**mam->attrs)); - mam->attrs[i][j].name = strdup(attrs[i][j].name); - mam->attrs[i][j].value = strdup(attrs[i][j].value); - mam->attrs[i][j].origin_detail = NULL;//strdup(attrs[i][j].origin_detail); - } - mam->attrs[i][j].name = NULL; - } - mam->jobs[i] = NULL; - mam->attrs[i] = NULL; - - glite_jp_add_deferred(ctx, match_attr_multi_deferred, mam); - - return 0; - -/* TODO - int i,j; - - puts(__FUNCTION__); - for (i=0; jobs[i]; i++) { - printf("job %s\n",jobs[i]); - - for (j=0; attrs[i][j].name; j++) { - printf("\t%s = %s\n",attrs[i][j].name,attrs[i][j].value); - } - } - - return 0;*/ -} - -static int attr_void_cmp(const void *a, const void *b) -{ - char const * const *ca = (char const * const *) a; - char const * const *cb = (char const * const *) b; - return strcmp(*ca,*cb); -} - -static void attr_union(char **a, char **b, char ***c) -{ - int ca = 0,cb = 0,cnt,i,j; - char **out; - - if (a) for (ca = 0; a[ca]; ca++); - if (b) for (cb = 0; b[cb]; cb++); - out = malloc((ca+cb+1) * sizeof *out); - if (a) memcpy(out,a,ca * sizeof *out); - if (b) memcpy(out+ca,b,cb * sizeof *out); - out[cnt = ca+cb] = NULL; - qsort(out,cnt,sizeof *out,attr_void_cmp); - - for (i=0; i i+1) memmove(out+i+1,out+j,(cnt-j) * sizeof *out); - cnt -= j-i-1; - } - assert(cnt); - out[cnt] = NULL; - - *c = out; -} - -typedef struct{ - char *job; - char *class; - char *name; -} match_file; - -int match_file_deferred( - glite_jp_context_t ctx, - void *mf -) -{ - char *job = ((match_file*)mf)->job; - char *class = ((match_file*)mf)->class; - char *name = ((match_file*)mf)->name; - - glite_jpps_fplug_data_t **pd = NULL; - int pi; - void *bh = NULL; - int ret; - struct jpfeed *f = ctx->feeds; - glite_jp_attrval_t meta[QUERY_MAX+1]; - - int nvals = 0,j,i; - char **attrs = NULL, **attrs2; - glite_jp_attrval_t *vals = NULL,*oneval; - - fprintf(stderr,"%s: %s %s %s\n",__FUNCTION__,job,class,name); - - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - glite_jppsbe_get_job_metadata(ctx,job,meta); - - if (!f) return 0; - - switch (glite_jpps_fplug_lookup_byclass(ctx,class,&pd)) { - case ENOENT: return 0; /* XXX: shall we complain? */ - case 0: break; - default: return -1; - } - - - for (;f;f=f->next) { - attr_union(attrs,f->attrs,&attrs2); - free(attrs); - attrs = attrs2; - } - - vals = malloc(sizeof *vals); - vals[0].name = NULL; - - for (pi=0; pd[pi]; pi++) { - int ci; - for (ci=0; pd[pi]->uris[ci]; ci++) if (!strcmp(pd[pi]->classes[ci],class)) { - void *ph; - - if (!bh && (ret = glite_jppsbe_open_file(ctx,job,pd[pi]->classes[ci],name,O_RDONLY,&bh))) { - free(pd); - return ret; - } - - if (pd[pi]->ops.open(pd[pi]->fpctx,bh,class,&ph)) { - /* XXX: complain more visibly */ - fputs("plugin open failed\n",stderr); - continue; - } - - for (i=0; attrs[i]; i++) - if (!pd[pi]->ops.attr(pd[pi]->fpctx,ph,attrs[i],&oneval)) { - /* XXX: ignore error */ - for (j=0; oneval[j].name; j++); - vals = realloc(vals,(nvals+j+1) * sizeof *vals); - memcpy(vals+nvals,oneval,(j+1) * sizeof *vals); - nvals += j; - free(oneval); - } - - pd[pi]->ops.close(pd[pi]->fpctx,ph); - } - } - - free(attrs); - - if (bh) glite_jppsbe_close_file(ctx,bh); - free(pd); - - for (f = ctx->feeds; f; f=f->next) { - int k,fed; - glite_jp_attrval_t * fattr; - - match_feed(ctx,f,job,vals); - -/* covered by match_feed() - glite_jppsbe_check_fed(ctx,f->id,job,&fed); - if (!fed) full_feed(ctx,f,job,&fattr); - else { - fattr = malloc((nvals+1) * sizeof *fattr); - - j = 0; - for (i=0; iattrs[k]; k++) - if (!strcmp(f->attrs[k],vals[i].name)) - memcpy(fattr+j++,vals+i,sizeof *fattr); - - memset(fattr+j,0,sizeof *fattr); - - } - for (i=0; meta[i].name && strcmp(meta[i].name,GLITE_JP_ATTR_OWNER); i++); - if (!glite_jpps_single_feed(ctx,f->id,0,f->destination,job,meta[i].value,fattr) && !fed) - glite_jppsbe_set_fed(ctx,f->id,job); - - if (!fed) for (i=0; fattr[i].name; i++) glite_jp_attrval_free(fattr+i,0); - free(fattr); -*/ - } - - for (i=0; vals[i].name; i++) glite_jp_attrval_free(vals+i,0); - free(vals); - - for (i=0; meta[i].name; i++) glite_jp_attrval_free(meta+i,0); - - free(((match_file*)mf)->job); - free(((match_file*)mf)->class); - free(((match_file*)mf)->name); - - return 0; -} - -int glite_jpps_match_file( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name -) -{ - match_file* mf = malloc(sizeof(*mf)); - mf->job = strdup(job); - mf->class = strdup(class); - if (name) - mf->name = strdup(name); - else - mf->name = NULL; - - glite_jp_add_deferred(ctx, match_file_deferred, mf); -} - -static char *generate_feedid(void) -{ - char hname[200],buf[1000]; - - gethostname(hname,sizeof hname); - snprintf(buf,sizeof buf,"%s%d%ld",hname,getpid(),lrand48()); - buf[sizeof buf-1] = 0; - return str2md5base64(buf); -} - -static struct jpfeed *make_jpfeed( - const char *destination, - char const *const *attrs, - const glite_jp_query_rec_t *qry, - char *id, - time_t expires) -{ - int i; - struct jpfeed *f = calloc(1,sizeof *f); - - f->id = id ? strdup(id) : NULL; - f->destination = strdup(destination); - f->expires = expires; - for (i=0; attrs[i]; i++) { - f->attrs = realloc(f->attrs,(i+2) * sizeof *f->attrs); - f->attrs[i] = strdup(attrs[i]); - f->attrs[i+1] = NULL; - } - for (i=0; qry[i].attr; i++) { - f->qry = realloc(f->qry,(i+2) * sizeof *f->qry); - glite_jp_queryrec_copy(f->qry+i,qry+i); - memset(f->qry+i+1,0,sizeof *f->qry); - } - - return f; -} - -void jpfeed_free(struct jpfeed *f) -{ - int i; - - assert(f->njobs == 0); /* XXX: we shouldn't do this */ - - free(f->id); - free(f->destination); - if (f->attrs) { - for (i=0; f->attrs[i]; i++) free(f->attrs[i]); - free(f->attrs); - } - for (i=0; inmeta_attr; i++) free(f->meta_attr[i]); - free(f->meta_attr); - for (i=0; inother_attr; i++) free(f->other_attr[i]); - free(f->other_attr); - - if (f->qry) { - for (i=0; f->qry[i].attr; i++) glite_jp_free_query_rec(f->qry+i); - free(f->qry); - } - - for (i=0; inmeta_qry; i++) glite_jp_free_query_rec(f->meta_qry+i); - free(f->meta_qry); - for (i=0; inother_qry; i++) glite_jp_free_query_rec(f->other_qry+i); - free(f->other_qry); - - /* XXX: no next */ - - free(f); -} - -static void drop_jobs(struct jpfeed *f) -{ - int i,j; - for (i=0; injobs; i++) { - for (j=0; f->job_attrs[i][j].name; j++) - glite_jp_attrval_free(&f->job_attrs[i][j],0); - free(f->job_attrs[i]); - free(f->jobs[i]); - free(f->owners[i]); - } - free(f->job_attrs); f->job_attrs = NULL; - free(f->jobs); f->jobs = NULL; - free(f->owners); f->owners = NULL; - f->njobs = 0; -} - -static int drain_feed(glite_jp_context_t ctx, struct jpfeed *f,int done) -{ - int ret = 0; - glite_jp_clear_error(ctx); - if (f->njobs) { - int i; - ret = glite_jpps_multi_feed(ctx,f->id,done,f->njobs,f->destination,f->jobs,f->owners,f->job_attrs); - - if (!ret && f->continuous) for (i=0; injobs; i++) glite_jppsbe_set_fed(ctx,f->id,f->jobs[i]); - drop_jobs(f); - } - return ret; -} - -static int feed_query_callback( - glite_jp_context_t ctx, - const char *job, - const glite_jp_attrval_t meta[], - void *arg) -{ - int i,j,nout = 0,ec; - glite_jp_error_t err; - struct jpfeed *f = arg; - glite_jp_attrval_t *other = NULL,*out = NULL; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - glite_jp_clear_error(ctx); - -/* retrieve other attributes */ - ec = glite_jpps_get_attrs(ctx,job,f->other_attr,f->nother_attr,&other); - switch (ec) { - case 0: break; - case ENOENT: glite_jp_clear_error(ctx); break; - default: - err.code = EIO; - err.desc = "retrieve job attributes"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - -/* filter on non-meta query items */ - if (f->nother_qry && !other) goto cleanup; /* unknown values can't match */ - - for (i=0; inother_qry; i++) { - for (j=0; other[j].name; j++) - if (check_qry_item(ctx,f->other_qry+i,other+j)) break; - if (!other[j].name) goto cleanup; /* no match is not an error */ - } - -/* extract attributes to be fed, stack the job for a batch feed */ - for (i=0; meta && meta[i].name; i++) - for (j=0; jnmeta_attr; j++) - if (!strcmp(meta[i].name,f->meta_attr[j])) { - out = realloc(out,(nout+2) * sizeof *out); - glite_jp_attrval_copy(out+nout,meta+i); - nout++; - } - - if (other) - for (i=0; other[i].name; i++) - for (j=0; jint_other_attr; j++) - if (!strcmp(other[i].name,f->other_attr[j])) { - out = realloc(out,(nout+2) * sizeof *out); - glite_jp_attrval_copy(out+nout,other+i); - nout++; - } - - if (nout) { - int oi; - - memset(out+nout,0,sizeof *out); - f->jobs = realloc(f->jobs,(f->njobs+1)*sizeof *f->jobs); - f->jobs[f->njobs] = strdup(job); - f->job_attrs = realloc(f->job_attrs,(f->njobs+1)*sizeof *f->job_attrs); - f->job_attrs[f->njobs] = out; - out = NULL; - - for (oi=0; strcmp(meta[oi].name,GLITE_JP_ATTR_OWNER); oi++); - assert(meta[oi].name); - f->owners = realloc(f->owners,(f->njobs+1)*sizeof *f->owners); - f->owners[f->njobs] = strdup(meta[oi].value); - - f->njobs++; - } - -/* run the feed eventually */ - if (f->njobs >= BATCH_FEED_SIZE && drain_feed(ctx,f,0)) { - err.code = EIO; - err.desc = "sending batch feed"; - glite_jp_stack_error(ctx,&err); - } - -cleanup: - for (i=0; other && other[i].name; i++) glite_jp_attrval_free(other+i,0); - free(other); - - return err.code; -} - - -static int run_feed_deferred(glite_jp_context_t ctx,void *feed) -{ - struct jpfeed *f = feed; - int i,m,o,cnt,ret = 0; - char **meta; - - glite_jp_clear_error(ctx); -/* count "meta" attributes */ - cnt = 0; - for (i=0; f->attrs[i]; i++) - if (glite_jppsbe_is_metadata(ctx,f->attrs[i])) cnt++; - - f->meta_attr = cnt ? malloc((cnt+1) * sizeof *f->meta_attr) : NULL; - f->nmeta_attr = cnt; - - f->other_attr = i-cnt ? malloc((i-cnt+1) * sizeof *f->other_attr) : NULL; - f->nother_attr = i-cnt; - -/* sort attributes to "meta" and others */ - m = o = 0; - for (i=0; f->attrs[i]; i++) - if (glite_jppsbe_is_metadata(ctx,f->attrs[i])) - if (!strcmp(f->attrs[i],GLITE_JP_ATTR_OWNER)) { - free(f->attrs[i]); - f->nmeta_attr--; - } - else f->meta_attr[m++] = f->attrs[i]; - else { - /* XXX: jobid and owner are sent anyway */ - if (!strcmp(f->attrs[i],GLITE_JP_ATTR_JOBID)) { - free(f->attrs[i]); - f->nother_attr--; - } - else f->other_attr[o++] = f->attrs[i]; - } - - if (f->nmeta_attr == 0) { free(f->meta_attr); f->meta_attr = NULL; } - if (f->nother_attr == 0) { free(f->other_attr); f->other_attr = NULL; } - - if (f->meta_attr) f->meta_attr[m] = NULL; - if (f->other_attr) f->other_attr[o] = NULL; - - -/* the same for query records */ - cnt = 0; - for (i=0; f->qry[i].attr; i++) - if (glite_jppsbe_is_metadata(ctx,f->qry[i].attr)) cnt++; - - f->meta_qry = cnt ? malloc((cnt+1) * sizeof *f->meta_qry) : NULL; - if (f->meta_qry) memset(f->meta_qry+cnt,0,sizeof *f->meta_qry); - f->nmeta_qry = cnt; - f->other_qry = i-cnt ? malloc((i-cnt+1) * sizeof *f->other_qry) : NULL; - f->nother_qry = i-cnt; - - m = o = 0; - for (i=0; f->qry[i].attr; i++) - if (glite_jppsbe_is_metadata(ctx,f->qry[i].attr)) memcpy(f->meta_qry+m++,f->qry+i,sizeof *f->meta_qry); - else memcpy(f->other_qry+o++,f->qry+i,sizeof *f->other_qry); - - free(f->attrs); free(f->qry); - f->attrs = NULL; - f->qry = NULL; - - if (f->meta_qry) memset(f->meta_qry+m,0,sizeof *f->meta_qry); - else { - glite_jp_error_t err; - err.code = EINVAL; - err.source = __FUNCTION__; - err.desc = "at least one metadata query item required"; - ret = glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - if (f->other_qry) memset(f->other_qry+o,0,sizeof *f->other_qry); - -/* extract other_qry items that are not present in other_attr */ - f->int_other_attr = o = f->nother_attr; - for (i=0; inother_qry; i++) { - int j; - for (j=0; jint_other_attr && strcmp(f->other_attr[j],f->other_qry[i].attr); j++); - if (j == f->int_other_attr) { - f->other_attr = realloc(f->other_attr,(o+2) * sizeof *f->other_attr); - f->other_attr[o++] = strdup(f->other_qry[i].attr); - } - } - if (f->other_attr) f->other_attr[o] = NULL; - f->nother_attr = o; - - meta = calloc(f->nmeta_attr+2,sizeof *meta); - meta[0] = GLITE_JP_ATTR_OWNER; - if (f->meta_attr) memcpy(meta+1,f->meta_attr,(f->nmeta_attr+1) * sizeof *meta); - else meta[1] = NULL; - - ret = glite_jppsbe_query(ctx,f->meta_qry,meta,f,feed_query_callback); - free(meta); - if (ret == 0) ret = drain_feed(ctx,f,1); - else if (ret == ENOENT) ret = 0; - else drop_jobs(f); - -cleanup: - - jpfeed_free(f); - return ret; -} - -int glite_jpps_run_feed( - glite_jp_context_t ctx, - const char *destination, - char const * const *attrs, - const glite_jp_query_rec_t *qry, - int continuous, - char **feed_id) -{ - struct jpfeed *f; - - fprintf(stderr,"%s: \n",__FUNCTION__); - if (!*feed_id) *feed_id = generate_feedid(); - - f = make_jpfeed(destination,attrs,qry,*feed_id,(time_t) 0); - f->continuous = continuous; - glite_jp_add_deferred(ctx,run_feed_deferred,f); - - return 0; -} - -static int register_feed_deferred(glite_jp_context_t ctx,void *feed) -{ - struct jpfeed *f = feed; - - if (glite_jppsbe_store_feed(ctx,f)) fputs(glite_jp_error_chain(ctx),stderr); - else{ - time(&(f->expires)); - f->expires += FEED_TTL; - glite_jppsbe_refresh_feed(ctx, f->id, f->expires); - kill(-master,SIGUSR1); /* gracefully terminate slaves - and let master restart them */ - } - - return 0; -} - - -int glite_jpps_register_feed( - glite_jp_context_t ctx, - const char *destination, - char const *const *attrs, - const glite_jp_query_rec_t *qry, - char **feed_id, - time_t *expires) -{ - struct jpfeed *f = NULL; - - if (!*feed_id) *feed_id = generate_feedid(); - time(expires); *expires += FEED_TTL; - - f = make_jpfeed(destination,attrs,qry,*feed_id,*expires); - glite_jp_add_deferred(ctx,register_feed_deferred,f); - - return 0; -} - -int glite_jpps_refresh_feed(glite_jp_context_t ctx, char *feed_id, time_t *expires){ - time(expires); *expires += FEED_TTL; - - glite_jppsbe_refresh_feed(ctx, feed_id, *expires); - - printf("Feed %s has been refreshed.\n", feed_id); - - return 0; -} - diff --git a/org.glite.jp.primary/src/feed.h b/org.glite.jp.primary/src/feed.h deleted file mode 100644 index a4f63af..0000000 --- a/org.glite.jp.primary/src/feed.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_JP_FEED_H -#define GLITE_JP_FEED_H - - -struct jpfeed { -/* feed data */ - char *id,*destination; - time_t expires; - int continuous; - -/* complete and split query and attribute list */ - char **attrs,**meta_attr,**other_attr; - int int_other_attr; /* index from where other_attr is extended - with attributes from other_query */ - - int nother_attr, nmeta_attr, nmeta_qry, nother_qry; - glite_jp_query_rec_t *qry,*meta_qry,*other_qry; - -/* jobs stacked for feed */ - int njobs; - char **jobs; - char **owners; - glite_jp_attrval_t **job_attrs; - -/* next feed */ - struct jpfeed *next; -}; - - -int glite_jpps_match_attr(glite_jp_context_t,const char *,const glite_jp_attrval_t[]); -int glite_jpps_match_file(glite_jp_context_t,const char *,const char *,const char *); -int glite_jpps_match_attr_multi(glite_jp_context_t,const char **, const glite_jp_attrval_t **); -int glite_jpps_match_tag(glite_jp_context_t,const char *,const char *,const char *); -int glite_jpps_run_feed(glite_jp_context_t,const char *,char const * const *,const glite_jp_query_rec_t *,int,char **); -int glite_jpps_register_feed(glite_jp_context_t,const char *,char const * const *,const glite_jp_query_rec_t *,char **,time_t *); - -#endif /* GLITE_JP_FEED_H */ diff --git a/org.glite.jp.primary/src/file_plugin.c b/org.glite.jp.primary/src/file_plugin.c deleted file mode 100644 index 65226d5..0000000 --- a/org.glite.jp.primary/src/file_plugin.c +++ /dev/null @@ -1,142 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include -#include "glite/jp/file_plugin.h" - -static struct option opts[] = { - { "plugin", 1, NULL, 'p' }, - { NULL } -}; - -static int loadit(glite_jp_context_t ctx,const char *so) -{ -/* XXX: not stored but we never dlclose() yet */ - void *dl_handle = dlopen(so,RTLD_NOW); - - glite_jp_error_t err; - const char *e; - glite_jpps_fplug_data_t *data,*dp; - int i; - - glite_jpps_fplug_init_t init; - memset(&err,0,sizeof err); - - if (!dl_handle) { - err.source = "dlopen()"; - err.code = EINVAL; - err.desc = dlerror(); - return glite_jp_stack_error(ctx,&err); - } - - dlerror(); - init = dlsym(dl_handle,"init"); - e = dlerror(); - if (e) { - char buf[300]; - snprintf(buf,sizeof buf,"dlsym(\"%s\",\"init\")",so); - buf[299] = 0; - err.source = buf; - err.code = ENOENT; - err.desc = e; - return glite_jp_stack_error(ctx,&err); - } - - data = calloc(1,sizeof *data); - - if (init(ctx,data)) return -1; - - i = 0; - if (ctx->plugins) for (i=0; ctx->plugins[i]; i++); - ctx->plugins = realloc(ctx->plugins, (i+2) * sizeof *ctx->plugins); - ctx->plugins[i] = data; - ctx->plugins[i+1] = NULL; - - /* TODO: check consistency of uri+class pairs wrt. previous plugins */ - - return 0; -} - -int glite_jpps_fplug_load(glite_jp_context_t ctx,int argc,char **argv) -{ - int i; - - for (i=1; iplugins) { - return glite_jp_stack_error(ctx,&err); - } - - for (i = 0; ctx->plugins[i]; i++) { - int j; - glite_jpps_fplug_data_t *p = ctx->plugins[i]; - - for (j=0; p->uris && p->uris[j]; j++) - if ((uri && !strcmp(p->uris[j],uri)) || (class && !strcmp(p->classes[j],class))) { - out = realloc(out, (matches+2) * sizeof *out); - out[matches++] = p; - out[matches] = NULL; - } - } - - if (matches) { - *plugin_data = out; - return 0; - } - else return glite_jp_stack_error(ctx,&err); -} - -int glite_jpps_fplug_lookup(glite_jp_context_t ctx,const char *uri, glite_jpps_fplug_data_t ***plugin_data) -{ - return lookup_common(ctx,uri,NULL,plugin_data); -} - -int glite_jpps_fplug_lookup_byclass(glite_jp_context_t ctx, const char *class,glite_jpps_fplug_data_t ***plugin_data) -{ - return lookup_common(ctx,NULL,class,plugin_data); -} - diff --git a/org.glite.jp.primary/src/ftpd_auth.c b/org.glite.jp.primary/src/ftpd_auth.c deleted file mode 100644 index ac4563e..0000000 --- a/org.glite.jp.primary/src/ftpd_auth.c +++ /dev/null @@ -1,219 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "glite/jp/types.h" -#include "glite/jp/context.h" - -#include "glite/jp/db.h" - -extern void reply(int n, char *fmt,...); - -#define FTPBE_DEFAULT_DB_CS "jpps/@localhost:jpps" - -static char *user_subj = NULL; -static char *int_prefix = NULL; -static glite_jp_context_t ctx; - -static int open_db() -{ - char *db_cs = NULL; - - db_cs = getenv("FTPBE_DB_CS"); - if (!db_cs) db_cs = FTPBE_DEFAULT_DB_CS; - - int_prefix = getenv("FTPBE_INT_PREFIX"); - if (!int_prefix) { - reply(550, "Internal error: prefix not configured"); - return 0; - } - - glite_jp_init_context(&ctx); - if (glite_lbu_InitDBContext(((glite_lbu_DBContext *)&ctx->dbhandle)) != 0) { - reply(550, "Internal error: backend DB initialization failed"); - return 0; - } - if (glite_lbu_DBConnect(ctx->dbhandle, db_cs) != 0) { - reply(550, "Internal error: backend DB access failed"); - return 0; - } - - return 1; -} - -static void close_db() -{ - glite_lbu_DBClose(ctx->dbhandle); - glite_lbu_FreeDBContext(ctx->dbhandle); -} - - -int globus_gss_assist_gridmap(char* globus_id, char** mapped_name) -{ - char *logname; - - logname = getenv("GLITE_USER"); - if (logname) { - *mapped_name = strdup(logname); - user_subj = strdup(globus_id); - if (!(*mapped_name) || !user_subj) return 1; - - return 0; - } else { - return 1; - /* - * Note: return value need not follow globus numbering - * scheme in ftpd - */ - } -} - -int globus_gss_assist_userok(char*globus_id, char *account) -{ - char *logname; - - logname = getenv("GLITE_USER"); - if (logname) - return strcmp(account,strdup(logname)) ? 1 : 0; - else - return 1; -} - -int checknoretrieve(char *name) -{ - int result = 1; /* deny access by default */ - - char *stmt = NULL; - int db_retn; - glite_lbu_Statement db_res; - char *db_row[1] = { NULL }; - - trio_asprintf(&stmt,"select j.owner from jobs j,files f where " - "f.ext_url='%|Ss%|Ss' and j.jobid=f.jobid", - int_prefix, name); - if (!stmt) { - reply(550, "Internal error: out of memory"); - return 1; - } - - if (!open_db()) return 1; - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - reply(553, "No such file registered"); - } else { - reply(550, "Internal error: backend DB access failed"); - } - goto out; - } - - db_retn = glite_jp_db_FetchRow(ctx, db_res, 1, NULL, db_row); - if (db_retn != 1) { - glite_jp_db_FreeStmt(&db_res); - reply(550, "Internal error: backend DB access failed"); - goto out; - } - glite_jp_db_FreeStmt(&db_res); - - if (!strcmp(db_row[0], user_subj)) { - result = 0; - } else { - reply(553, "Permission denied"); - } - -out: - free(db_row[0]); - close_db(); - free(stmt); - return result; -} - -int upl_check(char *name, uid_t * uid, gid_t * gid, int *f_mode, int *valid) -{ - int result = -1; /* deny access by default */ - - char *stmt = NULL; - int db_retn; - glite_lbu_Statement db_res; - char *db_row[1] = { NULL }; - - *valid = 0; /* don't used uid & gid */ - - trio_asprintf(&stmt,"select state from files " - "where ext_url='%|Ss%|Ss' and ul_userid='%|Ss'", - int_prefix, name, user_subj); - if (!stmt) { - reply(550, "Internal error: out of memory"); - return -1; - } - - if (!open_db()) return -1; - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - reply(553, "No such upload in progress"); - } else { - reply(550, "Internal error: backend DB access failed"); - } - goto out; - } - - db_retn = glite_jp_db_FetchRow(ctx, db_res, 1, NULL, db_row); - if (db_retn != 1) { - glite_jp_db_FreeStmt(&db_res); - reply(550, "Internal error: backend DB access failed"); - goto out; - } - glite_jp_db_FreeStmt(&db_res); - - if (!strcmp(db_row[0], "uploading")) { - result = 1; - } else { - reply(553, "Permission denied"); - } - -out: - free(db_row[0]); - close_db(); - free(stmt); - return result; -} - -int del_check(char *name) -{ - reply(553, "Deleting files not supported"); - return 0; -} - -int rename(const char *f, const char * t) -{ - errno = EPERM; - return -1; -} - -FILE *ftpd_popen(char *program, char *type, int closestderr) -{ - errno = EPERM; - return NULL; -} diff --git a/org.glite.jp.primary/src/is_client.c b/org.glite.jp.primary/src/is_client.c deleted file mode 100644 index e0ff27c..0000000 --- a/org.glite.jp.primary/src/is_client.c +++ /dev/null @@ -1,499 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#undef SOAP_FMAC1 -#define SOAP_FMAC1 static - -#include - -#include "glite/jp/types.h" -#include "soap_version.h" -#include "glite/security/glite_gsplugin.h" -#include "glite/security/glite_gscompat.h" - -#include "feed.h" -#include "is_client.h" - -/* same as ClientLib.c, without WITH_NOGLOBAL */ -#define SOAP_FMAC3 static -#include "jpis_C.c" -#include "jpis_Client.c" - -#include "jpis_.nsmap" - -#include "soap_env_ctx.h" -#include "soap_env_ctx.c" - -#include "glite/jp/ws_fault.c" -#include "soap_util.c" - - -#define MAX_RETRY 10 -#define RETRY_SLEEP 2 - -extern char *server_key, *server_cert; /* XXX */ -extern char file_prefix[]; -extern char *il_sock; - -struct client_data { - char *host; - int port; - long offset; -}; - -/* -static int fconnect(struct soap *soap, const char *endpoint, const char *host, int port){ - int s, len; - const char *dest = "/tmp/il_sock"; - struct sockaddr_un remote; - - if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - return SOAP_ERR; - - remote.sun_family = AF_UNIX; - strcpy(remote.sun_path, dest); - len = strlen(remote.sun_path) + sizeof(remote.sun_family); - if (connect(s, (struct sockaddr *)&remote, len) < 0) - return SOAP_ERR; - - soap->socket = s; - - return SOAP_OK; -} -*/ - -void notify_il_sock(struct soap *soap) { - struct client_data *data = soap->user; - int s, len; - struct sockaddr_un remote; - char *buf; - - if(il_sock == NULL) return; - if(data == NULL) return; - - if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) - return; - - remote.sun_family = AF_UNIX; - strcpy(remote.sun_path, il_sock); - len = strlen(remote.sun_path) + sizeof(remote.sun_family); - if (connect(s, (struct sockaddr *)&remote, len) < 0) { - close(s); - return; - } - - asprintf(&buf, "POST / HTTP/1.1\r\nHost: %s:%d\r\nContent-Length: 1\r\n\r\n", - data->host, data->port); - if(buf) { - /* fire and forget */ - send(s, buf, strlen(buf) + 1, MSG_NOSIGNAL | MSG_DONTWAIT); - free(buf); - } - free(remote.sun_path); - close(s); - return; -} - - -int myopen(struct soap *soap, const char *endpoint, const char *host, int port) -{ - char filename[PATH_MAX]; - FILE *outfile; - int i, filedesc; - struct client_data *data; - - data = malloc(sizeof(*data)); - if(data == NULL) - return ENOMEM; - - /* XXX: should it be strdup'ed? */ - data->host = host; - data->port = port; - - snprintf(filename, PATH_MAX-1, "%s.%s:%d", file_prefix, host, port); - filename[PATH_MAX - 1] = 0; - -try_again: - if((outfile = fopen(filename, "a")) == NULL) { - goto cleanup; - } - if((filedesc = fileno(outfile)) < 0) { - goto cleanup; - } - - for(i = 0; i < 5; i++) { - struct flock filelock; - int filelock_status; - struct stat statbuf; - - filelock.l_type = F_WRLCK; - filelock.l_whence = SEEK_SET; - filelock.l_start = 0; - filelock.l_len = 0; - - if((filelock_status=fcntl(filedesc, F_SETLK, &filelock)) < 0) { - switch(errno) { - case EAGAIN: - case EACCES: - case EINTR: - if((i+1) < 5) sleep(1); - break; - default: - goto cleanup; - } - } else { - if(stat(filename, &statbuf)) { - if(errno == ENOENT) { - fclose(outfile); - goto try_again; - } else { - goto cleanup; - } - } else { - /* success */ - break; - } - } - } - - if(i == 5) { - errno = ETIMEDOUT; - goto cleanup; - } - - data->offset = ftell(outfile); - soap->user = data; - soap->sendfd = filedesc; - return filedesc; - -cleanup: - filedesc = errno; - if(outfile) fclose(outfile); - return filedesc; -} - - -int myclose(struct soap *soap) -{ - if(soap->sendfd > 2) { - write(soap->sendfd, "\n", 1); - close(soap->sendfd); - soap->sendfd = -1; - /* send message to IL on socket */ - notify_il_sock(soap); - if(soap->user) { - free((struct client_data*)soap->user); - soap->user = NULL; - } - } - return SOAP_OK; -} - -int mysend(struct soap *soap, const char *s, size_t n) -{ - int ret; - - ret = write(soap->sendfd, s, n); - if(ret < 0) - return ret; - return SOAP_OK; -} - -size_t myrecv(struct soap *soap, char *s, size_t n) -{ - const char response[] = "" - "" - " " - " " - " " - " " - ""; - - int len; - - if(soap->user == NULL) - soap->user = response; - - len = sizeof(response) - ((char*)soap->user - response); - if(n < len) len = n; - strncpy(s, (char*)soap->user, len); - soap->user += len; - return len; -} - -static int check_other_soap(glite_jp_context_t ctx) -{ - glite_gsplugin_Context plugin_ctx; - int ret = 0; - - if (!ctx->other_soap) { - glite_gsplugin_init_context(&plugin_ctx); - if (server_key || server_cert) { - edg_wll_GssCred cred; - - ret = edg_wll_gss_acquire_cred_gsi(server_cert, server_key, &cred, NULL); - glite_gsplugin_use_credential(plugin_ctx, cred); - } - - ctx->other_soap = soap_new(); - soap_init(ctx->other_soap); - soap_set_namespaces(ctx->other_soap,jpis__namespaces); - soap_set_omode(ctx->other_soap, SOAP_IO_BUFFER); // set buffered response - // buffer set to SOAP_BUFLEN (default = 8k) - if(il_sock == NULL) { - /* send to JPIS directly */ - soap_register_plugin_arg(ctx->other_soap,glite_gsplugin,plugin_ctx); - ctx->other_soap->user = ctx; - } else { - /* this makes the SOAP client send all traffic through local socket to IL */ - // ctx->other_soap->fconnect = fconnect; - ctx->other_soap->fopen = myopen; - ctx->other_soap->fclose = myclose; - ctx->other_soap->fsend = mysend; - } - } - return ret; -} - -static check_fault(glite_jp_context_t ctx,struct soap *soap,int ec) -{ - glite_jp_error_t err; - char buf[1000] = "unknown fault"; - - switch (ec) { - case SOAP_OK: return 0; - default: - err.code = EIO; - err.source = __FUNCTION__; - err.desc = buf; - if (soap->fault) snprintf(buf,sizeof buf,"%s %s\n", - soap->fault->faultcode, - soap->fault->faultstring); - buf[999] = 0; - glite_jp_stack_error(ctx,&err); - return err.code; - } -} - -static struct _glite_jp_soap_env_ctx_t *keep_soap_env_ctx; - -#define SWITCH_SOAP_CTX \ -{ \ - keep_soap_env_ctx = glite_jp_soap_env_ctx; \ - glite_jp_soap_env_ctx = &my_soap_env_ctx; \ -} \ - -#define RESTORE_SOAP_CTX \ -{ \ - glite_jp_soap_env_ctx = keep_soap_env_ctx; \ -} \ - -static int glite_jpps_single_feed_wrapped( - glite_jp_context_t ctx, - const char *feed, - int done, - const char *destination, - const char *job, - const char *owner, - glite_jp_attrval_t const *attrs -) -{ - struct _jpelem__UpdateJobs in; - struct _jpelem__UpdateJobsResponse out; - struct jptype__jobRecord jr, *jrp = &jr; - int i; - enum xsd__boolean false = GLITE_SECURITY_GSOAP_FALSE; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - - /* TODO: call JP Index server via interlogger */ - - printf("feed %s to %s, job %s\n",feed,destination,job); - - check_other_soap(ctx); - - in.feedId = (char *) feed; /* XXX: const */ - in.feedDone = done; - in.__sizejobAttributes = 1; -#warning FIXME for valtri - in.jobAttributes = &jrp; - - for (i=0; attrs[i].name; i++); - jr.jobid = soap_strdup(ctx->other_soap, job); - jr.owner = soap_strdup(ctx->other_soap, owner); - - jr.__sizeattributes = jp2s_attrValues(ctx->other_soap, - (glite_jp_attrval_t *) attrs, /* XXX: const */ - &jr.attributes,0); - - jr.remove = &false; - jr.__sizeprimaryStorage = 1; - jr.primaryStorage = &ctx->myURL; - - - SWITCH_SOAP_CTX - if (soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"", - &in,&out - )) { - char buf[1000]; - err.code = EIO; - err.source = __FUNCTION__; - err.desc = buf; - memset(buf, 0, sizeof(buf)); - if (ctx->other_soap->fault) { - snprintf(buf,sizeof buf,"%s %s\n", - ctx->other_soap->fault->faultcode, - ctx->other_soap->fault->faultstring); - } - else { - sprintf(buf,"No detailed error description (JP IS not running?)\n"); - } - buf[999] = 0; - glite_jp_stack_error(ctx,&err); - } - RESTORE_SOAP_CTX - - soap_dealloc(ctx->other_soap, jr.jobid); - soap_dealloc(ctx->other_soap, jr.owner); - attrValues_free(ctx->other_soap,jr.attributes,jr.__sizeattributes); - - return err.code; -} - -int glite_jpps_single_feed( - glite_jp_context_t ctx, - const char *feed, - int done, - const char *destination, - const char *job, - const char *owner, - glite_jp_attrval_t const *attrs -) -{ - int retry,ret; - assert(owner); - for (retry = 0; retry < MAX_RETRY; retry++) { - if ((ret = glite_jpps_single_feed_wrapped(ctx,feed,done,destination,job,owner,attrs)) == 0) break; - sleep(RETRY_SLEEP); - } - return ret; -} - - -static int glite_jpps_multi_feed_wrapped( - glite_jp_context_t ctx, - const char *feed, - int done, - int njobs, - const char *destination, - char **jobs, - char **owners, - glite_jp_attrval_t **attrs) -{ - int i,j; - - struct _jpelem__UpdateJobs in; - struct _jpelem__UpdateJobsResponse out; - struct jptype__jobRecord *jr; - enum xsd__boolean false = GLITE_SECURITY_GSOAP_FALSE; - glite_jp_error_t err; - - printf("multi_feed %s to %s\n",feed,destination); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - - check_other_soap(ctx); - - in.feedId = (char *) feed; /* XXX: const */ - in.feedDone = done; - GLITE_SECURITY_GSOAP_LIST_CREATE(ctx->other_soap, &in, jobAttributes, struct jptype__jobRecord, njobs); - - for (i=0; ijobid = jobs[i]; - jr->owner = owners[i]; - - assert(jr->owner); - - jr->__sizeattributes = jp2s_attrValues(ctx->other_soap, - attrs[i], - &jr->attributes,0); - - jr->remove = &false; - jr->__sizeprimaryStorage = 1; - jr->primaryStorage = &ctx->myURL; - } - - //#ifndef JP_PERF - SWITCH_SOAP_CTX - check_fault(ctx,ctx->other_soap, - soap_call___jpsrv__UpdateJobs(ctx->other_soap,destination,"", &in,&out)); - RESTORE_SOAP_CTX - for (i=0; iother_soap,jr->attributes,jr->__sizeattributes); - } - GLITE_SECURITY_GSOAP_LIST_DESTROY(ctx->other_soap, &in, jobAttributes); - //#endif - - return err.code; -} - - -int glite_jpps_multi_feed( - glite_jp_context_t ctx, - const char *feed, - int done, - int njobs, - const char *destination, - char **jobs, - char **owners, - glite_jp_attrval_t **attrs) -{ - int retry,ret; - for (retry = 0; retry < MAX_RETRY; retry++) { - if ((ret = glite_jpps_multi_feed_wrapped(ctx,feed,done,njobs,destination,jobs,owners,attrs)) == 0) break; - sleep(RETRY_SLEEP); - } - return ret; -} diff --git a/org.glite.jp.primary/src/is_client.h b/org.glite.jp.primary/src/is_client.h deleted file mode 100644 index 1290f0d..0000000 --- a/org.glite.jp.primary/src/is_client.h +++ /dev/null @@ -1,21 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -int glite_jpps_single_feed(glite_jp_context_t,const char *,int,const char *,const char *,const char *,glite_jp_attrval_t const *); -int glite_jpps_multi_feed(glite_jp_context_t,const char *,int,int,const char *,char **,char **,glite_jp_attrval_t **); - - diff --git a/org.glite.jp.primary/src/jp_callouts.c b/org.glite.jp.primary/src/jp_callouts.c deleted file mode 100644 index 9284ff3..0000000 --- a/org.glite.jp.primary/src/jp_callouts.c +++ /dev/null @@ -1,539 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/db.h" - -#include "jp_callouts.h" - -#define FTPBE_DEFAULT_DB_CS "jpps/@localhost:jpps" - -/* - This file provides following authorization callouts used by the globus - gridftp server. The callouts must be specified in the gsi_auth.confs - configuration file. - 1. GLOBUS_GSI_AUTHZ_SYSTEM_INIT - - called upon request arrival, runs under the deamon uid - - opens connection to the DB - 2. globus_mapping - - performs mapping to a local account - - n-to-one mapping implemented, which uses a generic user name - 3. GLOBUS_GSI_AUTHZ_HANDLE_INIT - - runs under the mapped client uid - - used to save current GSS context for later use - 4. GLOBUS_GSI_AUTHORIZE_ASYNC - - called just before the request is served - - performs actual authZ decision based on current state of the file in - in the JP DB - 5. GLOBUS_GSI_AUTHZ_HANDLE_DESTROY - - cleanup of saved data - (6. GLOBUS_GSI_AUTHZ_SYSTEM_DESTROY) - - cleanup - - we should close the connection to the DB, however this callout doesn't - seem to be called by the ftpd -*/ - -static globus_result_t -query_db(glite_jp_context_t ctx, glite_lbu_Statement *res, - const char *format, ...) -{ - char *stmt = NULL; - int ret; - glite_lbu_Statement db_res; - va_list ap; - globus_result_t result = GLOBUS_FAILURE; - - va_start(ap, format); - trio_vasprintf(&stmt, format, ap); - if (stmt == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERRNO_ERROR(result, errno); - return result; - } - va_end(ap); - - ret = glite_jp_db_ExecSQL(ctx, stmt, &db_res); - if (ret <= 0) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ((ret == 0) ? "No such file registered" : - "Internal error: backend DB access failed")); - goto end; - } - - *res = db_res; - result = GLOBUS_SUCCESS; - -end: - if (stmt) - free(stmt); - - return result; -} - -static globus_result_t -authz_read(authz_jp_system_state_struct *state, char *object, char *client) -{ - globus_result_t result = GLOBUS_FAILURE; - int db_retn; - glite_lbu_Statement db_res; - char *db_row[1] = { NULL }; - char *p; - - /* skip the gsiftp:// or ftp:// prefix */ - p = strstr(object, "ftp://"); - if (p == NULL) { - result = GLOBUS_FAILURE; - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Unsupported file type, access denied")); - goto out; - } - p += 6; - - /* find where the filename starts in the URL */ - p = strchr(p, '/'); - - result = query_db(state->jp_ctx, &db_res, - "select j.owner from jobs j,files f where " - "f.int_path='%|Ss' and j.jobid=f.jobid", p); - if (result != GLOBUS_SUCCESS) - return result; - - db_retn = glite_jp_db_FetchRow(state->jp_ctx, db_res, 1, NULL, db_row); - if (db_retn != 1) { - result = GLOBUS_FAILURE; - glite_jp_db_FreeStmt(&db_res); - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Internal error: backend DB access failed")); - goto out; - } - glite_jp_db_FreeStmt(&db_res); - - if (!strcmp(db_row[0], client)) { - result = GLOBUS_SUCCESS; - } else { - result = GLOBUS_FAILURE; - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Permission denied")); - } - -out: - free(db_row[0]); - return result; -} - -static globus_result_t -authz_write(authz_jp_system_state_struct *state, char *object, char *client) -{ - globus_result_t result = GLOBUS_FAILURE; - int db_retn; - glite_lbu_Statement db_res; - char *db_row[1] = { NULL }; - char *p; - - /* skip the gsiftp:// or ftp:// prefix */ - p = strstr(object, "ftp://"); - if (p == NULL) { - result = GLOBUS_FAILURE; - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Unsupported file type, access denied")); - goto out; - } - p += 6; - - /* find where the filename starts in the URL */ - p = strchr(p, '/'); - - result = query_db(state->jp_ctx, &db_res, - "select f.state from files f, users u " - "where f.int_path='%|Ss' and f.ul_userid=u.userid " - "and u.cert_subj='%|Ss'", - p, client); - if (result != GLOBUS_SUCCESS) - return result; - - db_retn = glite_jp_db_FetchRow(state->jp_ctx, db_res, 1, NULL, db_row); - if (db_retn != 1) { - glite_jp_db_FreeStmt(&db_res); - result = GLOBUS_FAILURE; - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Internal error: backend DB access failed")); - goto out; - } - glite_jp_db_FreeStmt(&db_res); - - if (!strcmp(db_row[0], "uploading")) { - result = GLOBUS_SUCCESS; - } else { - result = GLOBUS_FAILURE; - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Upload not in progress")); - } - -out: - free(db_row[0]); - return result; -} - -static globus_result_t -authz_del(authz_jp_system_state_struct *state, char *object, char *client) -{ - globus_result_t result = GLOBUS_FAILURE; - - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_AUTHZ_DENIED_BY_CALLOUT, - ("Deleting files not supported")); - return result; -} - -static int -get_client(gss_ctx_id_t ctx, char **name) -{ - gss_buffer_desc token = GSS_C_EMPTY_BUFFER; - OM_uint32 maj_stat, min_stat; - gss_name_t client_name = GSS_C_NO_NAME; - int ret; - - maj_stat = gss_inquire_context(&min_stat, ctx, &client_name, NULL, NULL, - NULL, NULL, NULL, NULL); - if (GSS_ERROR(maj_stat)) { - ret = -1; - goto end; - } - - maj_stat = gss_display_name(&min_stat, client_name, &token, NULL); - if (GSS_ERROR(maj_stat)) { - ret = -1; - goto end; - } - - *name = strdup(token.value); - ret = 0; - -end: - if (token.length) - gss_release_buffer(&min_stat, &token); - if (client_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &client_name); - - return ret; -} - -globus_result_t -authz_jp_system_init_callout(va_list ap) -{ - void * authz_system_state; - authz_jp_system_state_struct *state = NULL; - char *db_cs = NULL; - globus_result_t result = GLOBUS_FAILURE; - glite_jp_context_t jp_ctx; - - authz_system_state = va_arg(ap, void *); - - db_cs = getenv("FTPBE_DB_CS"); - if (!db_cs) db_cs = FTPBE_DEFAULT_DB_CS; - - /* XXX the error messages aren't displayed by ftpd on errors */ - - glite_jp_init_context(&jp_ctx); - - if (glite_lbu_InitDBContext(((glite_lbu_DBContext *)&jp_ctx->dbhandle)) != 0) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_SYSTEM_ERROR, - ("Internal error: backend DB initialization failed")); - return GLOBUS_FAILURE; - } - - if (glite_lbu_DBConnect(jp_ctx->dbhandle, db_cs) != 0) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_SYSTEM_ERROR, - ("Internal error: backend DB access failed")); - return GLOBUS_FAILURE; - } - - state = globus_libc_calloc(1, sizeof(*state)); - if (state == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERRNO_ERROR(result, errno); - return GLOBUS_FAILURE; - } - - state->jp_ctx = jp_ctx; - - *(authz_jp_system_state_struct **)authz_system_state = state; - return GLOBUS_SUCCESS; -} - -globus_result_t -authz_jp_system_destroy_callout(va_list ap) -{ - void * authz_system_state; - globus_result_t result = GLOBUS_SUCCESS; - - authz_system_state = va_arg(ap, void *); - - /* XXX close the DB here, however this call seems not be called by gridftpd */ - return result; -} - -globus_result_t -authz_jp_handle_init_callout(va_list ap) -{ - globus_gsi_authz_handle_t *handle; - char * service_name; - gss_ctx_id_t context; - globus_gsi_authz_cb_t callback; - void * callback_arg; - void * authz_system_state; - globus_result_t result = GLOBUS_FAILURE; - - handle = va_arg(ap, globus_gsi_authz_handle_t *); - service_name = va_arg(ap, char *); - context = va_arg(ap, gss_ctx_id_t); - callback = va_arg(ap, globus_gsi_authz_cb_t); - callback_arg = va_arg(ap, void *); - authz_system_state = va_arg(ap, void *); - - if (handle == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR(result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("null handle")); - goto end; - } - - *handle = globus_libc_calloc(1, sizeof(**handle)); - if (*handle == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERRNO_ERROR(result, errno); - goto end; - } - - (*handle)->gss_ctx = context; - result = GLOBUS_SUCCESS; - -end: - if (callback) - callback(callback_arg, callback_arg, result); - - return result; -} - -globus_result_t -authz_jp_authorize_async_callout(va_list ap) -{ - globus_gsi_authz_handle_t handle; - char * action; - char * object; - globus_gsi_authz_cb_t callback; - void * callback_arg; - void * authz_system_state; - globus_result_t result = GLOBUS_FAILURE; - char *client = NULL; - - handle = va_arg(ap, globus_gsi_authz_handle_t); - action = va_arg(ap, char *); - object = va_arg(ap, char *); - callback = va_arg(ap, globus_gsi_authz_cb_t); - callback_arg = va_arg(ap, void *); - authz_system_state = va_arg(ap, void *); - - if (action == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("null action")); - goto end; - } - - if (object == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("null object")); - goto end; - } - - if (handle == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("null handle")); - goto end; - } - - if (handle->gss_ctx == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("bad handle")); - goto end; - } - - if (authz_system_state == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("system state not initialized, probably the GLOBUS_GSI_AUTHZ_SYSTEM_INIT callout isn't handled")); - goto end; - } - - get_client(handle->gss_ctx, &client); - if (client == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("cannot identify client")); - goto end; - } - -// fprintf(stdout, " client \"%s\" asking to \"%s\" on \"%s\"\n", client, action, object); - - if (strcmp(action, "create") == 0) { - result = authz_write(authz_system_state, object, client); - } else if (strcmp(action, "write") == 0) { - result = authz_write(authz_system_state, object, client); - } else if (strcmp(action, "read") == 0) { - result = authz_read(authz_system_state, object, client); - } else if (strcmp(action, "delete") == 0) { - result = authz_del(authz_system_state, object, client); - } else { - result = GLOBUS_FAILURE; - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_BAD_ARGUMENT_ERROR, - ("unsupported operation")); - } - -end: - if (callback && result == GLOBUS_SUCCESS) - callback(callback_arg, handle, result); - - if (client) - free(client); - - return result; -} - -int -authz_jp_handle_destroy_callout(va_list ap) -{ - globus_gsi_authz_handle_t handle; - void * authz_system_state; - int result = (int) GLOBUS_SUCCESS; - globus_gsi_authz_cb_t callback; - void * callback_arg; - - handle = va_arg(ap, globus_gsi_authz_handle_t); - callback = va_arg(ap, globus_gsi_authz_cb_t); - callback_arg = va_arg(ap, void *); - authz_system_state = va_arg(ap, void *); - - if (handle != NULL) { - globus_libc_free(handle); - } - - /* XXX - glite_jp_db_close((authz_jp_system_state_struct*)authz_system_state->jp_ctx); - */ - -#if 0 - if (callback) - callback(callback_arg, handle, result); -#endif - return result; -} - -globus_result_t -authz_jp_globus_mapping(va_list ap) -{ - gss_ctx_id_t context; - char * service; - char * desired_identity; - char * identity_buffer; - unsigned int buffer_length; - char *logname; - char *client = NULL; - int ret; - globus_result_t result = GLOBUS_FAILURE; - - context = va_arg(ap, gss_ctx_id_t); - service = va_arg(ap, char *); - desired_identity = va_arg(ap, char *); - identity_buffer = va_arg(ap, char *); - buffer_length = va_arg(ap, unsigned int); - - logname = getenv("GLITE_USER"); - if (logname == NULL) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_CONFIGURATION_ERROR, - ("the GLITE_USER variable isn't set, can't map user")); - return GLOBUS_FAILURE; - } - - if (desired_identity) { - result = (strcmp(logname, desired_identity) == 0) ? - GLOBUS_SUCCESS : GLOBUS_FAILURE; - goto end; - } - - ret = get_client(context, &client); - if (ret) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_SYSTEM_ERROR, - ("can't get client's name")); - goto end; - } - - if (strlen(logname) + 1 > buffer_length) { - GLOBUS_GSI_AUTHZ_CALLOUT_ERROR( - result, - GLOBUS_GSI_AUTHZ_CALLOUT_SYSTEM_ERROR, - ("Not enough space to store mapped identity")); - goto end; - } - - strcpy(identity_buffer, logname); - result = GLOBUS_SUCCESS; - -end: - if (client) - free(client); - - return result; -} diff --git a/org.glite.jp.primary/src/jp_callouts.h b/org.glite.jp.primary/src/jp_callouts.h deleted file mode 100644 index 95861a7..0000000 --- a/org.glite.jp.primary/src/jp_callouts.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include "glite/jp/context.h" - -/* must be named this way to provide the name expected by the globus_gsi_authz - * header and its typedef of globus_gsi_authz_handle_t */ -typedef struct globus_i_gsi_authz_handle_s { - gss_ctx_id_t gss_ctx; -} globus_i_gsi_authz_handle_s; - -typedef struct authz_jp_system_state_struct { - glite_jp_context_t jp_ctx; -} authz_jp_system_state_struct; diff --git a/org.glite.jp.primary/src/jptype_map.h b/org.glite.jp.primary/src/jptype_map.h deleted file mode 100644 index 09b59ea..0000000 --- a/org.glite.jp.primary/src/jptype_map.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include "soap_version.h" - -#if GSOAP_VERSION >= 20700 -#define INPUT_SANDBOX jptype__UploadClass__INPUT_SANDBOX -#define OUTPUT_SANDBOX jptype__UploadClass__OUTPUT_SANDBOX -#define JOB_LOG jptype__UploadClass__JOB_LOG - -#define OWNER jptype__AttributeType__OWNER -#define TIME jptype__AttributeType__TIME -#define TAG jptype__AttributeType__TAG - -#define EQUAL jptype__queryOp__EQUAL -#define UNEQUAL jptype__queryOp__UNEQUAL -#define LESS jptype__queryOp__LESS -#define GREATER jptype__queryOp__GREATER -#define WITHIN jptype__queryOp__WITHIN - -#else - -#define __jpsrv__RegisterJob __ns1__RegisterJob -#define __jpsrv__StartUpload __ns1__StartUpload -#define __jpsrv__CommitUpload __ns1__CommitUpload -#define __jpsrv__RecordTag __ns1__RecordTag -#define __jpsrv__FeedIndex __ns1__FeedIndex -#define __jpsrv__FeedIndexRefresh __ns1__FeedIndexRefresh -#define __jpsrv__GetJob __ns1__GetJob - -#define SOAP_TYPE___jpsrv__RegisterJob SOAP_TYPE___ns1__RegisterJob -#define SOAP_TYPE___jpsrv__StartUpload SOAP_TYPE___ns1__StartUpload -#define SOAP_TYPE___jpsrv__CommitUpload SOAP_TYPE___ns1__CommitUpload -#define SOAP_TYPE___jpsrv__GetJob SOAP_TYPE___ns1__GetJob - -#endif - diff --git a/org.glite.jp.primary/src/mk_soap_switch.pl b/org.glite.jp.primary/src/mk_soap_switch.pl deleted file mode 100755 index f332e00..0000000 --- a/org.glite.jp.primary/src/mk_soap_switch.pl +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -$formula = "/* Generated from @ARGV with the help of black magic.\n Do not edit.\n*/\n\n"; -print "${formula}#include \"soap_env_ctx.h\"\n\n"; - -# XXX: hardcoded -$prefix = 'ENV'; - -open EH,">soap_env_ctx.h" or die "soap_env_ctx.h: $!\n"; -open EC,">soap_env_ctx.c" or die "soap_env_ctx.c: $!\n"; - -print EH "${formula}struct _glite_jp_soap_env_ctx_t {\n"; - -print EC "${formula}static struct _glite_jp_soap_env_ctx_t my_soap_env_ctx = {\n"; - - -while ($_ = <>) { - if (/^}$/) { - print; - $infunc = 0; - undef @args; - next; - } - - next if $infunc; - - if (/^SOAP_FMAC3\s+(.+)\s+SOAP_FMAC4\s+([^(]+)\(([^)]*)\)/) { - $type = $1; - $func = $2; - @a = split /,/,$3; - for $a (@a) { - $a =~ /.*\W(\w+)/; - push @args,$1; - } - print; - - next if $func =~ "SOAP_$prefix"; - - print EH "\t$type (*$func)();\n"; - print EC "\t$func,\n"; - next; - } - - if (/^{/) { - print; - next if $func =~ "SOAP_$prefix"; - local $"=','; - $infunc = 1; - print "\t"; - print 'return ' unless $type eq 'void'; - print "glite_jp_soap_env_ctx->$func(@args);\n"; - - next; - } - - print; -} - -print EH "};\n\n"; -print EH "extern struct _glite_jp_soap_env_ctx_t *glite_jp_soap_env_ctx;\n"; -print EC "};\n"; - -print "struct _glite_jp_soap_env_ctx_t *glite_jp_soap_env_ctx;\n"; diff --git a/org.glite.jp.primary/src/new_ftp_backend.c b/org.glite.jp.primary/src/new_ftp_backend.c deleted file mode 100644 index a192b55..0000000 --- a/org.glite.jp.primary/src/new_ftp_backend.c +++ /dev/null @@ -1,2145 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "glite/lbu/escape.h" -#include "glite/jobid/strmd5.h" -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/known_attr.h" -#include "glite/jp/attr.h" -#include "glite/jp/db.h" - -#include "feed.h" -#include "tags.h" -#include "backend_private.h" - -#include "jpps_H.h" /* XXX: SOAP_TYPE___jpsrv__GetJob */ - -#include "jptype_map.h" - -#define FTPBE_DEFAULT_DB_CS "jpps/@localhost:jpps" - -struct ftpbe_config { - char *internal_path; - char *external_path; - char *db_cs; -// char *gridmap; - char *logname; -}; - -static struct ftpbe_config *config = NULL; - -struct fhandle_rec { - gzFile fd_gz; - char* filename; - int filemode; - char* filedata; - int offset; - int eof; - int modified; -}; -typedef struct fhandle_rec *fhandle; - -static struct option ftpbe_opts[] = { - { "ftp-internal-path", 1, NULL, 'I' }, - { "ftp-external-path", 1, NULL, 'E' }, - { "ftp-db-cs", 1, NULL, 'D' }, -// { "ftp-gridmap", 1, NULL, 'G' }, - { NULL, 0, NULL, 0 } -}; - -/******************************************************************************* - Internal helpers -*******************************************************************************/ - - -static int config_check( - glite_jp_context_t ctx, - struct ftpbe_config *config) -{ - return config == NULL || - config->internal_path == NULL || - config->external_path == NULL || - config->db_cs == NULL || -// config->gridmap == NULL || - config->logname == NULL; - - /* XXX check reality */ -} - -static int jobid_unique_pathname(glite_jp_context_t ctx, const char *job, - char **unique, char **ju_path, int get_path) -{ - char *p; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - p = strrchr(job, '/'); - if (!p) { - err.code = EINVAL; - err.desc = "Malformed jobid"; - return glite_jp_stack_error(ctx,&err); - } - /* XXX thorough checks */ - if (!(*unique = strdup(p+1))) { - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - if (get_path) { - if (!(*ju_path = strdup(p+1))) { - free(*unique); - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - *(*ju_path + 10) = '\0'; - } - return 0; -} - -static int mkdirpath(const char* path, int prefixlen) -{ - char *wpath, *p; - int goout, ret; - - wpath = strdup(path); - if (!wpath) { - errno = ENOMEM; - return -1; - } - - p = wpath + prefixlen; - goout = 0; - while (!goout) { - while (*p == '/') p++; - while (*p != '/' && *p != '\0') p++; - goout = (*p == '\0'); - *p = '\0'; - ret = mkdir(wpath, S_IRUSR | S_IWUSR | S_IXUSR); - if (ret < 0 && errno != EEXIST) break; - *p = '/'; - } - free(wpath); - return goout ? 0 : ret; -} - -static int store_user(glite_jp_context_t ctx, const char *userid, const char *subj) -{ - glite_jp_error_t err; - char *stmt; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - assert(userid != NULL); - assert(subj != NULL); - - trio_asprintf(&stmt,"insert into users(userid,cert_subj) " - "values ('%|Ss','%|Ss')",userid,subj); - if (!stmt) { - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - - if (glite_jp_db_ExecSQL(ctx, stmt, NULL) < 0) { - if (ctx->error->code == EEXIST) - glite_jp_clear_error(ctx); - else { - free(stmt); - err.code = EIO; - err.desc = "DB access failed"; - return glite_jp_stack_error(ctx,&err); - } - } - free(stmt); - - return 0; -} - -static long regtime_trunc(long tv_sec) -{ - return tv_sec / (86400*7); -} - -static long regtime_ceil(long tv_sec) -{ - return (tv_sec % (86400*7)) ? tv_sec/(86400*7)+1 : tv_sec/(86400*7) ; -} - -/******************************************************************************** - Backend calls -********************************************************************************/ -int glite_jppsbe_init( - glite_jp_context_t ctx, - int argc, - char *argv[] -) -{ - glite_jp_error_t err; - int opt; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - config = (struct ftpbe_config *) calloc(1, sizeof *config); - if (!config) { - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - - config->logname = getlogin(); - - while ((opt = getopt_long(argc, argv, "I:E:D:" /* G: */, ftpbe_opts, NULL)) != EOF) { - switch (opt) { - case 'I': - config->internal_path = optarg; - int i = strlen(optarg) - 1; - while (optarg[i] == '/'){ - optarg[i] = 0; - i--; - } - break; - case 'E': config->external_path = optarg; break; - case 'D': config->db_cs = optarg; break; -// case 'G': config->gridmap = optarg; break; - default: break; - } - } - - /* Defaults */ - if (!config->db_cs) config->db_cs = strdup(FTPBE_DEFAULT_DB_CS); - - if (config_check(ctx, config)) { - err.code = EINVAL; - err.desc = "Invalid FTP backend configuration"; - return glite_jp_stack_error(ctx,&err); - } - - if (glite_lbu_InitDBContext(((glite_lbu_DBContext *)&ctx->dbhandle)) != 0) { - err.code = glite_jp_db_SetError(ctx, __FUNCTION__); - err.desc = "Cannot init backend's database (during init)"; - return glite_jp_stack_error(ctx,&err); - } - if (glite_lbu_DBConnect(ctx->dbhandle, config->db_cs)) { - err.code = glite_jp_db_SetError(ctx, __FUNCTION__); - err.desc = "Cannot access backend's database (during connect)"; - return glite_jp_stack_error(ctx,&err); - } else { - /* slaves open their own connections */ - glite_lbu_DBClose(ctx->dbhandle); - glite_lbu_FreeDBContext(ctx->dbhandle); - } - - return 0; -} - -int glite_jppsbe_init_slave( - glite_jp_context_t ctx -) -{ - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (glite_lbu_InitDBContext(((glite_lbu_DBContext *)&ctx->dbhandle)) != 0) { - err.code = glite_jp_db_SetError(ctx, __FUNCTION__); - err.desc = "Cannot init backend's database (during init)"; - return glite_jp_stack_error(ctx,&err); - } - if (glite_lbu_DBConnect(ctx->dbhandle, config->db_cs)) { - err.code = glite_jp_db_SetError(ctx, __FUNCTION__); - err.desc = "Cannot access backend's database (during connect)"; - return glite_jp_stack_error(ctx,&err); - } - - return 0; -} - -int glite_jppsbe_register_job( - glite_jp_context_t ctx, - const char *job, - const char *owner -) -{ - glite_jp_error_t err; - char *data_dir = NULL; - char *ju = NULL; - char *ju_path = NULL; - char *ownerhash = NULL; - struct timeval reg_tv; - char *stmt = NULL; - char *dbtime = NULL; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - assert(job != NULL); - assert(owner != NULL); - - gettimeofday(®_tv, NULL); - - if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) { - err.code = ctx->error->code; - err.desc = "Cannot obtain jobid unique path/name"; - return glite_jp_stack_error(ctx,&err); - } - - ownerhash = str2md5(owner); /* static buffer */ - if (store_user(ctx, ownerhash, owner)) { - err.code = EIO; - err.desc = "Cannot store user entry"; - goto error_out; - } - - glite_lbu_TimeToDB(reg_tv.tv_sec, &dbtime); - if (!dbtime) { - err.code = ENOMEM; - goto error_out; - } - - trio_asprintf(&stmt,"insert into jobs(jobid,dg_jobid,owner,reg_time) " - "values ('%|Ss','%|Ss','%|Ss', %s)", - ju, job, ownerhash, dbtime); - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if (glite_jp_db_ExecSQL(ctx, stmt, NULL) < 0) { - if (ctx->error->code == EEXIST) { - err.code = EEXIST; - err.desc = "Job already registered"; - } - else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - - if (asprintf(&data_dir, "%s/data/%s/%d/%s", - config->internal_path, ownerhash, regtime_trunc(reg_tv.tv_sec), ju) == -1) { - err.code = ENOMEM; - goto error_out; - } - if (mkdirpath(data_dir, strlen(config->internal_path)) < 0 && - errno != EEXIST) { - err.code = errno; - err.desc = "Cannot mkdir jobs's data directory"; - goto error_out; - } - -error_out: - free(data_dir); - free(stmt); free(dbtime); - free(ju); free(ju_path); - - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - -#if 0 -static int add_to_gridmap(glite_jp_context_t ctx, const char *dn) -{ - FILE *gridmap = NULL; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - gridmap = fopen(config->gridmap, "a"); - if (!gridmap) { - err.code = errno; - err.desc = "Cannot open gridmap file"; - return glite_jp_stack_error(ctx,&err); - } - if (fprintf(gridmap, "\"%s\" %s\n", dn, config->logname) < 6 || - ferror(gridmap)) { - err.code = EIO; - err.desc = "Cannot write to gridmap file"; - fclose(gridmap); - return glite_jp_stack_error(ctx,&err); - } - fclose(gridmap); - return 0; -} - -static int remove_from_gridmap(glite_jp_context_t ctx, const char *dn) -{ - FILE *gridmap = NULL; - char *temp_name = NULL; - FILE *temp_file = NULL; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - /* XXX */ - return 0; -} -#endif - -int glite_jppsbe_start_upload( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name, - const char *content_type, - char **destination_out, - time_t *commit_before_inout -) -{ - char *data_basename = NULL; - char *data_fname = NULL; - char *ju = NULL; - char *ju_path = NULL; - char *peername = NULL; - char *peerhash = NULL; - char *commit_before_inout_str; - time_t now; - char *now_str = NULL; - - char *stmt = NULL; - glite_lbu_Statement db_res; - int db_retn; - char *db_row[2] = { NULL, NULL }; - - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - assert(job!=NULL); - assert(destination_out!=NULL); - - assert(class!=NULL); - - if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) { - err.code = ctx->error->code; - err.desc = "Cannot obtain jobid unique path/name"; - return glite_jp_stack_error(ctx,&err); - } - - peername = glite_jp_peer_name(ctx); - if (peername == NULL) { - err.code = EINVAL; - err.desc = "Cannot obtain client certificate info"; - goto error_out; - } - - trio_asprintf(&stmt, "select owner, reg_time from jobs" - " where jobid='%|Ss'", ju); - - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - err.code = ENOENT; - err.desc = "No such job registered"; - } else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - - db_retn = glite_jp_db_FetchRow(ctx, db_res, sizeof(db_row)/sizeof(db_row[0]), NULL, db_row); - if (db_retn != 2) { - glite_jp_db_FreeStmt(&db_res); - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - - glite_jp_db_FreeStmt(&db_res); - - /* XXX authorization done in soap_ops.c */ - - /* XXX name length */ - if (asprintf(&data_basename, "%s%s%s", class, - (name != NULL) ? "." : "", - (name != NULL) ? name : "") == -1) { - err.code = ENOMEM; - goto error_out; - } - - if (asprintf(&data_fname, "%s/data/%s/%d/%s/%s", - config->internal_path, db_row[0], - regtime_trunc(glite_lbu_DBToTime(db_row[1])), - ju, data_basename) == -1) { - err.code = ENOMEM; - goto error_out; - } - if (asprintf(destination_out, "%s/data/%s/%d/%s/%s", - config->external_path, db_row[0], - regtime_trunc(glite_lbu_DBToTime(db_row[1])), - ju, data_basename) == -1) { - err.code = ENOMEM; - goto error_out; - } - - if (commit_before_inout != NULL) - /* XXX no timeout enforced */ - /* XXX: gsoap does not like so much, one year should be enough - *commit_before_inout = (time_t) LONG_MAX; - */ - *commit_before_inout = time(NULL) + 5*60;//365*24*60*60; - - /* - if (add_to_gridmap(ctx, peername)) { - err.code = EIO; - err.desc = "Cannot add peer DN to ftp server authorization file"; - goto error_out; - } - */ - else if (*commit_before_inout > time(NULL) + 5*60) - *commit_before_inout = time(NULL) + 5*60; - - peerhash = str2md5(peername); /* static buffer */ - if (store_user(ctx, peerhash, peername)) { - err.code = EIO; - err.desc = "Cannot store upload user entry"; - goto error_out; - } - - free(stmt); stmt = NULL; - - time(&now); - glite_lbu_TimeToDB(now,&now_str); - - trio_asprintf(&stmt,"delete from files where jobid = '%|Ss' and state = 'uploading' and deadline < %s", ju, now_str); - free(now_str); - - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - if (glite_jp_db_ExecSQL(ctx, stmt, NULL) < 0) { - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - - free(stmt); stmt = NULL; - - glite_lbu_TimeToDB(*commit_before_inout, &commit_before_inout_str); - trio_asprintf(&stmt,"insert into files" - "(jobid,filename,int_path,ext_url,state,deadline,ul_userid) " - "values ('%|Ss','%|Ss','%|Ss','%|Ss','%|Ss', %s, '%|Ss')", - ju, data_basename, data_fname, *destination_out, "uploading", - commit_before_inout_str, peerhash); - free(commit_before_inout_str); - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if (glite_jp_db_ExecSQL(ctx, stmt, NULL) < 0) { - if (ctx->error->code == EEXIST) { - err.code = EEXIST; - err.desc = "File already stored or upload in progress"; - } else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - -error_out: - free(db_row[0]); free(db_row[1]); - free(stmt); - free(data_basename); - free(data_fname); - free(ju); free(ju_path); - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - -int glite_jppsbe_commit_upload( - glite_jp_context_t ctx, - const char *destination -) -{ - char *peername = NULL; - char *peerhash = NULL; - - char *stmt = NULL; - glite_lbu_Statement db_res; - int db_retn; - char *db_row[7] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL }; - int i; - - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - assert(destination != NULL); - - trio_asprintf(&stmt, "select * from files where " - "ext_url='%|Ss' and state='uploading'", destination); - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - err.code = ENOENT; - err.desc = "No such upload in progress"; - } else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - - db_retn = glite_jp_db_FetchRow(ctx, db_res, sizeof(db_row)/sizeof(db_row[0]), NULL, db_row); - if (db_retn != 7) { - glite_jp_db_FreeStmt(&db_res); - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - glite_jp_db_FreeStmt(&db_res); - - peername = glite_jp_peer_name(ctx); - if (peername == NULL) { - err.code = EINVAL; - err.desc = "Cannot obtain client certificate info"; - goto error_out; - } - - peerhash = str2md5(peername); /* static buffer */ - if (strcmp(peerhash, db_row[6])) { - err.code = EPERM; - err.desc = "Upload started by client with different identity"; - goto error_out; - } - - free(stmt); - trio_asprintf(&stmt,"update files set state='committed', deadline=NULL " - "where jobid='%|Ss' and filename='%|Ss'", db_row[0], db_row[1]); - - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if (glite_jp_db_ExecSQL(ctx, stmt, NULL) < 0) { - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } -error_out: - for (i=0; i<7; i++) free(db_row[i]); - free(peername); - free(stmt); - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - -int glite_jppsbe_destination_info( - glite_jp_context_t ctx, - const char *destination, - char **job, - char **class, - char **name -) -{ - char *stmt = NULL; - glite_lbu_Statement db_res; - int db_retn; - char *db_row[2] = { NULL, NULL}; - int i; - char *cp = NULL; - - glite_jp_error_t err; - - assert(destination != NULL); - assert(job != NULL); - assert(class != NULL); - assert(name != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - - trio_asprintf(&stmt, "select j.dg_jobid,f.filename from jobs j,files f where " - "f.ext_url='%|Ss' and j.jobid=f.jobid", destination); - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - err.code = ENOENT; - err.desc = "Invalid destination string"; - } else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - - db_retn = glite_jp_db_FetchRow(ctx, db_res, sizeof(db_row)/sizeof(db_row[0]), NULL, db_row); - if (db_retn != 2) { - glite_jp_db_FreeStmt(&db_res); - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - glite_jp_db_FreeStmt(&db_res); - - *job = strdup(db_row[0]); - - cp = strchr(db_row[1],'.'); - if (!cp) { - *name = NULL; - } else { - *cp++ = '\0'; - *name = strdup(cp); - } - *class = strdup(db_row[1]); - - if (!*job || !*class) { - err.code = ENOMEM; - goto error_out; - } - -error_out: - for (i=0; i<2; i++) free(db_row[i]); - free(stmt); - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - - -int glite_jppsbe_get_job_url( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name, - char **url_out -) -{ - char *data_basename = NULL; - char *ju = NULL; - char *ju_path = NULL; - - char *stmt = NULL; - glite_lbu_Statement db_res; - int db_retn; - char *db_row[3] = { NULL, NULL, NULL }; - - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - assert(job!=NULL); - assert(url_out != NULL); - - assert(class!=NULL); - - if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) { - err.code = ctx->error->code; - err.desc = "Cannot obtain jobid unique path/ : ""name"; - return glite_jp_stack_error(ctx,&err); - } - - trio_asprintf(&stmt, "select j.owner,reg_time,u.cert_subj from jobs j, users u " - "where j.jobid='%|Ss' and j.owner = u.userid", ju); - - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - err.code = ENOENT; - err.desc = "No such job registered"; - } else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - - free(stmt); stmt = NULL; - - db_retn = glite_jp_db_FetchRow(ctx, db_res, sizeof(db_row)/sizeof(db_row[0]), NULL, db_row); - if (db_retn != 3) { - glite_jp_db_FreeStmt(&db_res); - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - - glite_jp_db_FreeStmt(&db_res); - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobFiles,job,db_row[2])) { - err.code = EPERM; - goto error_out; - } - - /* XXX name length */ - if (asprintf(&data_basename, "%s%s%s", class, - (name != NULL) ? "." : "", - (name != NULL) ? name : "") == -1) { - err.code = ENOMEM; - goto error_out; - } - - if (asprintf(url_out, "%s/data/%s/%d/%s/%s", - config->external_path, db_row[0], - regtime_trunc(glite_lbu_DBToTime(db_row[1])), - ju, data_basename) == -1) { - err.code = ENOMEM; - goto error_out; - } - -// FIXME: relict? -#if 0 - trio_asprintf(&stmt,"select 'x' from files where jobid='%|Ss' " - "and ext_url = '%|Ss' " - "and state='committed' ",ju,*url_out); - - if ((db_retn = glite_jp_db_ExecSQL(ctx,stmt,&db_res)) <= 0) { - if (db_retn == 0) { - err.code = ENOENT; - err.desc = "not uploaded yet"; - } - else { - err.code = EIO; - err.desc = "DB access failed"; - } - /* goto error_out; */ - } -#endif - -error_out: - free(db_row[0]); free(db_row[1]); - free(stmt); - free(data_basename); - free(ju); free(ju_path); - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - -static int get_job_fname( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name, - char **fname_out -) -{ - char *data_basename = NULL; - char *ju = NULL; - char *ju_path = NULL; - - char *stmt = NULL; - glite_lbu_Statement db_res; - int db_retn; - char *db_row[2] = { NULL, NULL }; - - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - assert(job!=NULL); - assert(fname_out != NULL); - - assert(class!=NULL); - - if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) { - err.code = ctx->error->code; - err.desc = "Cannot obtain jobid unique path/name"; - return glite_jp_stack_error(ctx,&err); - } - - trio_asprintf(&stmt, "select owner, reg_time from jobs " - "where jobid='%|Ss'", ju); - - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if ((db_retn = glite_jp_db_ExecSQL(ctx, stmt, &db_res)) <= 0) { - if (db_retn == 0) { - err.code = ENOENT; - err.desc = "No such job registered"; - } else { - err.code = EIO; - err.desc = "DB access failed"; - } - goto error_out; - } - - db_retn = glite_jp_db_FetchRow(ctx, db_res, sizeof(db_row)/sizeof(db_row[0]), NULL, db_row); - if (db_retn != 2) { - glite_jp_db_FreeStmt(&db_res); - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - - glite_jp_db_FreeStmt(&db_res); - - /* XXX name length */ - if (asprintf(&data_basename, "%s%s%s", class, - (name != NULL) ? "." : "", (name != NULL) ? name : "") == -1) { - err.code = ENOMEM; - goto error_out; - } - - if (asprintf(fname_out, "%s/data/%s/%d/%s/%s", - config->internal_path, db_row[0], - regtime_trunc(glite_lbu_DBToTime(db_row[1])), - ju, data_basename) == -1) { - err.code = ENOMEM; - goto error_out; - } - -error_out: - free(db_row[0]); free(db_row[1]); - free(stmt); - free(data_basename); - free(ju); free(ju_path); - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - - -int glite_jppsbe_open_file( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name, - int mode, - void **handle_out -) -{ - fhandle handle = NULL; - char* fname = NULL; - glite_jp_error_t err; - - assert(handle_out != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (get_job_fname(ctx, job, class, name, &fname)) { - err.code = ctx->error->code; - err.desc = "Cannot construct internal filename"; - return glite_jp_stack_error(ctx,&err); - } - - handle = (fhandle) calloc(1,sizeof(*handle)); - if (handle == NULL) { - err.code = ENOMEM; - goto error_out; - } - - int error = 0; - int created = 0; - if (mode % 4 == O_RDONLY) - handle->fd_gz = gzopen(fname, "r"); - else if (mode % 4 == O_WRONLY) - handle->fd_gz = gzopen(fname, "r+"); - else if (mode % 4 == O_RDWR){ - handle->fd_gz = gzopen(fname, "r+"); - if ((handle->fd_gz == NULL) && (mode & O_CREAT)){ - handle->fd_gz = gzopen(fname, "w+"); - created = 1; // when the file is created, gzread returns -2 - } - } - if (handle->fd_gz == NULL){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Cannot open requested file"; - free(handle); handle = NULL; - error = 1; - goto error_out; - } - - handle->offset = 0; - handle->eof = 0; - - if (! created){ - const int READ_STEP = 8192; - //handle->filedata = malloc(sizeof(*handle->filedata)*READ_STEP); - int diff = 0; - char buf[READ_STEP]; - do{ - diff = gzread(handle->fd_gz, buf/*handle->filedata + handle->eof*/, READ_STEP); - if (diff < 0){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Error reading file"; - free(handle->filedata); - error = 1; - goto error_out; - } - handle->eof += diff; - handle->filedata = realloc(handle->filedata, sizeof(*handle->filedata)*handle->eof); - memcpy(handle->filedata + handle->eof - diff, buf, sizeof(*buf)*diff); - } while(diff == READ_STEP); - } - - /*if (gzclose(fd_gz)){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Error closing file descriptor"; - free(handle->filedata); - goto error_out; - }*/ - - handle->filename = strdup(fname); - handle->filemode = mode; - handle->modified = 0; - - *handle_out = (void*) handle; - -error_out: - free(fname); - if (error) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - -int glite_jppsbe_close_file( - glite_jp_context_t ctx, - void *handle -) -{ - glite_jp_error_t err; - - assert(handle != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (gzclose(((fhandle)handle)->fd_gz)){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Error closing file descriptor"; - goto error_out; - } - - if (((fhandle)handle)->modified){ - if ((((fhandle)handle)->fd_gz = gzopen(((fhandle)handle)->filename, "w")) == NULL){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Error opening file for write changes"; - goto error_out; - } - if (gzwrite(((fhandle)handle)->fd_gz, ((fhandle)handle)->filedata, ((fhandle)handle)->eof) < 0){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Error writing changes"; - goto error_out; - } - if (gzclose(((fhandle)handle)->fd_gz)){ - gzerror(((fhandle)handle)->fd_gz, &(err.code)); - err.desc = "Error closing file descriptor"; - goto error_out; - } - } - -error_out: - free(((fhandle)handle)->filedata); - free(((fhandle)handle)->filename); - free(handle); handle=NULL; - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} - - -int glite_jppsbe_file_attrs(glite_jp_context_t ctx, void *handle, struct stat *buf){ - glite_jp_error_t err; - - assert(handle != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (! stat(((fhandle)handle)->filename, buf)) { - err.code = errno; - err.desc = "Error calling fstat"; - return glite_jp_stack_error(ctx,&err); - } - - return 0; -} - -int glite_jppsbe_pread( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset, - ssize_t *nbytes_ret -) -{ - glite_jp_error_t err; - - assert(handle != NULL); - assert(buf != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (((fhandle)handle)->filename == NULL){ - err.code = 0; - err.desc = "Cannot read, file not open"; - return glite_jp_stack_error(ctx,&err); - } - - int to_read; - if (offset + nbytes > ((fhandle)handle)->eof) - to_read = ((fhandle)handle)->eof - offset; - else - to_read = nbytes; - memcpy(buf, ((fhandle)handle)->filedata + offset, to_read); - ((fhandle)handle)->offset = offset + to_read; - - *nbytes_ret = to_read; - - return 0; -} - -int glite_jppsbe_pwrite( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes, - off_t offset -) -{ - glite_jp_error_t err; - - assert(handle != NULL); - assert(buf != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (((fhandle)handle)->filename == NULL){ - err.code = 0; - err.desc = "Cannot write, file not open"; - return glite_jp_stack_error(ctx,&err); - } - - if (((fhandle)handle)->filemode % 4 == 0){ - err.desc = "Cannot write to readonly file"; - return glite_jp_stack_error(ctx,&err); - } - - if (offset + nbytes > ((fhandle)handle)->eof){ - ((fhandle)handle)->filedata = realloc(((fhandle)handle)->filedata, offset + nbytes); - ((fhandle)handle)->eof = offset + nbytes; - } - - memcpy(((fhandle)handle)->filedata + offset, buf, nbytes); - - ((fhandle)handle)->modified = 1; - - return 0; -} - -int glite_jppsbe_compress_and_remove_file( - glite_jp_context_t ctx, - const char *job, - const char *class, - const char *name -){ - glite_jp_error_t err; - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - char *src, *dest; - get_job_fname(ctx, job, class, name, &src); - - dest = malloc(sizeof(*dest)*(strlen(src)+strlen(".gz")+1)); - sprintf(dest, "%s.gz", src); - - char buf[8192]; - FILE* s = fopen(src, "r"); - gzFile d = gzopen(dest, "w"); - size_t l; - while ((l = fread(buf, sizeof(*buf), 8192, s)) > 0) - gzwrite(d, buf, sizeof(*buf)*l); - gzclose(d); - fclose(s); - - char *ju, *ju_path; - if (jobid_unique_pathname(ctx, job, &ju, &ju_path, 1) != 0) { - err.code = ctx->error->code; - err.desc = "Cannot obtain jobid unique path/name"; - goto error_out; - } - - rename(dest, src); - -error_out: - if (err.code) { - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } - -} - -int glite_jppsbe_append( - glite_jp_context_t ctx, - void *handle, - void *buf, - size_t nbytes -) -{ - glite_jp_error_t err; - - assert(handle != NULL); - assert(buf != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - ((fhandle)handle)->filedata = realloc(((fhandle)handle)->filedata, ((fhandle)handle)->eof + nbytes); - memcpy(((fhandle)handle)->filedata + ((fhandle)handle)->eof, buf, nbytes); - - ((fhandle)handle)->eof += nbytes; - ((fhandle)handle)->modified = 1; - - return 0; -} - -static int get_job_info( - glite_jp_context_t ctx, - const char *job, - char **owner, - struct timeval *tv_reg -) -{ - char *qry,*col[2]; - int rows; - glite_jp_error_t err; - glite_lbu_Statement s = NULL; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - glite_jp_clear_error(ctx); - - trio_asprintf(&qry,"select u.cert_subj,j.reg_time " - "from jobs j, users u " - "where j.owner = u.userid " - "and j.dg_jobid = '%|Ss'",job); - - if ((rows = glite_jp_db_ExecSQL(ctx,qry,&s)) <= 0) { - if (rows == 0) { - err.code = ENOENT; - err.desc = "No records for this job"; - } - else { - err.code = EIO; - err.desc = "DB call fail retrieving job files"; - } - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - if (glite_jp_db_FetchRow(ctx,s,sizeof(col)/sizeof(col[0]), NULL, col) < 0) { - err.code = EIO; - err.desc = "DB call fail retrieving job files"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - *owner = col[0]; - tv_reg->tv_sec = glite_lbu_DBToTime(col[1]); - tv_reg->tv_usec = 0; - free(col[1]); - -cleanup: - free(qry); - if (s) glite_jp_db_FreeStmt(&s); - return err.code; -} - -int glite_jppsbe_get_job_metadata( - glite_jp_context_t ctx, - const char *job, - glite_jp_attrval_t attrs_inout[] -) -{ - int got_info = 0; - struct timeval tv_reg; - char *owner = NULL; - int i,j; - glite_jp_error_t err; - - assert(job != NULL); - assert(attrs_inout != NULL); - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - for (i = 0; attrs_inout[i].name; i++) { -/* must be implemented via filetype plugin - case GLITE_JP_ATTR_TIME: - case GLITE_JP_ATTR_TAG: -*/ - if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_OWNER) - || !strcmp(attrs_inout[i].name,GLITE_JP_ATTR_REGTIME)) { - if (!got_info) { - if (get_job_info(ctx, job, &owner, &tv_reg)) { - err.code = ctx->error->code; - err.desc = "Cannot retrieve job info"; - goto error_out; - } - got_info = 1; - } - } - else { - err.code = EINVAL; - err.desc = "Invalid attribute type"; - goto error_out; - break; - } - - if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_OWNER)) { - attrs_inout[i].value = strdup(owner); - if (!attrs_inout[i].value) { - err.code = ENOMEM; - err.desc = "Cannot copy owner string"; - goto error_out; - } - attrs_inout[i].origin = GLITE_JP_ATTR_ORIG_SYSTEM; - attrs_inout[i].origin_detail = NULL; - - /* XXX */ - attrs_inout[i].timestamp = tv_reg.tv_sec; - } - - if (!strcmp(attrs_inout[i].name,GLITE_JP_ATTR_REGTIME)) { - trio_asprintf(&attrs_inout[i].value,"%ld.%06ld",tv_reg.tv_sec,tv_reg.tv_usec); - attrs_inout[i].origin = GLITE_JP_ATTR_ORIG_SYSTEM; - attrs_inout[i].origin_detail = NULL; - attrs_inout[i].timestamp = tv_reg.tv_sec; - } - -/* must be implemented via filetype plugin - case GLITE_JP_ATTR_TIME: - case GLITE_JP_ATTR_TAG: -*/ - } - -error_out: - free(owner); - if (err.code) { - while (i > 0) { - i--; - glite_jp_attrval_free(attrs_inout+i,0); - } - return glite_jp_stack_error(ctx,&err); - } else { - return 0; - } -} -static int compare_timeval(struct timeval a, struct timeval b) -{ - if (a.tv_sec < b.tv_sec) return -1; - if (a.tv_sec > b.tv_sec) return 1; - if (a.tv_usec < b.tv_usec) return -1; - if (a.tv_usec > b.tv_usec) return 1; - return 0; -} - - -int glite_jppsbe_query( - glite_jp_context_t ctx, - const glite_jp_query_rec_t query[], - char * attrs[], - void *arg, - int (*callback)( - glite_jp_context_t ctx, - const char *job, - const glite_jp_attrval_t metadata[], - void *arg - ) -) -{ - glite_jp_error_t err; - int i,ret; - int quser = 0; - char *where = NULL,*stmt = NULL,*aux = NULL, *cols = NULL; - char *qres[3] = { NULL, NULL, NULL }; - int cmask = 0, owner_idx = -1, reg_idx = -1; - glite_lbu_Statement q = NULL; - glite_jp_attrval_t metadata[3]; - - memset(&err,0,sizeof err); - glite_jp_clear_error(ctx); - err.source = __FUNCTION__; - - /* XXX: assuming not more than 2 */ - memset(metadata,0, sizeof metadata); - - /* XXX: const discarding is OK */ - for (i=0;attrs[i]; i++) { - assert(i<2); - metadata[i].name = (char *) attrs[i]; - } - - for (i=0; query[i].attr; i++) { - char *qitem; - - /* XXX: don't assert() */ - assert(!query[i].binary); - - if (!strcmp(query[i].attr,GLITE_JP_ATTR_OWNER)) { - switch (query[i].op) { - case GLITE_JP_QUERYOP_EQUAL: - quser = 1; - trio_asprintf(&qitem,"u.cert_subj = '%|Ss'",query[i].value); - break; - default: - err.code = EINVAL; - err.desc = "only = allowed for owner queries"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - } - else if (!strcmp(query[i].attr,GLITE_JP_ATTR_REGTIME)) { - time_t t = glite_jp_attr2time(query[i].value); - char *t1,*t2 = NULL; - - glite_lbu_TimeToDB(t, &t1); - switch (query[i].op) { - case GLITE_JP_QUERYOP_EQUAL: - trio_asprintf(&qitem,"j.reg_time = %s",t1); - break; - case GLITE_JP_QUERYOP_UNEQUAL: - trio_asprintf(&qitem,"j.reg_time != %s",t1); - break; - case GLITE_JP_QUERYOP_LESS: - trio_asprintf(&qitem,"j.reg_time < %s",t1); - break; - case GLITE_JP_QUERYOP_GREATER: - trio_asprintf(&qitem,"j.reg_time > %s",t1); - break; - case GLITE_JP_QUERYOP_WITHIN: - free(t2); - glite_lbu_TimeToDB(glite_jp_attr2time(query[i].value2)+1, &t2); - trio_asprintf(&qitem,"j.reg_time >= %s and j.reg_time <= %s",t1,t2); - break; - default: - err.code = EINVAL; - err.desc = "invalid query op"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - free(t1); - free(t2); - } - trio_asprintf(&aux,"%s%s%s",where ? where : "",where ? " and " : "", qitem); - free(where); - free(qitem); - where = aux; - aux = NULL; - } - - for (i=0; metadata[i].name; i++) { - assert (i<2); /* XXX: should never happen */ - - if (!strcmp(metadata[i].name,GLITE_JP_ATTR_OWNER)) { - quser = 1; - cmask |= 1; - owner_idx = i; - } - else if (!strcmp(metadata[i].name,GLITE_JP_ATTR_REGTIME)) { - cmask |= 2; - reg_idx = i; - } - else { - err.code = EINVAL; - err.desc = "invalid query column"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - } - switch (cmask) { - case 1: cols = "j.dg_jobid,u.cert_subj"; break; - case 2: cols = "j.dg_jobid,j.reg_time"; break; - case 3: cols = "j.dg_jobid,u.cert_subj,j.reg_time"; break; - } - - trio_asprintf(&stmt,"select %s from jobs j%s where %s %s", - cols, - quser ? ",users u" : "", - where, - cmask & 1 ? "and u.userid = j.owner" : ""); - - if ((ret = glite_jp_db_ExecSQL(ctx,stmt,&q)) < 0) { - err.code = EIO; - err.desc = "DB call fail"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - else if (ret == 0) { - err.code = ENOENT; - err.desc = "no matching jobs"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - while ((ret = glite_jp_db_FetchRow(ctx,q,sizeof(qres)/sizeof(qres[0]), NULL, qres)) > 0) { - if (cmask & 1) { - /* XXX: owner always first */ - metadata[owner_idx].value = qres[1]; - metadata[owner_idx].origin = GLITE_JP_ATTR_ORIG_SYSTEM; - qres[1] = NULL; - } - if (cmask & 2) { - int qi = cmask == 2 ? 1 : 2; - time_t t = glite_lbu_DBToTime(qres[qi]); - metadata[reg_idx].value = glite_jp_time2attr(t); - metadata[reg_idx].origin = GLITE_JP_ATTR_ORIG_SYSTEM; - free(qres[qi]); - qres[qi] = NULL; - } - if (callback(ctx,qres[0],metadata,arg)) { - err.code = EIO; - err.desc = qres[0]; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - free(qres[0]); - free(metadata[0].value); - free(metadata[1].value); - qres[0] = metadata[0].value = metadata[1].value = NULL; - } - - - if (ret < 0) { - err.code = EIO; - err.desc = "DB call fail"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - -cleanup: - free(where); - free(aux); - free(stmt); - free(qres[0]); free(qres[1]); free(qres[2]); - free(metadata[0].value); free(metadata[1].value); - if (q) glite_jp_db_FreeStmt(&q); - - return err.code; -} - - -int glite_jppsbe_is_metadata(glite_jp_context_t ctx,const char *attr) -{ - /* XXX: should be more */ - if (!strcmp(attr,GLITE_JP_ATTR_OWNER)) return 1; - if (!strcmp(attr,GLITE_JP_ATTR_REGTIME)) return 1; - - return 0; -} - - -int glite_jppsbe_get_names( - glite_jp_context_t ctx, - const char *job, - const char *class, - char ***names_out -) -{ - char *qry = NULL,*file = NULL,*dot; - char **out = NULL; - glite_lbu_Statement s = NULL; - int rows,nout = 0; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - trio_asprintf(&qry,"select filename from files f,jobs j " - "where j.dg_jobid = '%|Ss' and j.jobid = f.jobid and f.state = 'committed'",job); - - if ((rows = glite_jp_db_ExecSQL(ctx,qry,&s)) <= 0) { - if (rows == 0) { - err.code = ENOENT; - err.desc = "No files for this job"; - } - else { - err.code = EIO; - err.desc = "DB call fail retrieving job files"; - } - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - while ((rows = glite_jp_db_FetchRow(ctx,s,1,NULL,&file))) { - if (rows < 0) { - err.code = EIO; - err.desc = "DB call fail retrieving job files"; - goto cleanup; - } - - dot = strchr(file,'.'); /* XXX: can class contain dot? */ - - if (dot) *dot = 0; - out = realloc(out,(nout+1) * sizeof *out); - if (!strcmp(file,class)) out[nout++] = dot ? dot+1 : NULL; - - free(file); - file = NULL; - } - -cleanup: - if (s) glite_jp_db_FreeStmt(&s); - free(qry); - free(file); - - if (ctx->error) { - int i; - for (i=0; out && out[i]; i++) free(out[i]); - free(out); - return -ctx->error->code; - } - - if (nout) *names_out = out; - return nout; -} - - -/** mark the job as sent to this feed */ -int glite_jppsbe_set_fed( - glite_jp_context_t ctx, - const char *feed, - const char *job -) -{ - char *stmt = NULL,*u = NULL; - int rows,ret; - glite_jp_error_t err; - memset(&err,0,sizeof err); - - if ((ret = jobid_unique_pathname(ctx,job,&u,NULL,0))) return ret; - - trio_asprintf(&stmt,"insert into fed_jobs(feedid,jobid) " - "values ('%|Ss','%|Ss')", feed,u); - free(u); - - if ((rows = glite_jp_db_ExecSQL(ctx,stmt,NULL)) < 0) { - err.source = __FUNCTION__; - err.code = EIO; - err.desc = "insert into fed_jobs"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - if (rows != 1) { - err.source = __FUNCTION__; - err.code = EIO; - err.desc = "inserted rows != 1"; - glite_jp_stack_error(ctx,&err); - } - -cleanup: - free(stmt); - return err.code; -} - - -/** check whether the job has been already sent to this feed */ -int glite_jppsbe_check_fed( - glite_jp_context_t ctx, - const char *feed, - const char *job, - int *result -) -{ - char *stmt = NULL,*u = NULL; - int rows,ret; - glite_jp_error_t err; - memset(&err,0,sizeof err); - - if ((ret = jobid_unique_pathname(ctx,job,&u,NULL,0))) return ret; - - trio_asprintf(&stmt,"select 'x' from fed_jobs " - "where jobid = '%|Ss' and feedid = '%|Ss'", - u,feed); - - free(u); - - if ((rows = glite_jp_db_ExecSQL(ctx,stmt,NULL)) < 0) { - err.source = __FUNCTION__; - err.code = EIO; - err.desc = "select from fed_jobs"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - *result = rows; - -cleanup: - free(stmt); - return err.code; -} - - -/** store the feed to database */ -int glite_jppsbe_store_feed( - glite_jp_context_t ctx, - struct jpfeed *feed -) -{ - char *stmt,*aux,*alist,*qlist,*e; - int i,rows; - glite_jp_error_t err; - - memset(&err,0,sizeof err); - - qlist = alist = stmt = aux = e = NULL; - - for (i=0; feed->attrs[i]; i++) { - char *e; - trio_asprintf(&aux,"%s%s%s", - alist ? alist : "", - alist ? "\n" : "", - e = glite_lbu_EscapeULM(feed->attrs[i])); - free(e); - free(alist); - alist = aux; - aux = NULL; - } - - for (i=0; feed->qry[i].attr; i++) { - char op,*e1,*e2 = NULL; - - /* XXX */ - assert(!feed->qry[i].binary); - - switch (feed->qry[i].op) { - case GLITE_JP_QUERYOP_EQUAL: op = '='; break; - case GLITE_JP_QUERYOP_UNEQUAL: op = '!'; break; - case GLITE_JP_QUERYOP_LESS: op = '<'; break; - case GLITE_JP_QUERYOP_GREATER: op = '>'; break; - case GLITE_JP_QUERYOP_EXISTS: op = 'E'; break; - default: abort(); /* XXX */ - } - - trio_asprintf(&aux,"%s%s%s\n%c\n%s", - qlist ? qlist : "", - qlist ? "\n" : "", - e1 = glite_lbu_EscapeULM(feed->qry[i].attr), - op, - op != 'E' ? e2 = glite_lbu_EscapeULM(feed->qry[i].value) : "E"); - free(e1); free(e2); - - free(qlist); - qlist = aux; - aux = NULL; - } - - glite_lbu_TimeToDB(feed->expires, &e); - trio_asprintf(&stmt,"insert into feeds(feedid,destination,expires,cols,query) " - "values ('%|Ss','%|Ss',%s,'%|Ss','%|Ss')", - feed->id,feed->destination, - e, - alist,qlist); - - free(alist); free(qlist); free(e); - - if ((rows = glite_jp_db_ExecSQL(ctx,stmt,NULL)) < 0) { - err.source = __FUNCTION__; - err.code = EIO; - err.desc = "insert into fed_jobs"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - if (rows != 1) { - err.source = __FUNCTION__; - err.code = EIO; - err.desc = "inserted rows != 1"; - glite_jp_stack_error(ctx,&err); - } - -cleanup: - free(stmt); - return err.code; - -} - -int glite_jppsbe_refresh_feed( - glite_jp_context_t ctx, - char *feed_id, - time_t expires -) -{ - glite_jp_error_t err; - memset(&err,0,sizeof err); - - char *stmt = NULL; - char *e = NULL; - glite_lbu_TimeToDB(expires, &e); - trio_asprintf(&stmt, "update feeds set expires=%s where feedid='%s'", - e, feed_id); - if (!stmt) { - err.code = ENOMEM; - goto error_out; - } - - if (glite_jp_db_ExecSQL(ctx, stmt, NULL) < 0) { - err.code = EIO; - err.desc = "DB access failed"; - goto error_out; - } - -error_out: - free(stmt); - free(e); - if (err.code) - return glite_jp_stack_error(ctx,&err); - else - return 0; -} - -/** purge expired feeds */ -int glite_jppsbe_purge_feeds( - glite_jp_context_t ctx -) -{ - char *stmt = NULL,*feed = NULL; - char *expires; - glite_jp_error_t err; - glite_lbu_Statement q = NULL; - int rows; - - glite_lbu_TimeToDB(time(NULL), &expires); - memset(&err,0,sizeof err); - - trio_asprintf(&stmt,"select feedid from feeds where expires < %s",expires); - - if ((rows = glite_jp_db_ExecSQL(ctx, stmt, &q)) < 0) { - err.code = EIO; - err.desc = "select from feeds"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - while ((rows = glite_jp_db_FetchRow(ctx,q,1,NULL,&feed)) > 0) { - printf("feed %s has expired.\n", feed); - free(stmt); - trio_asprintf(&stmt,"delete from fed_jobs where feedid = '%|Ss'",feed); - if ((rows = glite_jp_db_ExecSQL(ctx, stmt, NULL)) < 0) { - err.code = EIO; - err.desc = "delete from fed_jobs"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - } - - free(stmt); - trio_asprintf(&stmt,"delete from feeds where expires < %s",expires); - if ((rows = glite_jp_db_ExecSQL(ctx, stmt, NULL)) < 0) { - err.code = EIO; - err.desc = "select from feeds"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - -cleanup: - glite_jp_db_FreeStmt(&q); - free(feed); - free(stmt); - free(expires); - return err.code; -} - - -/** read stored feed into context */ -int glite_jppsbe_read_feeds( - glite_jp_context_t ctx -) -{ - char *stmt,*res[5],*expires; - glite_jp_error_t err; - glite_lbu_Statement q = NULL; - int rows; - - stmt = expires = NULL; - memset(&err,0,sizeof err); - memset(&res,0,sizeof res); - err.source = __FUNCTION__; - - glite_lbu_TimeToDB(time(NULL), &expires); - trio_asprintf(&stmt,"select feedid,destination,expires,cols,query " - "from feeds " - "where expires > %s",expires); - free(expires); expires = NULL; - - if ((rows = glite_jp_db_ExecSQL(ctx, stmt, &q)) < 0) { - err.code = EIO; - err.desc = "select from feeds"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - free(stmt); - - while ((rows = glite_jp_db_FetchRow(ctx,q,sizeof(res)/sizeof(res[0]),NULL, res)) > 0) { - struct jpfeed *f = calloc(1,sizeof *f); - int n; - char *p; - - f->id = res[0]; res[0] = NULL; - f->destination = res[1]; res[1] = NULL; - f->expires = glite_lbu_DBToTime(res[2]); free(res[2]); res[2] = NULL; - - n = 0; - for (p = strtok(res[3],"\n"); p; p = strtok(NULL,"\n")) { - f->attrs = realloc(f->attrs,(n+2) * sizeof *f->attrs); - f->attrs[n] = glite_lbu_UnescapeULM(p); - f->attrs[++n] = NULL; - } - - n = 0; - for (p = strtok(res[4],"\n"); p; p = strtok(NULL,"\n")) { - f->qry = realloc(f->qry,(n+2) * sizeof *f->qry); - memset(&f->qry[n],0,sizeof *f->qry); - f->qry[n].attr = glite_lbu_EscapeULM(p); - p = strtok(NULL,"\n"); - switch (*p) { - case '=': f->qry[n].op = GLITE_JP_QUERYOP_EQUAL; break; - case '<': f->qry[n].op = GLITE_JP_QUERYOP_LESS; break; - case '>': f->qry[n].op = GLITE_JP_QUERYOP_GREATER; break; - case '!': f->qry[n].op = GLITE_JP_QUERYOP_UNEQUAL; break; - case 'E': f->qry[n].op = GLITE_JP_QUERYOP_EXISTS; break; - default: abort(); /* XXX: internal inconsistency */ - } - p = strtok(NULL,"\n"); - if (f->qry[n].op != GLITE_JP_QUERYOP_EXISTS) - f->qry[n].value = glite_lbu_EscapeULM(p); - - memset(&f->qry[++n],0,sizeof *f->qry); - } - f->next = ctx->feeds; - ctx->feeds = f; - } - - if (rows < 0) { - err.code = EIO; - err.desc = "fetch from feeds"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - -cleanup: - glite_jp_db_FreeStmt(&q); - free(res[0]); free(res[1]); free(res[2]); free(res[3]); free(res[4]); - return err.code; -} - -int glite_jppsbe_append_tags( - void *fpctx, - char *jobid, - glite_jp_attrval_t *attr -) -{ - void *file_be; - glite_jp_error_t err; - glite_jp_context_t ctx = fpctx; - int i; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (glite_jppsbe_open_file(ctx,jobid,"tags",NULL, - O_RDWR|O_CREAT,&file_be) - // XXX: tags need reading to check magic number - ) { - err.code = EIO; - err.desc = "cannot open tags file"; - return glite_jp_stack_error(ctx,&err); - } - - for (i=0; attr[i].name; i++) { - if (tag_append(ctx,file_be,attr+i)) - { - glite_jp_error_t *e = ctx->error; - err.code = EIO; - err.desc = "cannot append tag"; - - glite_jppsbe_close_file(ctx,file_be); - glite_jp_clear_error(ctx); - ctx->error = e; - - return glite_jp_stack_error(ctx,&err); - } - } - - if (glite_jppsbe_close_file(ctx,file_be)) - { - err.code = EIO; - err.desc = "cannot close tags file"; - return glite_jp_stack_error(ctx,&err); - } - - return 0; -} - - -int glite_jppsbe_read_tag( - void *fpctx, - const char *jobid, - const char *attr, - glite_jp_attrval_t **attrval -) -{ - glite_jp_error_t err; - glite_jp_context_t ctx = fpctx; - struct tags_handle *h; - int i; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - h = malloc(sizeof (*h)); - h->tags = NULL; - h->n = 0; - - if (glite_jppsbe_open_file(ctx,jobid,"tags",NULL, - O_RDONLY,&(h->bhandle)) - // XXX: tags need reading to check magic number - ) { - err.code = EIO; - err.desc = "cannot open tags file"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - - if (tag_attr(ctx,h,attr,attrval)){ - glite_jp_error_t *e; - err.code = EIO; - err.desc = "cannot read tag"; - glite_jp_stack_error(ctx,&err); - e = ctx->error; - ctx->error = NULL; - glite_jppsbe_close_file(ctx,h->bhandle); - ctx->error = e; - goto cleanup; - } - - if (glite_jppsbe_close_file(ctx,h->bhandle)) - { - err.code = EIO; - err.desc = "cannot close tags file"; - glite_jp_stack_error(ctx,&err); - goto cleanup; - } - -cleanup: - for (i=0; i < h->n; i++){ - free(h->tags[i].name); - free(h->tags[i].value); - } - free(h->tags); - free(h); - - return err.code; -} - - - -/* XXX: -- no primary authorization yet -- no concurrency control yet -- partial success in pwrite,append -- "unique" part of jobid is assumed to be unique across bookkeeping servers -- repository versioning not fully implemented yet -*/ diff --git a/org.glite.jp.primary/src/sandbox_plugin.c b/org.glite.jp.primary/src/sandbox_plugin.c deleted file mode 100644 index 89ba7a6..0000000 --- a/org.glite.jp.primary/src/sandbox_plugin.c +++ /dev/null @@ -1,280 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include "glite/jp/backend.h" - -#include "glite/jp/file_plugin.h" -#include "glite/jp/builtin_plugins.h" - -#define ALLOC_CHUNK 3 - - -typedef struct _sb_handle { - void *bhandle; - TAR *t; - tartype_t *tt; - char **file_names; -} sb_handle; - -// Global data needed for read/write wrappers -static struct { - void *bhandle; - glite_jp_context_t ctx; - off_t offset; -} global_data; - - -//static int sandbox_append(void *,void *,int,...); -static int sandbox_open(void *,void *,const char *uri,void **); -static int sandbox_close(void *,void *); -static int sandbox_attr(void *,void *,const char *,glite_jp_attrval_t **); -static int sandbox_filecom(void *,void *); - -int init(glite_jp_context_t ctx, glite_jpps_fplug_data_t *data) -{ - data->fpctx = ctx; - global_data.ctx = ctx; - - data->uris = calloc(2,sizeof *data->uris); - data->uris[0] = strdup(GLITE_JP_FILETYPE_ISB); - - data->classes = calloc(2,sizeof *data->classes); - data->classes[0] = strdup("sandbox"); - - data->namespaces = calloc(5, sizeof *data->namespaces); - data->namespaces[0] = strdup(GLITE_JP_ISB_NS); - data->namespaces[1] = strdup(GLITE_JP_OSB_NS); - data->namespaces[2] = strdup(GLITE_JP_ISB_CONTENT_NS); - data->namespaces[3] = strdup(GLITE_JP_OSB_CONTENT_NS); - - data->ops.open = sandbox_open; - data->ops.close = sandbox_close; - data->ops.attr = sandbox_attr; - data->ops.filecom = sandbox_filecom; - - printf("sandbox_plugin: URI: \"%s\"\n",GLITE_JP_FILETYPE_ISB); - - return 0; -} - - -/** -* Wrappers for tar_open -*/ -static int my_open(const char *pathname, int flags, ...) { - // Do not open file, it is opened in ftp_backend - // returned fd does not matter, read/write/close does ftp_backend - return 12345; -} - -static int my_close(int fd) { - // Closed in ftp_backend - return 0; -} - -static ssize_t my_read(int fd, void *buf, size_t count) { - // wrapper around glite_jppsbe_pread - size_t r; - - if (glite_jppsbe_pread(global_data.ctx,global_data.bhandle,buf,count,global_data.offset,&r)) { - errno = global_data.ctx->error->code; - return -1; - } - - global_data.offset += r; - - return r; -} - -static ssize_t my_write(int fd, const void *buf, size_t count) { - // wrapper around glite_jppsbe_pwrite - // just stub, not needed here&now -} - - - -static int sandbox_open(void *fpctx,void *bhandle,const char *uri,void **handle) -{ - sb_handle *h = calloc(1,sizeof *h); - - - printf("sandbox_open() called\n"); - - h->bhandle = bhandle; - global_data.bhandle = bhandle; - global_data.offset = 0; - - h->tt = malloc(sizeof(*h->tt)); - h->tt->openfunc = my_open; - h->tt->closefunc = my_close; - h->tt->readfunc = my_read; - h->tt->writefunc = my_write; - - if (tar_open(&h->t, NULL /* not needed, opened in ftp_backend */, h->tt, O_RDONLY, 0, TAR_GNU) == -1) - printf("tar_open()\n"); //XXX: use glite_jp_stack_error - - *handle = h; - - return 0; -} - - -static int sandbox_close(void *fpctx,void *handle) -{ - int i; - sb_handle *h = handle; - - tar_close(h->t); - free(h->tt); - - for (i=0; h->file_names; i++) free(h->file_names[i]); - free(h->file_names); - - free(h); - - printf("sandbox_close() called\n"); - - return 0; -} - - -static int sandbox_attr(void *fpctx,void *handle,const char *attr,glite_jp_attrval_t **attrval) -{ - glite_jp_error_t err; - glite_jp_context_t ctx = fpctx; - glite_jp_attrval_t *out = NULL; - int i,nout = 0, count = 0; - sb_handle *h = handle; - - - printf("sandbox_attr() called\n"); - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - glite_jp_clear_error(ctx); - - *attrval = NULL; - - if (!strcmp(attr, GLITE_JP_ATTR_ISB_FILENAME)) { - while ((i = th_read(h->t)) == 0) - { - printf("-- %s\n", th_get_pathname(h->t)); - - if ( !(count % ALLOC_CHUNK) ) { - *attrval = realloc(*attrval, (count + ALLOC_CHUNK + 1) * sizeof(**attrval) ); - memset( (*attrval) + count, 0, (ALLOC_CHUNK + 1) * sizeof(**attrval)); - } - (*attrval)[count].name = strdup(GLITE_JP_ATTR_ISB_FILENAME); - (*attrval)[count].value = strdup(th_get_pathname(h->t)); - (*attrval)[count].origin = GLITE_JP_ATTR_ORIG_FILE; - (*attrval)[count].timestamp = th_get_mtime(h->t); - - count++; - - if (TH_ISREG(h->t) && tar_skip_regfile(h->t) != 0) - { - err.code = EIO; - err.desc = "tar_skip_regfile"; - return glite_jp_stack_error(ctx,&err); - } - } - } - else if (!strcmp(attr, GLITE_JP_ATTR_OSB_FILENAME)) { - printf("Namespace %s not implemented yet\n", GLITE_JP_ATTR_OSB_FILENAME); - } - else if (strstr(attr,GLITE_JP_OSB_CONTENT_NS)) { - printf("Namespace %s not implemented yet\n", GLITE_JP_OSB_CONTENT_NS); - } - else if (strstr(attr,GLITE_JP_ISB_CONTENT_NS)) { - char *fileName = (char *) attr + sizeof(GLITE_JP_ISB_CONTENT_NS); - - printf("untaring file: %s\n", fileName); - - while (th_read(h->t) == 0) - { - if ( !strcmp(fileName, th_get_pathname(h->t)) ) { - /* extract the file */ - int k; - size_t size; - char buf[T_BLOCKSIZE]; - char *value; - - - if (!TH_ISREG(h->t)) assert(0); // not a regular file - - size = th_get_size(h->t); - value = (char *) malloc(size * sizeof(char) + 1); - memset( value, 0, size * sizeof(char) + 1); - - for (i = 0; i < size; i += T_BLOCKSIZE) - { - k = tar_block_read(h->t, buf); - if (k == -1) - { - err.code = errno; - err.desc = "tar_block_read"; - return glite_jp_stack_error(ctx,&err); - } - - // tar_block_read calls glite_jppsbe_pread, which usually - // returns whole block (read from the middle of uploaded - // tar file - // so cut k in order to the last chunk had correct size - if (i + T_BLOCKSIZE > size) { - k = size - i; - } - - strncpy(value + i, buf, k); - } - *attrval = malloc(2 * sizeof(**attrval) ); - memset( (*attrval), 0, 2 * sizeof(**attrval)); - - (*attrval)[0].name = strdup(attr); - (*attrval)[0].value = value; - (*attrval)[0].origin = GLITE_JP_ATTR_ORIG_FILE; - (*attrval)[0].timestamp = th_get_mtime(h->t); - } - else if (TH_ISREG(h->t) && tar_skip_regfile(h->t) != 0) - { - err.code = EIO; - err.desc = "tar_skip_regfile"; - return glite_jp_stack_error(ctx,&err); - } - } - } - - return glite_jp_stack_error(ctx,&err); -} - -static int sandbox_filecom(void *fpctx,void *handle){ - return -1; -} - diff --git a/org.glite.jp.primary/src/simple_server.c b/org.glite.jp.primary/src/simple_server.c deleted file mode 100644 index 3ce025d..0000000 --- a/org.glite.jp.primary/src/simple_server.c +++ /dev/null @@ -1,76 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include - -#include "glite/jp/types.h" -#include "glite/jp/context.h" - -#include "jpps_H.h" - -extern SOAP_NMAC struct Namespace jpis__namespaces[],jpps__namespaces[]; - -int main(int argc, char *argv[]) { - struct soap soap; - int i, m, s; // master and slave sockets - - glite_jp_context_t ctx; - - soap_init(&soap); - soap_set_namespaces(&soap, jpps__namespaces); - - glite_jp_init_context(&ctx); - - if (glite_jppsbe_init(ctx, &argc, argv)) { - /* XXX log */ - fputs(glite_jp_error_chain(ctx), stderr); - exit(1); - } - - soap.user = (void *) ctx; - - ctx->other_soap = soap_new(); - soap_init(ctx->other_soap); - soap_set_namespaces(ctx->other_soap,jpis__namespaces); - - srand48(time(NULL)); /* feed id generation */ - - m = soap_bind(&soap, NULL, 8901, 100); - if (m < 0) - soap_print_fault(&soap, stderr); - else - { - fprintf(stderr, "Socket connection successful: master socket = %d\n", m); - for (i = 1; ; i++) { - s = soap_accept(&soap); - if (s < 0) { - soap_print_fault(&soap, stderr); - break; - } - jpps__serve(&soap); // process RPC request - soap_destroy(&soap); // clean up class instances - soap_end(&soap); // clean up everything and close socket - glite_jp_run_deferred(ctx); - } - } - soap_done(&soap); // close master socket - - return 0; -} - -/* XXX: we don't use it */ -SOAP_NMAC struct Namespace namespaces[] = { {NULL,NULL} }; diff --git a/org.glite.jp.primary/src/soap_ops.c b/org.glite.jp.primary/src/soap_ops.c deleted file mode 100644 index 87ab088..0000000 --- a/org.glite.jp.primary/src/soap_ops.c +++ /dev/null @@ -1,620 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#undef SOAP_FMAC1 -#define SOAP_FMAC1 static - -#include - -#include "glite/jp/types.h" -#include "glite/jp/context.h" -#include "glite/jp/attr.h" -#include "glite/jp/known_attr.h" - -#include "feed.h" -#include "attrs.h" - -#include "jptype_map.h" -#include "glite/security/glite_gscompat.h" - -#include "glite/jp/file_plugin.h" -#include "glite/jp/builtin_plugins.h" - -/* the same as ServerLib.c but without WITH_NOGLOBAL which breaks the soap_env_ctx trick */ -#define SOAP_FMAC3 static -#include "jpps_C.c" -#include "jpps_Server.c" - -#include "jpps_.nsmap" - -#include "soap_env_ctx.h" -#include "soap_env_ctx.c" - -#include "glite/jp/ws_fault.c" -#include "soap_util.c" - -#define err2fault(CTX, SOAP) glite_jp_server_err2fault((CTX), (SOAP)); - -#define CONTEXT_FROM_SOAP(soap,ctx) glite_jp_context_t ctx = (glite_jp_context_t) ((soap)->user) - -#define SIZE_TO_COMPRESS 1024 - -int glite_jpps_srv_init(glite_jp_context_t ctx) -{ - glite_jp_soap_env_ctx = &my_soap_env_ctx; - return 0; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RegisterJob( - struct soap *soap, - struct _jpelem__RegisterJob *in, - struct _jpelem__RegisterJobResponse *empty) -{ - CONTEXT_FROM_SOAP(soap,ctx); - glite_jp_attrval_t owner_val[2]; - - printf("%s %s %s\n",__FUNCTION__,in->job,in->owner); - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__RegisterJob,in->job,in->owner) || - glite_jppsbe_register_job(ctx,in->job,in->owner)) - { - err2fault(ctx,soap); - return SOAP_FAULT; - } - - memset(owner_val, 0, 2 * sizeof(glite_jp_attrval_t)); - owner_val[0].name = GLITE_JP_ATTR_OWNER; - owner_val[0].value = in->owner; - owner_val[0].origin = GLITE_JP_ATTR_ORIG_SYSTEM; - owner_val[0].timestamp = time(NULL); - owner_val[0].origin_detail = NULL; - owner_val[1].name = NULL; - -/* XXX: errrors should be ingored but not silently */ - glite_jpps_match_attr(ctx,in->job,owner_val); - - return SOAP_OK; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__StartUpload( - struct soap *soap, - struct _jpelem__StartUpload *in, - struct _jpelem__StartUploadResponse *out) -{ - CONTEXT_FROM_SOAP(soap,ctx); - char *destination; - time_t commit_before = in->commitBefore; - glite_jp_error_t err; - glite_jpps_fplug_data_t **pd = NULL; - int i; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__StartUpload,NULL,NULL)) { - err2fault(ctx,soap); - return SOAP_FAULT; - } - - switch (glite_jpps_fplug_lookup(ctx,in->class_,&pd)) { - case ENOENT: - err.code = ENOENT; - err.source = __FUNCTION__; - err.desc = "unknown file class"; - glite_jp_stack_error(ctx,&err); - err2fault(ctx,soap); - return SOAP_FAULT; - case 0: break; - default: - err2fault(ctx,soap); - return SOAP_FAULT; - } - - for (i=0; pd[0]->uris[i] && strcmp(pd[0]->uris[i],in->class_); i++); - assert(pd[0]->uris[i]); - - if (glite_jppsbe_start_upload(ctx,in->job,pd[0]->classes[i],in->name,in->contentType, - &destination,&commit_before)) - { - err2fault(ctx,soap); - free(pd); - return SOAP_FAULT; - } - - out->destination = soap_strdup(soap,destination); - free(destination); - out->commitBefore = commit_before; - - free(pd); - return SOAP_OK; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__CommitUpload( - struct soap *soap, - struct _jpelem__CommitUpload *in, - struct _jpelem__CommitUploadResponse *out) -{ - CONTEXT_FROM_SOAP(soap,ctx); - char *job,*class,*name; - - job = class = name = NULL; - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__CommitUpload,NULL,NULL) || - glite_jppsbe_commit_upload(ctx,in->destination)) - { - err2fault(ctx,soap); - return SOAP_FAULT; - } - - /* XXX: should not fail when commit_upload was OK */ - assert(glite_jppsbe_destination_info(ctx,in->destination,&job,&class,&name) == 0); - - /* XXX: ignore errors but don't fail silenty */ - glite_jpps_match_file(ctx,job,class,name); - - // apply plugins to commited file - glite_jpps_fplug_data_t *pd; - int i, j; - void *beh, *ph; - if (ctx->plugins) - for (i = 0; ctx->plugins[i]; i++) { - pd = ctx->plugins[i]; - if (pd->classes) - for (j = 0; pd->classes[j]; j++) - if (strcmp(class, pd->classes[j]) == 0){ - if (! glite_jppsbe_open_file(ctx,job,class, name, O_RDONLY, &beh)) { - if (!pd->ops.open(pd->fpctx,beh,pd->uris[j],&ph)) { - pd->ops.filecom(pd->fpctx, ph); - pd->ops.close(pd->fpctx, ph); - } - glite_jppsbe_close_file(ctx,beh); - } - - } - } - - char *fname; - //XXX ignore error - if (!glite_jppsbe_open_file(ctx,job,class, name, O_RDONLY, &beh)){ - struct stat fattr; - glite_jppsbe_file_attrs(ctx, beh, &fattr); - glite_jppsbe_close_file(ctx, beh); - if (fattr.st_size > SIZE_TO_COMPRESS) - glite_jppsbe_compress_and_remove_file(ctx,job,class, name); - } - - free(job); free(class); free(name); - - return SOAP_OK; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordTag( - struct soap *soap, - struct _jpelem__RecordTag *in, - struct _jpelem__RecordTagResponse *out) -{ - CONTEXT_FROM_SOAP(soap,ctx); - void *file_be,*file_p; - glite_jp_attrval_t attr[2], meta[2]; - - file_be = file_p = NULL; - - memset(attr, 0, 2 * sizeof(glite_jp_attrval_t)); - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - - if (glite_jppsbe_get_job_metadata(ctx,in->jobid,meta)) { - goto err; - } - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__RecordTag,in->jobid,meta[0].value)) { - goto err; - } - - attr[0].name = in->tag->name; - if (GSOAP_ISSTRING(in->tag->value)) { - attr[0].value = GSOAP_STRING(in->tag->value); - attr[0].binary = 0; - } - else { - attr[0].value = GSOAP_BLOB(in->tag->value)->__ptr; - attr[0].size = GSOAP_BLOB(in->tag->value)->__size; - attr[0].binary = 1; - } - attr[0].origin = GLITE_JP_ATTR_ORIG_USER; - attr[0].timestamp = time(NULL); - attr[0].origin_detail = NULL; /* XXX */ - attr[1].name = NULL; - - if (glite_jppsbe_append_tags(ctx,in->jobid,attr)) goto err; - - /* XXX: ignore errors but don't fail silenty */ - glite_jpps_match_attr(ctx,in->jobid,attr); - - return SOAP_OK; -err: - glite_jp_attrval_free(meta,0); - err2fault(ctx,soap); - return SOAP_FAULT; -} - - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__RecordMultiTags( - struct soap *soap, - struct _jpelem__RecordMultiTags *in, - struct _jpelem__RecordMultiTagsResponse *out -) -{ - CONTEXT_FROM_SOAP(soap,ctx); - int i,j,ret = SOAP_OK; - char **jobs = NULL; - glite_jp_attrval_t **attrs = NULL,meta[2]; - - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - - for (i=0; i__sizejobs; i++) { - struct jptype__jobRecord *jr = GLITE_SECURITY_GSOAP_LIST_GET(in->jobs,i); - - if (glite_jppsbe_get_job_metadata(ctx,jr->jobid,meta)) { - ret = SOAP_FAULT; - goto cleanup; - } - -/* XXX: the same as single tag */ - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__RecordTag,jr->jobid,meta[0].value)) { - ret = SOAP_FAULT; - goto cleanup; - } - - jobs = realloc(jobs,sizeof(*jobs) * (i+2)); - jobs[i] = jr->jobid; - jobs[i+1] = NULL; - - attrs = realloc(attrs,sizeof(*attrs) * (i+2)); - attrs[i] = calloc(jr->__sizeattributes+1,sizeof attrs[i][0]); - attrs[i+1] = NULL; - - for (j=0; j < jr->__sizeattributes; j++) { - struct jptype__attrValue *a = GLITE_SECURITY_GSOAP_LIST_GET(jr->attributes,j); - - attrs[i][j].name = a->name; - if (GSOAP_ISSTRING(a->value)) { - attrs[i][j].value = GSOAP_STRING(a->value); - attrs[i][j].binary = 0; - } - else { - attrs[i][j].value = GSOAP_BLOB(a->value)->__ptr; - attrs[i][j].size = GSOAP_BLOB(a->value)->__size; - attrs[i][j].binary = 1; - } - /* XXX input not favoured */ - attrs[i][j].origin = GLITE_JP_ATTR_ORIG_USER; - attrs[i][j].timestamp = time(NULL); - attrs[i][j].origin_detail = NULL; - } - if (glite_jppsbe_append_tags(ctx,jobs[i],attrs[i])) { - err2fault(ctx,soap); - ret = SOAP_FAULT; - goto cleanup; - } - } - -/* XXX: ignore error */ - glite_jpps_match_attr_multi(ctx,(const char **) jobs,(const glite_jp_attrval_t **) attrs); - -cleanup: - if (attrs) { - for (i=0; attrs[i]; i++) { - for (j=0; attrs[i][j].name; j++) glite_jp_attrval_free(&attrs[i][j],0); - free(attrs[i]); - } - free(attrs); - } - free(jobs); - - glite_jp_attrval_free(meta,0); - if (ret == SOAP_FAULT) err2fault(ctx,soap); - return ret; -} - -static void s2jp_qval(const struct jptype__stringOrBlob *in, char **value, int *binary, size_t *size) -{ - if (GSOAP_ISSTRING(in)) { - *value = GSOAP_STRING(in); - *binary = 0; - *size = 0; - } - else { - assert(GSOAP_BLOB(in)); /* XXX: should report error instead */ - *value = GSOAP_BLOB(in)->__ptr; - *binary = 1; - *size = GSOAP_BLOB(in)->__size; - } -} - -static void s2jp_query(const struct jptype__primaryQuery *in, glite_jp_query_rec_t *out) -{ - int b; - - out->attr = in->attr; - - s2jp_qval(in->value,&out->value,&out->binary,&out->size); - switch (in->op) { - case EQUAL: out->op = GLITE_JP_QUERYOP_EQUAL; break; - case UNEQUAL: out->op = GLITE_JP_QUERYOP_UNEQUAL; break; - case LESS: out->op = GLITE_JP_QUERYOP_LESS; break; - case GREATER: out->op = GLITE_JP_QUERYOP_GREATER; break; - case WITHIN: - out->op = GLITE_JP_QUERYOP_WITHIN; - s2jp_qval(in->value2,&out->value2,&b,&out->size2); - assert(out->binary == b); /* XXX: report error instead */ - - break; - } - - if (in->origin) switch (*in->origin) { - case jptype__attrOrig__SYSTEM: out->origin = GLITE_JP_ATTR_ORIG_SYSTEM; break; - case jptype__attrOrig__USER: out->origin = GLITE_JP_ATTR_ORIG_USER; break; - case jptype__attrOrig__FILE_: out->origin = GLITE_JP_ATTR_ORIG_FILE; break; - } - else out->origin = GLITE_JP_ATTR_ORIG_ANY; -} - - -static int check_sane_feed(glite_jp_context_t ctx,struct _jpelem__FeedIndex *in) -{ - glite_jp_error_t err; - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - err.code = EINVAL; - - if (!in->destination) { - err.desc = "destination required"; - return glite_jp_stack_error(ctx,&err); - } - - return 0; -} - - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndex( - struct soap *soap, - struct _jpelem__FeedIndex *in, - struct _jpelem__FeedIndexResponse *out) -{ - -/* deferred processing: return feed_id to the index server first, - * start feeding it afterwards -- not before the index server actually - * knows feed_id and is ready to accept the feed. - * - * Has to be done within the same server slave, - * passed through the context */ - - CONTEXT_FROM_SOAP(soap,ctx); - char *feed_id = NULL; - time_t expires = 0; - int ret = SOAP_OK; - - char const **attrs = calloc(in->__sizeattributes+1,sizeof *attrs); - glite_jp_query_rec_t *qry = calloc(in->__sizeconditions+1,sizeof *qry); - int i; - - glite_jp_clear_error(ctx); - - if (check_sane_feed(ctx,in)) { - err2fault(ctx,soap); - ret = SOAP_FAULT; - goto cleanup; - } - - memcpy(attrs,in->attributes,sizeof *attrs * in->__sizeattributes); - for (i = 0; i__sizeconditions; i++) s2jp_query(GLITE_SECURITY_GSOAP_LIST_GET(in->conditions, i),qry+i); - - if (in->history) { - if (glite_jpps_run_feed(ctx,in->destination,attrs,qry,in->continuous,&feed_id)) { - err2fault(ctx,soap); - ret = SOAP_FAULT; - goto cleanup; - } - } - - if (in->continuous) { - if (glite_jpps_register_feed(ctx,in->destination,attrs,qry,&feed_id,&expires)) { - err2fault(ctx,soap); - ret = SOAP_FAULT; - goto cleanup; - } - } - - if (!in->history && !in->continuous) { - glite_jp_error_t err; - memset(&err,0,sizeof err); - err.code = EINVAL; - err.source = __FUNCTION__; - err.desc = "at least one of and must be true"; - glite_jp_stack_error(ctx,&err); - err2fault(ctx,soap); - ret = SOAP_FAULT; - goto cleanup; - } - - out->feedExpires = expires; - out->feedId = soap_strdup(soap,feed_id); - -cleanup: - free(feed_id); - free(attrs); - free(qry); - - return ret; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__FeedIndexRefresh( - struct soap *soap, - struct _jpelem__FeedIndexRefresh *in, - struct _jpelem__FeedIndexRefreshResponse *out) -{ - CONTEXT_FROM_SOAP(soap,ctx); - - time_t expires = 0; - int ret = SOAP_OK; - - glite_jp_clear_error(ctx); - - if (glite_jpps_refresh_feed(ctx, in->feedId, &expires)){ - err2fault(ctx,soap); - ret = SOAP_FAULT; - return ret; - } - out->feedExpires = expires; - - return ret; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobFiles( - struct soap *soap, - struct _jpelem__GetJobFiles *in, - struct _jpelem__GetJobFilesResponse *out) -{ - CONTEXT_FROM_SOAP(soap,ctx); - char *url; - - int i,n; - glite_jp_error_t err; - void **pd; - struct jptype__jppsFile *f = NULL; - glite_jp_attrval_t meta[2]; - - memset(&err,0,sizeof err); - n = 0; - - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - - if (glite_jppsbe_get_job_metadata(ctx,in->jobid,meta)) { - goto err; - } - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobFiles,in->jobid,meta[0].value)) { - goto err; - } - - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - - if (glite_jppsbe_get_job_metadata(ctx,in->jobid,meta)) { - goto err; - } - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobFiles,in->jobid,meta[0].value)) { - goto err; - } - - for (pd = ctx->plugins; *pd; pd++) { - glite_jpps_fplug_data_t *plugin = *pd; - - for (i=0; plugin->uris[i]; i++) { - glite_jp_clear_error(ctx); - switch (glite_jppsbe_get_job_url(ctx,in->jobid,plugin->classes[i],NULL,&url)) { - case 0: - f = realloc(f,(n + 1) * sizeof *f); - f[n].class_ = soap_strdup(soap,plugin->uris[i]); -#warning FIXME: file name required in WSDL - f[n].name = NULL; - f[n].url = soap_strdup(soap,url); - n++; - free(url); - break; - case ENOENT: - break; - default: - err.code = ctx->error->code; - err.source = "jpsrv__GetJob()"; - err.desc = plugin->uris[i]; - glite_jp_stack_error(ctx,&err); - err2fault(ctx,soap); - glite_jp_clear_error(ctx); - return SOAP_FAULT; - } - } - } - - if (!n) { - glite_jp_clear_error(ctx); - err.code = ENOENT; - err.source = __FUNCTION__; - err.desc = "No file found for this job"; - glite_jp_stack_error(ctx,&err); - err2fault(ctx,soap); -// glite_jp_clear_error(ctx); - return SOAP_FAULT; - } - - GLITE_SECURITY_GSOAP_LIST_CREATE(soap, out, files, struct jptype__jppsFile, n); - for (i = 0; i < n; i++) memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out->files, i), &f[i], sizeof(f[i])); - - return SOAP_OK; -err: - glite_jp_attrval_free(meta,0); - err2fault(ctx,soap); - return SOAP_FAULT; -} - -SOAP_FMAC5 int SOAP_FMAC6 __jpsrv__GetJobAttributes( - struct soap *soap, - struct _jpelem__GetJobAttributes *in, - struct _jpelem__GetJobAttributesResponse *out) -{ - glite_jp_attrval_t *attr, meta[2]; - int i,n; - - CONTEXT_FROM_SOAP(soap,ctx); - - memset(meta,0,sizeof meta); - meta[0].name = strdup(GLITE_JP_ATTR_OWNER); - - if (glite_jppsbe_get_job_metadata(ctx,in->jobid,meta)) { - goto err; - } - - if (glite_jpps_authz(ctx,SOAP_TYPE___jpsrv__GetJobAttributes,in->jobid,meta[0].value)) { - goto err; - } - - if (glite_jpps_get_attrs(ctx,in->jobid, - in->attributes, - in->__sizeattributes,&attr)) { - err2fault(ctx,soap); - return SOAP_FAULT; - } - - for (i=0; attr[i].name; i++); - out->__sizeattrValues = jp2s_attrValues(soap,attr,&out->attrValues,1); - - return SOAP_OK; -err: - glite_jp_attrval_free(meta,0); - err2fault(ctx,soap); - return SOAP_FAULT; -} diff --git a/org.glite.jp.primary/src/soap_util.c b/org.glite.jp.primary/src/soap_util.c deleted file mode 100644 index 9235a45..0000000 --- a/org.glite.jp.primary/src/soap_util.c +++ /dev/null @@ -1,91 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -static enum jptype__attrOrig jp2s_origin(glite_jp_attr_orig_t o) -{ - switch (o) { - case GLITE_JP_ATTR_ORIG_SYSTEM: return jptype__attrOrig__SYSTEM; - case GLITE_JP_ATTR_ORIG_USER: return jptype__attrOrig__USER; - case GLITE_JP_ATTR_ORIG_FILE: return jptype__attrOrig__FILE_; - default: abort(); /* XXX */ - } -} - -static int jp2s_attrValues( - struct soap *soap, - glite_jp_attrval_t *in, - GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) *outp, - int freeit) -{ - GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) out; - struct jptype__attrValue a; - int i,cnt; - - for (cnt=0; in[cnt].name; cnt++); - - GLITE_SECURITY_GSOAP_LIST_CREATE0(soap, out, cnt, struct jptype__attrValue, cnt); - for (i=0; in[i].name; i++) { - memset(&a, 0, sizeof a); - a.name = soap_strdup(soap,in[i].name); - if (freeit) free(in[i].name); - a.value = soap_malloc(soap,sizeof *a.value); - memset(a.value, 0, sizeof *a.value); - if (in[i].binary) { - GSOAP_SETBLOB(a.value, soap_malloc(soap,sizeof *GSOAP_BLOB(a.value))); - memset(GSOAP_BLOB(a.value),0,sizeof *GSOAP_BLOB(a.value)); - GSOAP_BLOB(a.value)->__ptr = soap_malloc(soap,in[i].size); - GSOAP_BLOB(a.value)->__size = in[i].size; - memcpy(GSOAP_BLOB(a.value)->__ptr,in[i].value,in[i].size); - } - else { - GSOAP_SETSTRING(a.value, soap_strdup(soap,in[i].value)); - } - - if (freeit) free(in[i].value); - a.origin = jp2s_origin(in[i].origin); - a.originDetail = in[i].origin_detail ? soap_strdup(soap,in[i].origin_detail) : NULL; - if (freeit) free(in[i].origin_detail); - a.timestamp = in[i].timestamp; - - memcpy(GLITE_SECURITY_GSOAP_LIST_GET(out, i), &a, sizeof a); - } - if (freeit) free(in); - - *outp = out; - return cnt; -} - -static void attrValues_free( - struct soap *soap, - GLITE_SECURITY_GSOAP_LIST_TYPE(jptype, attrValue) a, - int na) -{ - int i; - struct jptype__attrValue *ai; - - for (i=0; ivalue) && GSOAP_STRING(ai->value)) soap_dealloc(soap,GSOAP_STRING(ai->value)); - if (GSOAP_ISBLOB(ai->value) && GSOAP_BLOB(ai->value)) { - soap_dealloc(soap,GSOAP_BLOB(ai->value)->__ptr); - soap_dealloc(soap,GSOAP_BLOB(ai->value)); - } - soap_dealloc(soap,ai->value); - if (ai->originDetail) soap_dealloc(soap,ai->originDetail); - } - GLITE_SECURITY_GSOAP_LIST_DESTROY0(soap, a, na); -} diff --git a/org.glite.jp.primary/src/tags.c b/org.glite.jp.primary/src/tags.c deleted file mode 100644 index 892b635..0000000 --- a/org.glite.jp.primary/src/tags.c +++ /dev/null @@ -1,476 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "glite/jp/backend.h" -#include "tags.h" - -/* magic name_len value_len binary sequence timestamp */ -#define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#" -#define HEADER_SIZE 48 -#define TAGS_MAGIC 0x74c016f2 /* two middle digits encode version, i.e. 01 */ - -static int tagsread(void *fpctx,struct tags_handle *h); - -/*int glite_jpps_tag_append( - glite_jp_context_t ctx, - void *handle, - const glite_jp_tagval_t *tag -) -{ - char hdr[HEADER_SIZE+1]; - glite_jp_error_t err; - - unsigned long vlen = tag->binary ? tag->size : - (tag->value ? strlen(tag->value) : 0); - int nlen; - - memset(&err,0,sizeof err); - err.source = "glite_jpps_tag_append()"; - - if (!tag->name) { - err.code = EINVAL; - err.desc = "tag name"; - return glite_jp_stack_error(ctx,&err); - } - - nlen = strlen(tag->name); - - assert(sprintf(hdr,HEADER,nlen,vlen, - tag->binary ? "B" : "S", - tag->sequence, tag->timestamp) == HEADER_SIZE); - - if (glite_jppsbe_append(ctx,handle,hdr,HEADER_SIZE)) { - err.code = EIO; - err.desc = "write tag header"; - return glite_jp_stack_error(ctx,&err); - } - - if (glite_jppsbe_append(ctx,handle,tag->name,nlen)) { - err.code = EIO; - err.desc = "write tag name"; - return glite_jp_stack_error(ctx,&err); - } - - if (glite_jppsbe_append(ctx,handle,tag->value,vlen)) { - err.code = EIO; - err.desc = "write tag value"; - return glite_jp_stack_error(ctx,&err); - } - - return 0; -} - -int glite_jpps_tagval_copy( - glite_jp_context_t ctx, - glite_jp_tagval_t *from, - glite_jp_tagval_t *to -) -{ - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - to->name = strdup(from->name); - if (!to->name) { - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - to->sequence = from->sequence; - to->timestamp = from->timestamp; - to->binary = from->binary; - to->size = from->size; - to->value = (char *) malloc(to->size); - if (!to->value) { - free(to->name); - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - memcpy(from->value, to->value, to->size); - - return 0; -} - -int glite_jpps_tag_read( - glite_jp_context_t ctx, - void *handle, - off_t offset, - glite_jp_tagval_t *tagvalue, - size_t *shift -) -{ - char hdr[HEADER_SIZE+1]; - unsigned int nlen; - unsigned long vlen; - char binary; - unsigned sequence; - unsigned timestamp; - char * name = NULL; - char * value = NULL; - ssize_t ret; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - hdr[HEADER_SIZE] = '\0'; - if (glite_jppsbe_pread(ctx, handle, hdr, HEADER_SIZE, offset, &ret)) { - err.code = EIO; - err.desc = "Cannot read tag header"; - goto error_out; - } - if (ret == 0) { - err.code = ENOENT; - err.desc = "No more tags in the file"; - goto error_out; - } - // #define HEADER "JP#TAG# %05u %012lu %c %05u %012lu#" - if (sscanf(hdr, HEADER, &nlen, &vlen, &binary, &sequence, ×tamp) < 5) { - err.code = EILSEQ; - err.desc = "Incorrect tag header format"; - goto error_out; - } - name = (char*) malloc(nlen + 1); - if (!name) { - err.code = ENOMEM; - goto error_out; - } - name[nlen] = '\0'; - value = (char*) malloc(vlen + 1); - if (!value) { - err.code = ENOMEM; - goto error_out; - } - value[vlen] = '\0'; - if (glite_jppsbe_pread(ctx, handle, name, nlen, offset + HEADER_SIZE, &ret)) { - err.code = EIO; - err.desc = "Cannot read tag name"; - goto error_out; - } - if (glite_jppsbe_pread(ctx, handle, value, vlen, offset + HEADER_SIZE + nlen, &ret)) { - err.code = EIO; - err.desc = "Cannot read tag value"; - goto error_out; - } - - tagvalue->name = name; - tagvalue->sequence = sequence; - tagvalue->timestamp = timestamp; - tagvalue->binary = (binary == 'B') ? 1 : 0; - tagvalue->size = vlen; - tagvalue->value = value; - - *shift = HEADER_SIZE + nlen + vlen; - - return 0; -error_out: - free(name); - free(value); - return glite_jp_stack_error(ctx,&err); -}*/ - -/* -int glite_jpps_tag_read(glite_jp_context_t, void *, off_t, glite_jp_tagval_t *, size_t); -int glite_jpps_tag_readall(glite_jp_context_t, void *, glite_jp_tagval_t **); -*/ - -/*int glite_jpps_tag_readall( - glite_jp_context_t ctx, - void *handle, - glite_jp_tagval_t **tags_out -) -{ - glite_jp_tagval_t * tags = NULL; - void * newspace; - int ntags = 0; - int ntagspace = 0; - off_t offset = 0; - int ret; - size_t shift; - glite_jp_error_t err; - - glite_jp_clear_error(ctx); - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - ntagspace = 1; - tags = (glite_jp_tagval_t *) calloc(ntagspace + 1, sizeof(*tags)); - if (!tags) { - err.code = ENOMEM; - return glite_jp_stack_error(ctx,&err); - } - while (!(ret = glite_jpps_tag_read(ctx, handle, offset, &tags[ntags], &shift))) { - offset += shift; - ntags++; - if (ntagspace <= ntags) { - ntagspace += 1; - newspace = realloc(tags, (ntagspace + 1) * sizeof(*tags)); - if (!newspace) { - err.code = ENOMEM; - goto error_out; - } - tags = (glite_jp_tagval_t *) newspace; - } - } - if (ret == ENOENT) { - *tags_out = tags; - return 0; - } else { - err.code = EIO; - err.desc = "Error reading tag value"; - } - -error_out: - for (; ntags-- ;) { - free(tags[ntags].name); - free(tags[ntags].value); - } - free(tags); - return glite_jp_stack_error(ctx,&err); -}*/ - -int tag_append(void *fpctx,void *bhandle,glite_jp_attrval_t * tag) -{ - //va_list ap; - char *hdr,*rec; - glite_jp_context_t ctx = fpctx; - uint32_t magic,hlen,rlen,rlen_n; - ssize_t r; - glite_jp_error_t err; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - glite_jp_clear_error(ctx); - - printf("tagappend: %s,%s\n",tag->name,tag->value); - - //assert(oper == GLITE_JP_FPLUG_TAGS_APPEND); - - if (glite_jppsbe_pread(ctx,bhandle,&magic,sizeof magic,0,&r)) { - err.code = EIO; - err.desc = "reading magic number"; - return glite_jp_stack_error(ctx,&err); - } - - if (r == 0) { - magic = htonl(TAGS_MAGIC); - if (glite_jppsbe_pwrite(ctx,bhandle,&magic,sizeof magic,0)) { - err.code = EIO; - err.desc = "writing magic number"; - return glite_jp_stack_error(ctx,&err); - } - } - else if (r != sizeof magic) { - err.code = EIO; - err.desc = "can't read magic number"; - return glite_jp_stack_error(ctx,&err); - } - else if (magic != htonl(TAGS_MAGIC)) { - err.code = EINVAL; - err.desc = "invalid magic number"; - return glite_jp_stack_error(ctx,&err); - } - -/* XXX: origin is always USER, not recorded */ - trio_asprintf(&hdr,"%ld %c", - tag->timestamp,tag->binary ? 'B' : 'S'); - - rlen = strlen(tag->name) + strlen(hdr) + 2 /* \0 after name and after hdr */ + - (r = tag->binary ? tag->size : (tag->value ? strlen(tag->value) : 0)); - - rlen_n = htonl(rlen); - - rec = malloc(rlen + sizeof rlen_n); - *((uint32_t *) rec) = rlen_n; - strcpy(rec + sizeof rlen_n,tag->name); - strcpy(rec + (hlen = sizeof rlen_n + strlen(tag->name) + 1),hdr); - - if (r) memcpy(rec + hlen + strlen(hdr) + 1,tag->value,r); - free(hdr); - -/* record format: - * - 4B length, net byte order - * - attr name, \0 - * - %ld %c \0 (timestamp, B/S) - * - value - */ - if (glite_jppsbe_append(ctx,bhandle,rec,rlen + sizeof rlen_n)) { - err.code = EIO; - err.desc = "writing tag record"; - free(rec); - return glite_jp_stack_error(ctx,&err); - } - - /* XXX: should add tag also to handle->tags, but it is never used - * currently */ - - return 0; -} - -int tag_attr(void *fpctx,void *handle,const char *attr,glite_jp_attrval_t **attrval) -{ - struct tags_handle *h = handle; - glite_jp_error_t err; - glite_jp_context_t ctx = fpctx; - glite_jp_attrval_t *out = NULL; - int i,nout = 0; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - if (!h->tags) tagsread(fpctx,handle); - - if (!h->tags) { - err.code = ENOENT; - err.desc = "no tags for this job"; - return glite_jp_stack_error(ctx,&err); - } - - for (i=0; in; i++) if (!strcmp(h->tags[i].name,attr)) { - out = realloc(out,(nout+2) * sizeof *out); - glite_jp_attrval_copy(out+nout,h->tags+i); - nout++; - memset(out+nout,0,sizeof *out); - } - - if (nout) { - *attrval = out; - return 0; - } - else { - err.code = ENOENT; - err.desc = "no value for this tag"; - return glite_jp_stack_error(ctx,&err); - } -} - -static int tagsread(void *fpctx,struct tags_handle *h) -{ - glite_jp_context_t ctx = fpctx; - uint32_t magic,rlen; - glite_jp_error_t err; - ssize_t r; - size_t off = sizeof rlen; - glite_jp_attrval_t *tp; - char *rp; - - memset(&err,0,sizeof err); - err.source = __FUNCTION__; - - glite_jp_clear_error(ctx); - -// read magic number - if (glite_jppsbe_pread(ctx,h->bhandle,&magic,sizeof magic,0,&r)) { - err.code = EIO; - err.desc = "reading magic number"; - return glite_jp_stack_error(ctx,&err); - } - - if (r != sizeof magic) { - err.code = EIO; - err.desc = "can't read magic number"; - return glite_jp_stack_error(ctx,&err); - } - else if (magic != htonl(TAGS_MAGIC)) { - err.code = EINVAL; - err.desc = "invalid magic number"; - return glite_jp_stack_error(ctx,&err); - } - - - while (1) { - char *rec,type; - int rd; - - // read record header - if (glite_jppsbe_pread(ctx,h->bhandle,&rlen,sizeof rlen,off,&r)) { - err.code = EIO; - err.desc = "reading record header"; - return glite_jp_stack_error(ctx,&err); - } - if (r == 0) break; - - if (r != sizeof rlen) { - err.code = EIO; - err.desc = "can't read record header"; - return glite_jp_stack_error(ctx,&err); - } - - off += r; - rec = malloc(rlen = ntohl(rlen)); - - // read whole record body thoroughly - for (rd=0; rdbhandle,rec+rd,rlen-rd,off+rd,&r)) { - err.code = EIO; - err.desc = "reading record body"; - free(rec); - return glite_jp_stack_error(ctx,&err); - } - - off += rlen; - - // parse the record - h->tags = realloc(h->tags,(h->n+2) * sizeof *h->tags); - tp = h->tags+h->n++; - memset(tp,0,sizeof *tp); - - tp->name = strdup(rec); - rp = rec + strlen(rec) + 1; - - sscanf(rp,"%ld %c",&tp->timestamp,&type); - rp += strlen(rp) + 1; - switch (type) { - int i; - - case 'B': tp->binary = 1; break; - case 'S': tp->binary = 0; break; - default: free(rec); - for (i=0; in; i++) - glite_jp_attrval_free(h->tags+i,0); - free(h->tags); - h->tags = NULL; - h->n = 0; - - err.code = EINVAL; - err.desc = "invalid attr type (B/S)"; - return glite_jp_stack_error(ctx,&err); - } - tp->value = malloc((r=rlen - (rp - rec)) + 1); - memcpy(tp->value,rp,r); - if (!tp->binary) tp->value[r] = 0; - tp->origin = GLITE_JP_ATTR_ORIG_USER; - - free(rec); - } - return 0; -} - diff --git a/org.glite.jp.primary/src/tags.h b/org.glite.jp.primary/src/tags.h deleted file mode 100644 index 0f24791..0000000 --- a/org.glite.jp.primary/src/tags.h +++ /dev/null @@ -1,27 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -struct tags_handle { - void *bhandle; - int n; - glite_jp_attrval_t *tags; -}; - -int tag_append(void *fpctx,void *bhandle,glite_jp_attrval_t * tag); -//int glite_jpps_tag_append(glite_jp_context_t,void *,const char *, const char *); -//int glite_jpps_tag_append(glite_jp_context_t,void *,const glite_jp_tagval_t *); -int tag_attr(void *fpctx,void *handle,const char *attr,glite_jp_attrval_t **attrval); diff --git a/org.glite.jp.primary/src/typemap.dat b/org.glite.jp.primary/src/typemap.dat deleted file mode 100644 index 72f515f..0000000 --- a/org.glite.jp.primary/src/typemap.dat +++ /dev/null @@ -1,3 +0,0 @@ -jpsrv = http://glite.org/wsdl/services/jp -jptype = http://glite.org/wsdl/types/jp -jpelem = http://glite.org/wsdl/elements/jp diff --git a/org.glite.jp.server-common/Makefile b/org.glite.jp.server-common/Makefile deleted file mode 100644 index a65ac71..0000000 --- a/org.glite.jp.server-common/Makefile +++ /dev/null @@ -1,77 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -jpprefix=jp -package=glite-jp-server-common -version=0.0.0 -PREFIX=/opt/glite - -glite_location=/opt/glite -nothrflavour=gcc32 -thrflavour=gcc32pthr - -CC=gcc - --include Makefile.inc - - -VPATH=${top_srcdir}/src:${top_srcdir}/examples:${top_srcdir}/test:${top_srcdir}/project:${jpproject}:${stagedir}/interface - -DEBUG:=-g -O0 -W -Wall -DDEBUG -CPPFLAGS:=-I. -I${top_srcdir}/interface -I${top_srcdir}/src -I${stagedir}/include -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql -CFLAGS:=${DEBUG} -D_GNU_SOURCE -LDFLAGS:=-L${stagedir}/lib - -offset=0 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - - -COMPILE:=libtool --mode=compile ${CC} ${CPPFLAGS} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -LIBLINK:=${LINK} ${version_info} -INSTALL:=libtool --mode=install install - -STATICLIB:=libglite_jp_server_common.a -LTLIB:=libglite_jp_server_common.la - - -SRCS:=db.c -HDRS:=db.h -OBJS:=${SRCS:.c=.o} -LOBJS:=${OBJS:.o=.lo} - -default all: compile examples - -compile: ${LTLIB} ${STATICLIB} - -${LTLIB} ${STATICLIB}: ${OBJS} - ${LIBLINK} -o $@ ${LOBJS} -lglite_lbu_db - -examples: - -check: - -echo nothing yet - -doc: - -stage: compile - $(MAKE) install PREFIX=${stagedir} - -install: - -mkdir -p ${PREFIX}/lib ${PREFIX}/include/${globalprefix}/${jpprefix} - ${INSTALL} -m 755 ${LTLIB} ${PREFIX}/lib - for f in ${HDRS}; do \ - ${INSTALL} -m 644 ${top_srcdir}/interface/"$$f" ${PREFIX}/include/${globalprefix}/${jpprefix}; \ - done - -clean: - -%.o: %.c - ${COMPILE} -c $< -o $@ - -.PHONY: default all compile examples check doc stage dist distsrc distbin install clean diff --git a/org.glite.jp.server-common/build.xml b/org.glite.jp.server-common/build.xml deleted file mode 100755 index 33d20cf..0000000 --- a/org.glite.jp.server-common/build.xml +++ /dev/null @@ -1,101 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.server-common/configure b/org.glite.jp.server-common/configure deleted file mode 100755 index 0bf1a3f..0000000 --- a/org.glite.jp.server-common/configure +++ /dev/null @@ -1,701 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp.server-common/examples/db-test-int.c b/org.glite.jp.server-common/examples/db-test-int.c deleted file mode 100644 index cf5c085..0000000 --- a/org.glite.jp.server-common/examples/db-test-int.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include - -#include "db.h" - - -static void print_err(glite_jp_context_t ctx) { - glite_jp_error_t *e; - - e = ctx->error; - while (e) { - printf("%s(%s)\n", e->desc, e->source); - e = e->reason; - } - printf("\n"); -} - - -int main() { - glite_jp_context_t ctx; - glite_jp_db_stmt_t jpstmt; - - glite_jp_init_context(&ctx); - - printf("connecting...\n"); - if (glite_jp_db_connect(ctx, "jpis/@localhost:jpis1") != 0) goto fail; - - // "trio" queries -{ - int nr, i; - char **res; - - printf("selecting...\n"); - if ((glite_jp_db_execstmt(ctx, "SELECT uniqueid, feedid, state, source, condition FROM feeds", &jpstmt)) == -1) goto fail; - - printf("fetching...\n"); - res = calloc(4, sizeof(char *)); - while ((nr = glite_jp_db_fetchrow(jpstmt, res)) > 0) { - printf("Result: n=%d, res=%p\n", nr, res); - i = 0; - if (res) while(i < nr) {printf("p=%p(%s)\n", res[i], res[i]);free(res[i]);i++;} - } - free(res); - printf("closing stmt...\n"); - glite_jp_db_freestmt(&jpstmt); -} - - // param queries -{ - char res_feedid[33]; - long int res_state; - char res_source[256]; - char res_condition[1024]; - unsigned long res_condition_length; - long int param_state; - - void *my_res, *my_param; - - glite_jp_db_create_params(&my_param, 1, GLITE_JP_DB_TYPE_INT, ¶m_state); - glite_jp_db_create_results(&my_res, 4, - GLITE_JP_DB_TYPE_VARCHAR, NULL, res_feedid, sizeof(res_feedid), NULL, - GLITE_JP_DB_TYPE_INT, NULL, &res_state, - GLITE_JP_DB_TYPE_VARCHAR, NULL, res_source, sizeof(res_source), NULL, - GLITE_JP_DB_TYPE_MEDIUMBLOB, NULL, res_condition, sizeof(res_condition), &res_condition_length - ); - printf("preparing...\n"); - if ((glite_jp_db_prepare(ctx, "SELECT feedid, state, source, condition FROM feeds WHERE state = ?", &jpstmt, my_param, my_res)) != 0) goto fail_close; - - param_state = 1; - printf("executing state %ld...\n", param_state); - if (glite_jp_db_execute(jpstmt) == -1) { - glite_jp_db_freestmt(&jpstmt); - goto fail_stmtclose; - } - printf("fetching...\n"); - while (glite_jp_db_fetch(jpstmt) == 0) { - printf("feedid:%s, state:%ld, source:%s, condition:%s\n", res_feedid, res_state, res_source, res_condition); - } - - param_state = 2; - printf("executing state %ld...\n", param_state); - if (glite_jp_db_execute(jpstmt) == -1) { - glite_jp_db_freestmt(&jpstmt); - goto fail_stmtclose; - } - printf("fetching...\n"); - while (glite_jp_db_fetch(jpstmt) == 0) { - printf("feedid:%s, state:%ld, source:%s, condition:%s\n", res_feedid, res_state, res_source, res_condition); - } -} - - printf("closing stmt...\n"); - glite_jp_db_freestmt(&jpstmt); - printf("closing...\n"); - glite_jp_db_close(ctx); - - glite_jp_free_context(ctx); - return 0; - -fail_stmtclose: - printf("closing stmt...\n"); - glite_jp_db_freestmt(&jpstmt); -fail_close: - printf("closing...\n"); - glite_jp_db_close(ctx); -fail: - printf("failed\n"); - print_err(ctx); - glite_jp_free_context(ctx); - - return 1; -} diff --git a/org.glite.jp.server-common/interface/db.h b/org.glite.jp.server-common/interface/db.h deleted file mode 100644 index d1a0f42..0000000 --- a/org.glite.jp.server-common/interface/db.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _DB_H -#define _DB_H - -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include "glite/jp/types.h" -#include "glite/lbu/db.h" - -#ifdef __cplusplus -extern "C" { -#endif - -int glite_jp_db_SetError(glite_jp_context_t ctx, const char *source); -int glite_jp_db_ExecSQL(glite_jp_context_t ctx, const char *cmd, glite_lbu_Statement *stmt); -int glite_jp_db_FetchRow(glite_jp_context_t ctx, glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results); -int glite_jp_db_PrepareStmt(glite_jp_context_t ctx, const char *sql, glite_lbu_Statement *stmt); -int glite_jp_db_ExecPreparedStmt(glite_jp_context_t ctx, glite_lbu_Statement stmt, int n,...); -void glite_jp_db_FreeStmt(glite_lbu_Statement *stmt); -int glite_jp_db_Transaction(glite_jp_context_t ctx); -int glite_jp_db_Commit(glite_jp_context_t ctx); -int glite_jp_db_Rollback(glite_jp_context_t ctx); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.jp.server-common/project/ChangeLog b/org.glite.jp.server-common/project/ChangeLog deleted file mode 100644 index c9fb222..0000000 --- a/org.glite.jp.server-common/project/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -1.3.0-1 -- Initial Version - -1.3.0-2 -- configure updated - diff --git a/org.glite.jp.server-common/project/build.number b/org.glite.jp.server-common/project/build.number deleted file mode 100644 index baeaebc..0000000 --- a/org.glite.jp.server-common/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Sat Oct 15 06:50:18 CEST 2005 -module.build=3 diff --git a/org.glite.jp.server-common/project/configure.properties.xml b/org.glite.jp.server-common/project/configure.properties.xml deleted file mode 100644 index 2fb0a4d..0000000 --- a/org.glite.jp.server-common/project/configure.properties.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -jpprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -expat_prefix=${with.expat.prefix} -gsoap_prefix=${with.gsoap.prefix} -mysql_prefix=${with.mysql.prefix} -mysql_version=${ext.mysql.version} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -cppunit=${with.cppunit.prefix} -jpproject=${subsystem.project.dir} -project=${component.project.dir} - - - diff --git a/org.glite.jp.server-common/project/properties.xml b/org.glite.jp.server-common/project/properties.xml deleted file mode 100755 index bd0829c..0000000 --- a/org.glite.jp.server-common/project/properties.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.server-common/project/tar_exclude b/org.glite.jp.server-common/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.jp.server-common/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.jp.server-common/project/version.properties b/org.glite.jp.server-common/project/version.properties deleted file mode 100644 index 450e0b2..0000000 --- a/org.glite.jp.server-common/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.3.0 -module.age=2 diff --git a/org.glite.jp.server-common/src/db.c b/org.glite.jp.server-common/src/db.c deleted file mode 100644 index b694a0c..0000000 --- a/org.glite.jp.server-common/src/db.c +++ /dev/null @@ -1,128 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include -#include - -#include "glite/jp/types.h" -#include "glite/jp/context.h" - -#include "db.h" - - -int glite_jp_db_SetError(glite_jp_context_t ctx, const char *source) { - glite_jp_error_t jperr; - char *desc; - - memset(&jperr, 0, sizeof jperr); - if (ctx->dbhandle) { - jperr.code = glite_lbu_DBError(ctx->dbhandle, NULL, &desc); - if (jperr.code && source) jperr.source = source; - jperr.desc = desc; - } else { - asprintf(&desc, "DB context isn't created"); - jperr.code = EINVAL; - jperr.desc = desc; - jperr.source = __FUNCTION__; - } - if (jperr.code) { - glite_jp_stack_error(ctx, &jperr); - free(desc); - } - - return jperr.code; -} - - -int glite_jp_db_ExecSQL(glite_jp_context_t ctx, const char *cmd, glite_lbu_Statement *stmt) { - int num; - - num = glite_lbu_ExecSQL(ctx->dbhandle, cmd, stmt); - if (num < 0) glite_jp_db_SetError(ctx, __FUNCTION__); - - return num; -} - - -int glite_jp_db_FetchRow(glite_jp_context_t ctx, glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results) { - int num; - - num = glite_lbu_FetchRow(stmt, n, lengths, results); - if (num < 0) glite_jp_db_SetError(ctx, __FUNCTION__); - return num; -} - - -int glite_jp_db_PrepareStmt(glite_jp_context_t ctx, const char *sql, glite_lbu_Statement *stmt) { - int ret; - - ret = glite_lbu_PrepareStmt(ctx->dbhandle, sql, stmt); - if (ret != 0) glite_jp_db_SetError(ctx, __FUNCTION__); - return ret; -} - - -int glite_jp_db_ExecPreparedStmt(glite_jp_context_t ctx, glite_lbu_Statement stmt, int n,...) { - va_list ap; - int ret; - - va_start(ap, n); - ret = glite_lbu_ExecPreparedStmt_v(stmt, n, ap); - va_end(ap); - if (ret < 0) glite_jp_db_SetError(ctx, __FUNCTION__); - return ret; -} - - -void glite_jp_db_FreeStmt(glite_lbu_Statement *stmt) { - glite_lbu_FreeStmt(stmt); -} - - -int glite_jp_db_Transaction(glite_jp_context_t ctx) { - int ret; - - ret = glite_lbu_Transaction(ctx->dbhandle); - if (ret != 0) glite_jp_db_SetError(ctx, __FUNCTION__); - - return ret; -} - - -int glite_jp_db_Commit(glite_jp_context_t ctx) { - int ret; - - ret = glite_lbu_Commit(ctx->dbhandle); - if (ret != 0) glite_jp_db_SetError(ctx, __FUNCTION__); - - return ret; -} - - -int glite_jp_db_Rollback(glite_jp_context_t ctx) { - int ret; - - ret = glite_lbu_Rollback(ctx->dbhandle); - if (ret != 0) glite_jp_db_SetError(ctx, __FUNCTION__); - - return ret; -} diff --git a/org.glite.jp.ws-interface/.cvsignore b/org.glite.jp.ws-interface/.cvsignore deleted file mode 100755 index 1df717b..0000000 --- a/org.glite.jp.ws-interface/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.jp.ws-interface/LICENSE b/org.glite.jp.ws-interface/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.jp.ws-interface/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.jp.ws-interface/Makefile b/org.glite.jp.ws-interface/Makefile deleted file mode 100644 index 22c2898..0000000 --- a/org.glite.jp.ws-interface/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# Default values -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -globalprefix=glite -jpprefix=jp -package=glite-jp-ws-interface -version=0.0.0 -PREFIX=/opt/glite - --include Makefile.inc - -VPATH=${top_srcdir}/interface:${top_srcdir}/src -STAGETO=interface - -XSLTPROC=xsltproc --nonet -XMLLINT:=xmllint --nonet -TIDY:=tidy -i -q --show-warnings no --tidy-mark no --wrap 0 -docbookxls:=http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl - -WSDL=JobProvenancePS.wsdl JobProvenanceIS.wsdl JobProvenanceTypes.wsdl -WSDL_S=jpdev.wsdl -XSD=JobProvenanceTypes.xsd - -all compile: ${WSDL} ${XSD} JobProvenance.html ${WSDL_S} - -check: - @echo No unit test required for interface-only module. - -stage: ${WSDL} - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -install: - -mkdir -p ${PREFIX}/${STAGETO} - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - -mkdir -p ${PREFIX}/include/${globalprefix}/${jpprefix} - install -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - -install -m 644 JobProvenance.html ${PREFIX}/share/doc/${package}-${version} -# cd ${top_srcdir}/interface && install -m 644 ${WSDL} ${PREFIX}/${STAGETO} - install -m 644 ${WSDL} ${WSDL_S} ${XSD} ${PREFIX}/${STAGETO} - install -m 644 ${top_srcdir}/src/ws_fault.c ${PREFIX}/include/${globalprefix}/${jpprefix} - -clean: - rm -f *.h - -%.wsdl: %.xml puke-wsdl.xsl - ${XSLTPROC} ../src/puke-wsdl.xsl $< >$@ - -${TIDY} -xml -m $@ - -%.xsd: %.xml puke-schema.xsl - ${XSLTPROC} ../src/puke-schema.xsl $< >$@ - -${TIDY} -xml -m $@ - -JobProvenance.html: doc.xml JobProvenancePS.xml JobProvenanceIS.xml JobProvenanceTypes.xml puke-ug.xsl - -${XSLTPROC} --novalid ../src/puke-ug.xsl $< >doc-html.xml && \ - ${XSLTPROC} --stringparam chapter.autolabel 0 ${docbookxls} doc-html.xml >$@ - -${TIDY} -xml -m doc-html.xml - -${XMLLINT} --valid --noout doc-html.xml - -${TIDY} -asxhtml -m $@ - -jpdev.xml: jpdev.xml.sh JobProvenancePS.xml JobProvenanceIS.xml JobProvenanceTypes.xml - ${top_srcdir}/src/jpdev.sh $< > $@ diff --git a/org.glite.jp.ws-interface/build.xml b/org.glite.jp.ws-interface/build.xml deleted file mode 100644 index ae5d49b..0000000 --- a/org.glite.jp.ws-interface/build.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.ws-interface/configure b/org.glite.jp.ws-interface/configure deleted file mode 100755 index 0bf1a3f..0000000 --- a/org.glite.jp.ws-interface/configure +++ /dev/null @@ -1,701 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp.ws-interface/project/ChangeLog b/org.glite.jp.ws-interface/project/ChangeLog deleted file mode 100644 index 99ea05f..0000000 --- a/org.glite.jp.ws-interface/project/ChangeLog +++ /dev/null @@ -1,6 +0,0 @@ -1.4.0-1 -- Initial version - -1.4.0-2 -- configure updated - diff --git a/org.glite.jp.ws-interface/project/build.number b/org.glite.jp.ws-interface/project/build.number deleted file mode 100644 index af547f8..0000000 --- a/org.glite.jp.ws-interface/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Sat Oct 15 06:46:41 CEST 2005 -module.build=36 diff --git a/org.glite.jp.ws-interface/project/build.properties b/org.glite.jp.ws-interface/project/build.properties deleted file mode 100755 index e69de29..0000000 diff --git a/org.glite.jp.ws-interface/project/configure.properties.xml b/org.glite.jp.ws-interface/project/configure.properties.xml deleted file mode 100644 index 4b08208..0000000 --- a/org.glite.jp.ws-interface/project/configure.properties.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -jpprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} - - - diff --git a/org.glite.jp.ws-interface/project/properties.xml b/org.glite.jp.ws-interface/project/properties.xml deleted file mode 100644 index 4ec8018..0000000 --- a/org.glite.jp.ws-interface/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.ws-interface/project/tar_exclude b/org.glite.jp.ws-interface/project/tar_exclude deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.jp.ws-interface/project/version.properties b/org.glite.jp.ws-interface/project/version.properties deleted file mode 100755 index b23d1e3..0000000 --- a/org.glite.jp.ws-interface/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.4.0 -module.age=2 diff --git a/org.glite.jp.ws-interface/src/JobProvenanceIS.xml b/org.glite.jp.ws-interface/src/JobProvenanceIS.xml deleted file mode 100644 index 90f61ab..0000000 --- a/org.glite.jp.ws-interface/src/JobProvenanceIS.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - CVS revision: - - - - - - The Job Provenance (JP) Index Server is a volatile counterpart to the - permanent JP Primary Storage. Index servers are populated with subsets - of data from Primary storage(s) and indexed according to particular user needs. - - - - The interface to Index server contains three logical parts: administraive - (control), system and user. The administrative part is used by run-time index - server configuration tool, the system one allows Primary storage(s) to feed - data into the Index server, and the user one is available to users for queries. - - - - - - - - - - Called by JP primary storage as a response to FeedIndex request. - Updates information on jobs in index server, according to what JPPS - currently knows. - Id of the feed, as returned by JPPS FeedIndex operation. - Flag of completed batch feed. - Attributes per job. - - Any error. - - - - - User query to index server. - - Query conditions, similar to LB. - - - Set of attributes to be retrieved directly from index server (if any). - - - List of jobs matching the query. - - Any error. - - - - - Called by JP index serve admin tool to ask new primary storage server to feed it. - Updates information on PS in index server, according to what JPPS - currently knows. - - New feed IS URL, filter and query type. - - Any error. - - - Called by JP index serve admin tool to find out IS open feeds - - List of active feeds on IS. - - Any error. - - - Called by JP index serve admin tool to remove one feed session. - - ID of feed to be removed. - - Any error. - - - - - Internal operation used for parsing XML config file. - Not called at all, only forcing gSoap to generate XML parsers. - - List of attributes which will JPPS send to JPIS. - - - List of indexed attributes which will JPPS send to JPIS. - - - List of type plugins. - - - List of requested feeds. - - Any error. - - - - diff --git a/org.glite.jp.ws-interface/src/JobProvenancePS.xml b/org.glite.jp.ws-interface/src/JobProvenancePS.xml deleted file mode 100644 index 8ce2524..0000000 --- a/org.glite.jp.ws-interface/src/JobProvenancePS.xml +++ /dev/null @@ -1,110 +0,0 @@ - - - CVS revision: - - - - - - The Job Provenance (JP) Primary Storage Service is responsible to keep the JP data - (definition of submitted jobs, execution conditions and environment, and important - points of the job life cycle) in a compact and economic form. - - - - The JP Primary storage, as described in section 8.4 of the - Architecture deliverable DJRA1.1 - provides public interfaces for data storing, retrieval based on basic metadata, - and registration of Index servers for incremental feed. - - - - Command interface to JP is completely covered by the WS interface covered here. - Bulk file transfers are done via specialised protocols, currently gsiftp only. - - - - - - - - Register job with the JP primary storage. - Jobid of the registered job. - Owner of the job (DN of X509 certificate). - Any error. - - - - Start uploading a file. - Jobid to which this file is related. - - Type of the file (URI). The server must have a plugin handing this type. - - Name of the file (used to distinguish among more files of the same type). - The client promisses to finish the upload before this time. - MIME type of the file. - URL where the client should upload the file. - Server's view on when the upload must be finished. - Any error. - - - - Confirm a successfully finished file apload. - Destination URL returned by StartUpload before. - Any error. - - - - Record an additional user tag. - Job to which the tag is added. - Name and value of the tag. - Any error. - - - - Attributes per job - Any error. - - - - Request for feeding a JP Index server (issued by this server). - Endpoint of the listening index server. - Which attributes of jobs is the index server interested in. - Which jobs is the server interested in. - Data on jobs stored at PS in the past are required. - Data on jobs that will arrive in future are required. - Unique ID of the created feed session. - When the session expires. - Any error. - - - - Refresh an existing feed session. - Existing feed session ID to be refreshed. - New session expiration time. - Any error. - - - - Return URL's of files for a given single job. - The job. - List of the stored files. - Any error. - - - - Query concrete attributes of a given job. - The job. - Which attributes should be retrieved. - Values of the queried attributes. - Any error. - - - - diff --git a/org.glite.jp.ws-interface/src/JobProvenanceTypes.xml b/org.glite.jp.ws-interface/src/JobProvenanceTypes.xml deleted file mode 100644 index f6e7016..0000000 --- a/org.glite.jp.ws-interface/src/JobProvenanceTypes.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - CVS revision: - - - - - Operators used in queries. Most are self-explanatory. - - - - - The attribute is between two specified values. - The attribute exists (even having a NULL value). - - - - A single user-recorded value for a job attribute. - Name of the attribute, including namespace. - Value. - - - - - - - - - - - - A single condition on job. - Attribute name to query. - Operation. - Where the attribute value came from. - Value to compare the job attribute with. - Another value (for op = WITHIN). - - - - One session between IS and PS (aka feed) charactetristics. - URL of primary server. - Filter conditions. - Query type. - Query type - Unique ID of the feed session. - - - - JP primary storage file identification. - Type of the file (as set on StartUpload). - Name of the file (if there are more of the same type per job). - Where the file is stored on JP primary storage. - - - - Single value of an attribute. - Name of the attribute, including namespace. - String value. - When this value was recorded. - Where this value came from. - - - - - String value. - Binary value. - - - - Specification of attribute origin. - JP system value, e.g. job owner. - Explicitely stored by the user via RecordTag operation. - Coming from uploaded file. - - - - Information on a single job. - Used for recording tags into JPPS, feeding JPIS from JPPS, - and to answer user queries on JPIS. - ID of the job. - Job owner. - - Attribute values, required by query/feed and available right now. - - - User query only: which primary storage(s) have data on this job. - - - UpdateJobs only: this job no longer belongs to the feed. - Attribute values are those which caused the change. - - - - - Single query condition on a job. - Similarly to LB, these outer conditions are logically ANDed. - - Which attribute the condition refers to. - - - Specific attribute origin (if we do care). - - - List of conditions on attribute attr. - These conditions are logically ORed. - - - - - Single condition on an attribute. - Query operation. - Value to compare attribute with. - Value to compare attribute with. - - - - - - - - - Single type of an attribute - Name of the attribute - Cardinality of the attribute - Quariable attribute (indexed) - - - - - - - diff --git a/org.glite.jp.ws-interface/src/doc.xml b/org.glite.jp.ws-interface/src/doc.xml deleted file mode 100644 index 78cb6a5..0000000 --- a/org.glite.jp.ws-interface/src/doc.xml +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/org.glite.jp.ws-interface/src/jpdev.sh b/org.glite.jp.ws-interface/src/jpdev.sh deleted file mode 100755 index e3e2a72..0000000 --- a/org.glite.jp.ws-interface/src/jpdev.sh +++ /dev/null @@ -1,36 +0,0 @@ -#! /bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -xmlcut() { - echo -e "\t" - echo - grep "<$2>" $(dirname $0)/JobProvenance$1.xml -A 1000 | grep "" -B 1000 | grep -v "<$2>\|" -} - -xmlmerge() { - xmlcut PS $1 - echo - xmlcut IS $1 -} - -DOC="$(xmlmerge doc)" -OPERATIONS="$(xmlmerge operations)" - -XML_TMPL=$(sed $(dirname $0)/$1 -e 's/"/\\"/g') -eval "XML_RESULT=\"${XML_TMPL}\"" -echo "$XML_RESULT" diff --git a/org.glite.jp.ws-interface/src/jpdev.xml.sh b/org.glite.jp.ws-interface/src/jpdev.xml.sh deleted file mode 100644 index f5ae764..0000000 --- a/org.glite.jp.ws-interface/src/jpdev.xml.sh +++ /dev/null @@ -1,38 +0,0 @@ - - - CVS revision: -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - - - - -${DOC} - - - - - -${OPERATIONS} - - diff --git a/org.glite.jp.ws-interface/src/puke-schema.xsl b/org.glite.jp.ws-interface/src/puke-schema.xsl deleted file mode 100644 index fdbe9fb..0000000 --- a/org.glite.jp.ws-interface/src/puke-schema.xsl +++ /dev/null @@ -1,161 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - false - - - - - - - - - - : - - - - - - 0 - 1 - - - - - unbounded - 1 - - - - - - - - - - - - - - - : - - - - - unbounded - 1 - - - - - - - - - - - - - - - : - - - - - unbounded - 1 - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.ws-interface/src/puke-ug.xsl b/org.glite.jp.ws-interface/src/puke-ug.xsl deleted file mode 100644 index d3dbdd4..0000000 --- a/org.glite.jp.ws-interface/src/puke-ug.xsl +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - - - - - Job Provenance - - - Primary Storage -- Overview - - - - - Primary Storage -- Operations - - - - - - - - - Index Server -- Overview - - - - - Index Server -- Operations - - - - - - - - - JP Common Types - - - - - - - - - - - - - list of - - - - - - - - - - - - - - - - - - - <xsl:value-of select="@name"/> - - - Inputs: - - - - - - - N/A - - - - Outputs: - - - - - - - N/A - - - - - - - - - - <xsl:value-of select="@name"/> - - - - Structure (sequence complex type in WSDL) - Fields: ( type name description ) - - - Union (choice complex type in WSDL) - Fields: ( type name description ) - - - Enumeration (restriction of xsd:string in WSDL), - exactly one of the values must be specified. - - Values: - - - Flags (sequence of restricted xsd:string in WSDL), - any number of values can be specified together. - - Values: - - - - - - - - - list of - - - - - - - - - - - - - - - - - - - - (optional) - - - - - - - - - - - - - diff --git a/org.glite.jp.ws-interface/src/puke-wsdl.xsl b/org.glite.jp.ws-interface/src/puke-wsdl.xsl deleted file mode 100644 index ea7598e..0000000 --- a/org.glite.jp.ws-interface/src/puke-wsdl.xsl +++ /dev/null @@ -1,292 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - false - - - - - - - - - - : - - - - - - 0 - 1 - - - - - unbounded - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - : - - - - - unbounded - 1 - - - - - - - - - - - - - - - : - - - - - unbounded - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp.ws-interface/src/ws_fault.c b/org.glite.jp.ws-interface/src/ws_fault.c deleted file mode 100644 index 0ddcf54..0000000 --- a/org.glite.jp.ws-interface/src/ws_fault.c +++ /dev/null @@ -1,209 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ident "$Header: " - -#include -#include -#include -#include - -#ifndef UNUSED - #ifdef __GNUC__ - #define UNUSED __attribute__((unused)) - #else - #define UNUSED - #endif -#endif - -#define GSOAP_STRING(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, string, stringOrBlob, 1) -#define GSOAP_BLOB(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, blob, stringOrBlob, 1) -#define GSOAP_SETSTRING(CHOICE, VALUE) GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, string, jptype, stringOrBlob, 1, VALUE) -#define GSOAP_SETBLOB(CHOICE, VALUE) GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, blob, jptype, stringOrBlob, 1, VALUE) -#define GSOAP_ISSTRING(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, string, jptype, stringOrBlob, 1) -#define GSOAP_ISBLOB(CHOICE) GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, blob, jptype, stringOrBlob, 1) - -#if GSOAP_VERSION >= 20709 - #define GFNUM SOAP_TYPE_jptype__genericFault -#else - #define GFNUM SOAP_TYPE__genericFault -#endif - -#ifndef dprintf -#define dprintf(FMT, ARGS...) printf(FMT, ##ARGS) -#endif - - -static int glite_jp_clientCheckFault(struct soap *soap, int err, const char *name, int toSyslog) UNUSED; -static int glite_jp_clientGetErrno(struct soap *soap, int err) UNUSED; -static void glite_jp_server_err2fault(const glite_jp_context_t ctx,struct soap *soap) UNUSED; - -static struct jptype__genericFault* jp2s_error(struct soap *soap, const glite_jp_error_t *err); -static int clientGetFault(struct soap *soap, int err, const char **reason, struct jptype__genericFault **f, const char **fallback); - - -/* - * get client fault structs - * err - code got from soap call - * reason - error text - * f - extended fault structs or NULL - * fallback - xml fault description or NULL - * return values: - * 0 - OK - * 1 - got a extended fault info - * 2 - internal gsoap fault - */ -static int clientGetFault(struct soap *soap, int err, const char **reason, struct jptype__genericFault **f, const char **fallback) { - struct SOAP_ENV__Detail *detail; - - *f = NULL; - if (fallback) *fallback = NULL; - - switch(err) { - case SOAP_OK: - return 0; - - case SOAP_FAULT: - case SOAP_SVR_FAULT: - detail = GLITE_SECURITY_GSOAP_DETAIL(soap); - if (reason) *reason = GLITE_SECURITY_GSOAP_REASON(soap); - - if (!detail) return 1; - if (detail->__type != GFNUM && detail->__any) { - // compatibility with clients gSoaps < 2.7.9b - if (fallback) *fallback = detail->__any; - return 1; - } - // client is based on gSoap 2.7.9b - assert(detail->__type == GFNUM); -#if GSOAP_VERSION >= 20709 - *f = (struct jptype__genericFault *)detail->fault; -#elif GSOAP_VERSION >= 20700 - *f = ((struct _genericFault *)detail->fault)->jpelem__genericFault; -#else - *f = ((struct _genericFault *)detail->value)->jpelem__genericFault; -#endif - return 1; - - default: - return 2; - } -} - - -static int glite_jp_clientGetErrno(struct soap *soap, int err) { - struct jptype__genericFault *f; - - switch(clientGetFault(soap, err, NULL, &f, NULL)) { - case 0: return 0; - case 1: return f ? f->code : -2; - default: return -1; - } -} - - -static int glite_jp_clientCheckFault(struct soap *soap, int err, const char *name, int toSyslog) -{ - struct jptype__genericFault *f; - const char *reason, *xml; - char indent[200] = " "; - char *prefix; - int retval; - - if (name) asprintf(&prefix, "[%s] ", name); - else prefix = strdup(""); - - switch(clientGetFault(soap, err, &reason, &f, &xml)) { - case 0: - retval = 0; - dprintf("%sOK\n", prefix); - break; - - case 1: - retval = -1; - dprintf("%s%s\n", prefix, reason); - if (toSyslog) syslog(LOG_ERR, "%s", reason); - if (!f && xml) { - dprintf("%s%s%s\n", prefix, indent, xml); - if (toSyslog) syslog(LOG_ERR, "%s", xml); - } - while (f) { - dprintf("%s%s%s: %s (%s)\n", - prefix, indent, - f->source, f->text, f->description); - if (toSyslog) syslog(LOG_ERR, "%s%s: %s (%s)", - prefix, f->source, f->text, f->description); - f = f->reason; - strcat(indent," "); - } - break; - - case 2: - fprintf(stderr, "%ssoap err=%d, ", prefix, err); - soap_print_fault(soap, stderr); - retval = -1; - break; - } - - free(prefix); - return retval; -} - - -static struct jptype__genericFault* jp2s_error(struct soap *soap, const glite_jp_error_t *err) -{ - struct jptype__genericFault *ret = NULL; - if (err) { - ret = soap_malloc(soap,sizeof *ret); - memset(ret,0,sizeof *ret); - ret->code = err->code; - ret->source = soap_strdup(soap,err->source); - ret->text = soap_strdup(soap,strerror(err->code)); - ret->description = err->desc ? soap_strdup(soap,err->desc) : NULL; - ret->reason = jp2s_error(soap,err->reason); - } - return ret; -} - - -static void glite_jp_server_err2fault(const glite_jp_context_t ctx,struct soap *soap) -{ - struct SOAP_ENV__Detail *detail; - struct jptype__genericFault *item; -#if GSOAP_VERSION >= 20709 - struct jptype__genericFault *f; - item = f = jp2s_error(soap,ctx->error); -#else - struct _genericFault *f = soap_malloc(soap, sizeof *f); - item = f->jpelem__genericFault = jp2s_error(soap,ctx->error); -#endif - soap_receiver_fault(soap,"Oh, shit!",NULL); - // no error in JP context? - if (!item) return; - - detail = (struct SOAP_ENV__Detail *)soap_faultdetail(soap); -#if GSOAP_VERSION >= 20700 - detail->fault = (void *)f; -#else - detail->value = (void *)f; -#endif - detail->__type = GFNUM; - detail->__any = NULL; - - if (soap->version == 2) soap->fault->SOAP_ENV__Detail = detail; - else soap->fault->detail = detail; -} diff --git a/org.glite.jp/.cvsignore b/org.glite.jp/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.jp/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.jp/build.xml b/org.glite.jp/build.xml deleted file mode 100644 index 7ffb4c0..0000000 --- a/org.glite.jp/build.xml +++ /dev/null @@ -1,410 +0,0 @@ - - - - - - - Ant build file to build the GLite Job Provenance Subsystem - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Preparing directories ... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <project name="${subsystem.name}" type="post-subsystem" packageName="${global.prefix}-${subsystem.prefix}"/> - - - - diff --git a/org.glite.jp/configure b/org.glite.jp/configure deleted file mode 100755 index 6b61ac6..0000000 --- a/org.glite.jp/configure +++ /dev/null @@ -1,691 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - gsoap => '/usr', - mysql => '/usr', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', -); - -my %jar = ( - 'commons-codec' => '/usr/share/java/commons-codec-1.3.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %topbuild; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour=s' => \$thrflavour, - 'nothrflavour=s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version and --output make sense only in --mode=etics\n" - if ($version || $output) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - print MAK "\tcd $full$build && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $topbuild{$_} ? - "\tcd $full$build && \${MAKE} distclean\n" : - "\trm -rf $full$build\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $topbuild{$_} ? '': '/build'; - - print MAK "$_: @dnames\n\tcd $full$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B/ ], - 'lb.common' => [ qw/expat cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus expat cares mysql cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/mysql/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B/ ], - 'security.gss' => [ qw/globus cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus cares gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/commons-codec/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lbjp-common.db' => [ qw/lbjp-common.trio/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@topbuild{@t} = (1) x ($#t+1); -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($topbuild{$_}) { - $build = '/build'; - unless (-d "$full/build") { - mkdir "$full/build" or die "mkdir $full/build: $!\n"; - } - unlink "$full/build/Makefile"; - symlink "../Makefile","$full/build/Makefile" or die "symlink ../Makefile $full/build/Makefile: $!\n"; - } - - open MKINC,">$full$build/Makefile.inc" - or die "$full$build/Makefile.inc: $!\n"; - - print "Creating $full$build/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus=>'vdt_globus_essentials', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - ); - %etics_projects = ( - vdt=>[qw/globus/], - 'org.glite'=>[qw/voms gridsite lcas/], - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"org.glite.$subsys.$module/project/version.properties" - or die "org.glite.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}/$_*.jar"; - } - - - my $conf = "glite-$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $topbuild{"$subsys.$module"} ? '' : "build.root = build\n"; - - my $confdir = $topbuild{"$subsys.$module"} ? '..' : '../..'; - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = org.glite.$subsys.$module -displayName = $conf -description = org.glite.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conf -version = $major.$minor.$rev -path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz - -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = cvs -d \${vcsroot} co -r \${tag} \${moduleName} - -[Platform-default:BuildCommand] -postpublish = None -packaging = None -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = make -init = None -install = make install -clean = make clean -test = make check -configure = cd $confdir && \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --module $subsys.$module @copts -checkstyle = None - -[Platform-default:Property] -$buildroot - -[Platform-default:DynamicDependency] - -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.jp/doc/README b/org.glite.jp/doc/README deleted file mode 100644 index 4a2d054..0000000 --- a/org.glite.jp/doc/README +++ /dev/null @@ -1 +0,0 @@ -All JP documentation is now in org.glite.jp.doc module. diff --git a/org.glite.jp/project/build.number b/org.glite.jp/project/build.number deleted file mode 100644 index add42f8..0000000 --- a/org.glite.jp/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Fri Oct 14 15:24:20 CEST 2005 -module.build=38 diff --git a/org.glite.jp/project/build.properties b/org.glite.jp/project/build.properties deleted file mode 100644 index 2a85dda..0000000 --- a/org.glite.jp/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -ext.gsoap.version=2.7.9d -ext.gsoap.rep.file=gSOAP-2.7.9d.tar.gz diff --git a/org.glite.jp/project/dependencies.properties b/org.glite.jp/project/dependencies.properties deleted file mode 100644 index 28948b6..0000000 --- a/org.glite.jp/project/dependencies.properties +++ /dev/null @@ -1,16 +0,0 @@ -################################################################### -# System dependencies -################################################################### - -org.glite.version = glite_branch_3_1_0 -org.glite.jp.version = HEAD - -# Component dependencies tag = do not remove this line = -org.glite.jp.ws-interface.version = HEAD -org.glite.jp.common.version = HEAD -org.glite.jp.server-common.version = HEAD -org.glite.jp.index.version = HEAD -org.glite.jp.primary.version = HEAD -org.glite.jp.client.version = HEAD - -ext.gsoap.version = 2.7.9d diff --git a/org.glite.jp/project/glite.jp.csf.xml b/org.glite.jp/project/glite.jp.csf.xml deleted file mode 100644 index ba274b4..0000000 --- a/org.glite.jp/project/glite.jp.csf.xml +++ /dev/null @@ -1,322 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The org.glite and org.glite.jp modules have been updated, please rerun the configuration file - - - - - The org.glite and org.glite.jp modules have been updated, please rerun the configuration file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp/project/properties.xml b/org.glite.jp/project/properties.xml deleted file mode 100755 index 276cf76..0000000 --- a/org.glite.jp/project/properties.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.jp/project/run-workspace b/org.glite.jp/project/run-workspace deleted file mode 100644 index a5d1f54..0000000 --- a/org.glite.jp/project/run-workspace +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh - -cd ../.. - -cvs co org.glite -cvs co org.glite.jp - -cd org.glite.jp/project -ant -f glite.jp.csf.xml - diff --git a/org.glite.jp/project/taskdefs.xml b/org.glite.jp/project/taskdefs.xml deleted file mode 100755 index c4cc889..0000000 --- a/org.glite.jp/project/taskdefs.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/org.glite.jp/project/version.properties b/org.glite.jp/project/version.properties deleted file mode 100644 index 6a4c8b1..0000000 --- a/org.glite.jp/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# : /cvs/jra1mw/org.glite.jp/project/version.properties,v 1.43 2009/03/13 10:21:06 zsustr Exp $ -module.version=1.6.0 -module.age=2 diff --git a/org.glite.lb-utils.context/.cvsignore b/org.glite.lb-utils.context/.cvsignore deleted file mode 100755 index 1df717b..0000000 --- a/org.glite.lb-utils.context/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.lb-utils.context/LICENSE b/org.glite.lb-utils.context/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.lb-utils.context/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb-utils.context/build.xml b/org.glite.lb-utils.context/build.xml deleted file mode 100644 index 81cd270..0000000 --- a/org.glite.lb-utils.context/build.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.context/project/build.number b/org.glite.lb-utils.context/project/build.number deleted file mode 100644 index 5cfec85..0000000 --- a/org.glite.lb-utils.context/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build = 0 diff --git a/org.glite.lb-utils.context/project/build.properties b/org.glite.lb-utils.context/project/build.properties deleted file mode 100755 index e69de29..0000000 diff --git a/org.glite.lb-utils.context/project/configure.properties.xml b/org.glite.lb-utils.context/project/configure.properties.xml deleted file mode 100644 index 0b17304..0000000 --- a/org.glite.lb-utils.context/project/configure.properties.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/org.glite.lb-utils.context/project/properties.xml b/org.glite.lb-utils.context/project/properties.xml deleted file mode 100644 index 86c1f8a..0000000 --- a/org.glite.lb-utils.context/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.context/project/version.properties b/org.glite.lb-utils.context/project/version.properties deleted file mode 100755 index 6f1f8ab..0000000 --- a/org.glite.lb-utils.context/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version = 0.0.0 -module.age = 0 \ No newline at end of file diff --git a/org.glite.lb-utils.db/.cvsignore b/org.glite.lb-utils.db/.cvsignore deleted file mode 100755 index ff82493..0000000 --- a/org.glite.lb-utils.db/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.project -.cdtproject -build -doc -reports diff --git a/org.glite.lb-utils.db/LICENSE b/org.glite.lb-utils.db/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.lb-utils.db/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb-utils.db/Makefile b/org.glite.lb-utils.db/Makefile deleted file mode 100644 index 447dd4c..0000000 --- a/org.glite.lb-utils.db/Makefile +++ /dev/null @@ -1,137 +0,0 @@ -# defaults -top_srcdir=. -builddir=build -stagedir=. -distdir=. -globalprefix=glite -lbutilsprefix=lb-utils -package=glite-lb-utils-db -version=0.2.0 -PREFIX=/opt/glite -flavour=gcc32thr - -glite_location=/opt/glite -mysql_prefix=/opt/mysql -mysql_version=4.1.11 -cppunit_prefix=/opt/cppunit -thrflavour=gcc32pthr -nothrflavour=gcc32 - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -CC=gcc - -VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/examples - -DEBUG:=-g -O0 -Wall - -CFLAGS:= \ - ${DEBUG} \ - -DVERSION=\"${version}\" \ - -I${stagedir}/include -I${top_srcdir}/src -I. \ - -I${top_srcdir}/interface \ - ${COVERAGE_FLAGS} \ - -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \ - -D_GNU_SOURCE - -ifdef LBS_DB_PROFILE - CFLAGS:=${CFLAGS} -DLBS_DB_PROFILE -endif - -TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit -TEST_INC:=-I${cppunit_prefix}/include - -LDFLAGS:=-L${stagedir}/lib ${COVERAGE_FLAGS} - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -archlib:=lib -host_cpu:=${shell uname -m} -ifeq (${host_cpu},x86_64) - archlib:=lib64 -endif - -ifneq (${mysql_prefix},/usr) - ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1) - mysqlib := -L${mysql_prefix}/${archlib}/mysql - else - mysqlib := -L${mysql_prefix}/${archlib} - endif -endif - -EXT_LIBS:=${mysqlib} -lmysqlclient -lz -lglite_lbu_trio -OBJS:=db.o -TESTOBJS:=dbtest.o -HDRS:=db.h -LOBJS:=${OBJS:.o=.lo} -LTESTOBJS:=${TESTOBJS:.o=.lo} - -libglite_lbu_db.la: ${LOBJS} - ${LINK} -o $@ $< ${EXT_LIBS} - -libglite_lbu_dbtest.la: ${LTESTOBJS} - ${LINK} -o $@ $< ${EXT_LIBS} - -dbtest.lo dbtest.o: db.c db.h - ${COMPILE} -DGLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH=10 -c $< -o $@ - -db_test: db_test.lo libglite_lbu_dbtest.la - ${LINK} -o $@ $+ ${EXT_LIBS} - -db_expire: db_expire.lo libglite_lbu_dbtest.la - ${LINK} -o $@ $+ ${EXT_LIBS} - -default all: compile - -compile: libglite_lbu_db.la - -check: - -echo No checks here yet. - -test_coverage: - -mkdir coverage - cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check - cd coverage && for i in `echo ${OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done - -examples: db_test db_expire - -doc: - doxygen C.dox - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - -mkdir -p ${PREFIX}/lib - -mkdir -p ${PREFIX}/include/${globalprefix}/${lbutilsprefix} -# ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 755 "libglite_lbu_db.la" "${PREFIX}/lib/libglite_lbu_db.la"; \ - ${INSTALL} -m 644 ${top_srcdir}/interface/${HDRS} ${PREFIX}/include/${globalprefix}/${lbutilsprefix} - -clean: - -%.o %.lo: %.c - ${COMPILE} -c $< - -db.lo: db.c db.h -db_test.lo: libglite_lbu_dbtest.la db.h db_test.c - -.PHONY: default all compile check examples doc stage dist distsrc distbin install clean test_coverage diff --git a/org.glite.lb-utils.db/build.xml b/org.glite.lb-utils.db/build.xml deleted file mode 100644 index 14d4d7e..0000000 --- a/org.glite.lb-utils.db/build.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.db/examples/db_expire.c b/org.glite.lb-utils.db/examples/db_expire.c deleted file mode 100644 index 012a91b..0000000 --- a/org.glite.lb-utils.db/examples/db_expire.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Example (and quick test) of prepared statements expirations. - * Use 'SET GLOBAL wait_timeout=...' for experimenting. - * - * Requires existing database with appropriate access and example table: - * - * mysqladmin -u root -p create test - * mysql -u root -p -e 'GRANT ALL on test.* to testuser@localhost' - * ./db_test - * - * Use CS environment variable when using different user/pwd@machine:dbname. - */ - -#include -#include -#include - -#include "db.h" - -#define CS "testuser/@localhost:test" -#define SELECT_CMD "SELECT id, user, info FROM data WHERE user = ?" - -#define dprintf(ARGS) { printf("%s: ", name); printf ARGS; } - - -static void print_blob(unsigned long len, char *blob) { - int i; - for (i = 0; i < len; i++) printf("%02X ", blob[i]); - printf("(='"); - for (i = 0; i < len; i++) printf("%c", blob[i]); - printf("')"); -} - - -static void print_free_result(const char *name, unsigned long *lens, char **res) { - dprintf((" id='%s'=%d\n", res[0], atoi(res[0]))); - - dprintf((" user='%s'\n", res[1])); - - dprintf((" blob=")); - if (res[2] && lens) print_blob(lens[2], res[2]); - else printf("null"); - printf("\n"); - - free(res[0]); - free(res[1]); - free(res[2]); -} - - -int main(int argn, char *argv[]) { - char *name, *user; - const char *cs; - glite_lbu_DBContext ctx; - glite_lbu_Statement stmt; - int caps, i, nr, c; - unsigned long lens[3]; - char *res[3]; - - if ((name = strrchr(argv[0], '/')) != NULL) name++; - else name = argv[0]; - if ((cs = getenv("CS")) == NULL) cs = CS; - - // init - dprintf(("connecting to %s...\n", cs)); - if (glite_lbu_InitDBContext(&ctx) != 0) goto fail; - if (glite_lbu_DBConnect(ctx, cs) != 0) goto failctx; - if ((caps = glite_lbu_DBQueryCaps(ctx)) == -1) goto failcon; - if ((caps & GLITE_LBU_DB_CAP_PREPARED) == 0) { - dprintf(("can't do prepared commands, exiting.")); - goto failcon; - } - // caps - glite_lbu_DBSetCaps(ctx, caps); - dprintf(("capabilities: %d\n", caps)); - - user = NULL; - dprintf(("preparing '%s'...\n", user)); - if ((glite_lbu_PrepareStmt(ctx, SELECT_CMD, &stmt)) != 0) goto failcon; - - do { - user = "cicomexocitl.civ"; - dprintf(("executing '%s'...\n", user)); - if (glite_lbu_ExecStmt(stmt, 1, GLITE_LBU_DB_TYPE_VARCHAR, user) == -1) goto failstmt; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) { - dprintf(("fetch '%s' failed\n", user)); - break; - } - dprintf(("\n")); - - c = fgetc(stdin); - } while (c != -1 && (c == '\r' || c == '\n')); - - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); - glite_lbu_FreeDBContext(ctx); - return 0; - -failstmt: - printf("closing stmt...\n"); - glite_lbu_FreeStmt(&stmt); -failcon: - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); -failctx: - glite_lbu_FreeDBContext(ctx); -fail: - dprintf(("failed\n")); - return 1; -} diff --git a/org.glite.lb-utils.db/examples/db_test.c b/org.glite.lb-utils.db/examples/db_test.c deleted file mode 100644 index 02be92a..0000000 --- a/org.glite.lb-utils.db/examples/db_test.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Example (and quick test) of this DB module. - * - * Requires existing database with appropriate access: - * - * mysqladmin -u root -p create test - * mysql -u root -p -e 'GRANT ALL on test.* to testuser@localhost' - * - * Use CS environment variable when using different user/pwd@machine:dbname. - */ - -#include -#include -#include - -#include "db.h" - -#define CS "testuser/@localhost:test" -#define CREATE_CMD "CREATE TABLE data (\n\ - id INT NOT NULL,\n\ - user VARCHAR(32) NOT NULL,\n\ - info BLOB,\n\ - PRIMARY KEY (id),\n\ - INDEX(user)\n\ -) engine=innodb" -#define DROP_CMD "DROP TABLE data" -#define INSERT_TRIO_CMD "INSERT INTO data (id, user, info) VALUES (%d, %s, %s)" -#define SELECT_TRIO_CMD "SELECT id, user, info FROM data WHERE user = '%s'" -#define INSERT_CMD "INSERT INTO data (id, user, info) VALUES (?, ?, ?)" -#define SELECT_CMD "SELECT id, user, info FROM data WHERE user = ?" - -#define dprintf(ARGS) { printf("%s: ", name); printf ARGS; } - - -static void print_blob(unsigned long len, char *blob) { - int i; - for (i = 0; i < len; i++) printf("%02X ", blob[i]); - printf("(='"); - for (i = 0; i < len; i++) printf("%c", blob[i]); - printf("')"); -} - - -static void print_free_result(const char *name, unsigned long *lens, char **res) { - dprintf((" id='%s'=%d\n", res[0], atoi(res[0]))); - - dprintf((" user='%s'\n", res[1])); - - dprintf((" blob=")); - if (res[2] && lens) print_blob(lens[2], res[2]); - else printf("null"); - printf("\n"); - - free(res[0]); - free(res[1]); - free(res[2]); -} - - -int main(int argn, char *argv[]) { - char *name, *cmd; - const char *cs; - glite_lbu_DBContext ctx; - glite_lbu_Statement stmt; - int caps; - - char blob1[] = "Guess: blob or \000string?"; - char blob2[] = {0, 1, 2, 3, 4, 5}; - - int nr; - char *res[3]; - unsigned long lens[3]; - - if ((name = strrchr(argv[0], '/')) != NULL) name++; - else name = argv[0]; - if ((cs = getenv("CS")) == NULL) cs = CS; - cmd = NULL; - - // init - dprintf(("connecting to %s...\n", cs)); - if (glite_lbu_InitDBContext(&ctx) != 0) goto fail; - if (glite_lbu_DBConnect(ctx, cs) != 0) goto failctx; - if ((caps = glite_lbu_DBQueryCaps(ctx)) == -1) goto failcon; - if ((caps & GLITE_LBU_DB_CAP_PREPARED) == 0) { - dprintf(("can't do prepared commands, exiting.")); - goto failcon; - } - // caps - glite_lbu_DBSetCaps(ctx, caps || GLITE_LBU_DB_CAP_ERRORS); - dprintf(("capabilities: %d\n", caps)); - // create all needed tables and data - dprintf(("creating tables...\n")); - glite_lbu_ExecSQL(ctx, DROP_CMD, NULL); - if (glite_lbu_ExecSQL(ctx, CREATE_CMD, NULL) == -1) goto failcon; - // trio-insert - dprintf(("trio-insert...\n")); - asprintf(&cmd, INSERT_TRIO_CMD, 1, "'hyperochus'", "NULL"); - if (glite_lbu_ExecSQL(ctx, cmd, NULL) != 1) goto failcon; - free(cmd); cmd = NULL; - // prepared-insert - dprintf(("prepare-insert...\n")); - if (glite_lbu_PrepareStmt(ctx, INSERT_CMD, &stmt) != 0) goto failcon; - dprintf(("execute 1. insert...\n")); - if (glite_lbu_ExecStmt(stmt, 3, - GLITE_LBU_DB_TYPE_INT, 2, - GLITE_LBU_DB_TYPE_VARCHAR, "cicomexocitl.civ", - GLITE_LBU_DB_TYPE_BLOB, blob1, sizeof(blob1) - 1) != 1) goto failstmt; - dprintf(("execute 2. insert...\n")); - if (glite_lbu_ExecStmt(stmt, 3, - GLITE_LBU_DB_TYPE_INT, 3, - GLITE_LBU_DB_TYPE_VARCHAR, "tartarus", - GLITE_LBU_DB_TYPE_NULL) != 1) goto failstmt; - dprintf(("execute 3. insert...\n")); - if (glite_lbu_ExecStmt(stmt, 3, - GLITE_LBU_DB_TYPE_INT, 4, - GLITE_LBU_DB_TYPE_VARCHAR, "harpia", - GLITE_LBU_DB_TYPE_BLOB, blob2, sizeof(blob2)) != 1) goto failstmt; - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); - - // trio-query -{ - const char *user; - - user = "harpia"; - dprintf(("selecting '%s'...\n", user)); - asprintf(&cmd, SELECT_TRIO_CMD, user); - if (glite_lbu_ExecSQL(ctx, cmd, &stmt) == -1) goto failcon; - free(cmd); cmd = NULL; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) dprintf(("fetch '%s' failed\n", user)); - dprintf(("closing stmt...\n")); - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); - - user = "nobody"; - dprintf(("selecting '%s'...\n", user)); - asprintf(&cmd, SELECT_TRIO_CMD, user); - if (glite_lbu_ExecSQL(ctx, cmd, &stmt) == -1) goto failcon; - free(cmd); cmd = NULL; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) dprintf(("fetch '%s' failed\n", user)); - dprintf(("closing stmt...\n")); - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); -} - - // "param" queries -{ - const char *user = NULL; - - dprintf(("preparing '%s'...\n", user)); - if ((glite_lbu_PrepareStmt(ctx, SELECT_CMD, &stmt)) != 0) goto failcon; - - user = "cicomexocitl.civ"; - dprintf(("executing '%s'...\n", user)); - if (glite_lbu_ExecStmt(stmt, 1, GLITE_LBU_DB_TYPE_VARCHAR, user) == -1) goto failstmt; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) dprintf(("fetch '%s' failed\n", user)); - dprintf(("\n")); - - dprintf(("closing stmt...\n")); - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); -} - - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); - glite_lbu_FreeDBContext(ctx); - return 0; - -failstmt: - printf("closing stmt...\n"); - glite_lbu_FreeStmt(&stmt); -failcon: - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); -failctx: - glite_lbu_FreeDBContext(ctx); -fail: - free(cmd); - dprintf(("failed\n")); - return 1; -} diff --git a/org.glite.lb-utils.db/interface/db.h b/org.glite.lb-utils.db/interface/db.h deleted file mode 100644 index 2818a4e..0000000 --- a/org.glite.lb-utils.db/interface/db.h +++ /dev/null @@ -1,344 +0,0 @@ -#ifndef GLITE_LBU_DB_H -#define GLITE_LBU_DB_H - -#ident "$Header$" - - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * \file db.h - * \defgroup database Database module - * - * Database modul module API (LB & JP Utils). - * - * There are two ways to access DB here: - * - simple: - * - * SQL commands as single string. All values are incorporated in the SQL command strings. Proper escaping is required. - * - enhanced: - * - * Prepared SQL commands with separated parameters, functions PrepareStmt() and ExecStmt(). All values are delivered in separated buffers. Its faster for multiple using and more secure. - * @{ - */ - - -/** - * Enable transaction support if available. - * - * With disabled transaction can be used transaction functions, they are just ignored. - */ -#define GLITE_LBU_DB_CAP_TRANSACTIONS 1 - -/** - * Check prepared parameters support. - */ -#define GLITE_LBU_DB_CAP_PREPARED 2 - -/** - * Check for getting indexes support. - * - * Needed for QueryIndices call. - */ -#define GLITE_LBU_DB_CAP_INDEX 4 - - -/** - * Print all errors. - * - * Not returned from detection of capabilities. - */ -#define GLITE_LBU_DB_CAP_ERRORS 8 - - -/** - * Database connection context. - */ -typedef struct glite_lbu_DBContext_s *glite_lbu_DBContext; - - -/** - * Prepared statement, used for SQL statement with parameters. - */ -typedef struct glite_lbu_Statement_s *glite_lbu_Statement; - - -/** - * Structure holds date for multi-rows insert. - */ -typedef struct glite_lbu_bufInsert_s *glite_lbu_bufInsert; - - - -/** - * All types of parameteres, they match to the SQL types. - */ -typedef enum { - GLITE_LBU_DB_TYPE_NULL = 0, - GLITE_LBU_DB_TYPE_TINYINT = 1, - GLITE_LBU_DB_TYPE_INT = 2, - GLITE_LBU_DB_TYPE_TINYBLOB = 3, - GLITE_LBU_DB_TYPE_TINYTEXT = 4, - GLITE_LBU_DB_TYPE_BLOB = 5, - GLITE_LBU_DB_TYPE_TEXT = 6, - GLITE_LBU_DB_TYPE_MEDIUMBLOB = 7, - GLITE_LBU_DB_TYPE_MEDIUMTEXT = 8, - GLITE_LBU_DB_TYPE_LONGBLOB = 9, - GLITE_LBU_DB_TYPE_LONGTEXT = 10, - GLITE_LBU_DB_TYPE_VARCHAR = 11, - GLITE_LBU_DB_TYPE_CHAR = 12, - GLITE_LBU_DB_TYPE_DATE = 13, - GLITE_LBU_DB_TYPE_TIME = 14, - GLITE_LBU_DB_TYPE_DATETIME = 15, - GLITE_LBU_DB_TYPE_TIMESTAMP = 16, - GLITE_LBU_DB_TYPE_LAST = 17 -} glite_lbu_DBType; - - - -/** - * Get error state from DB context. - * - * \param[in] ctx context to work with - * \param[out] text error name - * \param[out] desc error description - */ -int glite_lbu_DBError(glite_lbu_DBContext ctx, char **text, char **desc); - - -/** - * Initialize the database context. - * - * \param[out] ctx result context - */ -int glite_lbu_InitDBContext(glite_lbu_DBContext *ctx); - - -/** - * Free database context. - */ -void glite_lbu_FreeDBContext(glite_lbu_DBContext ctx); - - -/** - * Connect to the given database. - * - * \param[out] ctx context to work with - * \param[in] cs connect string user/password\@host:database - * - * \return error code, 0 = OK - */ -int glite_lbu_DBConnect(glite_lbu_DBContext ctx, const char *cs); - - -/** - * Close the connection. - * - * \param[in,out] ctx context to work with - */ -void glite_lbu_DBClose(glite_lbu_DBContext ctx); - - -/** - * Check database version and capabilities. - * - * \param[in,out] ctx context to work with - * - * \return capabilities - * \retval -1 error occured - */ -int glite_lbu_DBQueryCaps(glite_lbu_DBContext ctx); - - -/** - * Set the database capabilities on already initialized context. - * - * It should be find out by DBQueryCaps() first. - * - * \param[in,out] ctx context to work with - * \param[in] caps capabilities to use, should be found out by QueryCaps() - */ -void glite_lbu_DBSetCaps(glite_lbu_DBContext ctx, int caps); - - -/** - * Start transaction. - */ -int glite_lbu_Transaction(glite_lbu_DBContext ctx); - - -/** - * Commit (end) transaction. - */ -int glite_lbu_Commit(glite_lbu_DBContext ctx); - - -/** - * Cancel transaction. - */ -int glite_lbu_Rollback(glite_lbu_DBContext ctx); - - -/** - * \param[in,out] stmt executed SQL statement - * \param[in] n number of items for sure there is enough space in lengths and results - * \param[out] lengths array with lengths (good for data blobs), may be NULL - * \param[out] results array with results, all items are allocated - * - * \retval >0 number of fields of the retrieved row - * \retval 0 no more rows - * \retval -1 error - */ -int glite_lbu_FetchRow(glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results); - - -/** - * Free the statement structure and destroy its parameters. - * - * Statement will be set to NULL and multiple calls are allowed. - * - * \param[in,out] stmt statement - */ -void glite_lbu_FreeStmt(glite_lbu_Statement *stmt); - - -/** - * Parse and execute one simple SQL statement. - * All values are incorporated int the SQL command string. - * - * \param[in,out] ctx context to work with - * \param[in] cmd SQL command - * \param[out] stmt statement handle with results (makes sense for selects only) - * - * \return number of rows selected, created or affected by update, -1 on error - */ -int glite_lbu_ExecSQL(glite_lbu_DBContext ctx, const char *cmd, glite_lbu_Statement *stmt); - - -/** - * Query for column names of the statement. - * - * It work only for simple API, so only after ExecSQL(). - * - * \param[in,out] stmt the statement handle - * \param[out] cols result array of names - * - * \return error code - */ -int glite_lbu_QueryColumns(glite_lbu_Statement stmt, char **cols); - - -/** - * Retrieve column names of a query simple SQL statement. - * - * \param[in,out] ctx context to work with - * \param[in] table table name - * \param[out] key_names one-dimensional index names array - * \param[out] column_names two-dimensional column names array - * - * \return 0 if OK, nonzero on error - */ -int glite_lbu_QueryIndices(glite_lbu_DBContext ctx, const char *table, char ***key_names, char ****column_names); - - -/** - * Convert time_t into database-specific time string. - * - * The result string can be used directly in SQL commands. - * - * \param[in] t the converted time - * \param[out] str result allocated string - */ -void glite_lbu_TimeToDB(time_t t, char **str); - - -/** - * Convert database-specific time string to time_t. - * - * String is expected in database for (ISO format). - * - * \param[in] str the converted string - * \return result time - */ -time_t glite_lbu_DBToTime(const char *str); - - -/** - * Init data structure for buffered insert - * - * takes table_name and columns string for future multirow insert - * when insert string oversize size_limit or number of rows to be inserted - * overcome record_limit, the real insert is triggered - */ -int glite_lbu_bufferedInsertInit(glite_lbu_DBContext ctx, glite_lbu_bufInsert *bi, void *mysql, const char *table_name, long size_limit, long record_limit, const char * columns); - - -/** - * adds row of n values into n columns into an insert buffer - * if num. of rows or size of data oversteps the limits, real - * multi-row insert is done - */ -int glite_lbu_bufferedInsert(glite_lbu_bufInsert bi, const char *row); - - -/** - * Flush buffered data and free bi structure. - */ -int glite_lbu_bufferedInsertClose(glite_lbu_bufInsert bi); - - -/** - * Prepare the SQL statement. Use glite_lbu_FreeStmt() to free it. - * - * \param[in,out] ctx context to work with - * \param[in] sql SQL command - * \param[out] stmt returned SQL statement - * - * \return error code - */ -int glite_lbu_PrepareStmt(glite_lbu_DBContext ctx, const char *sql, glite_lbu_Statement *stmt); - - -/** - * Execute prepared SQL statement. - * - * \param[in,out] stmt SQL statement - * \param[in] n number of items - * - * Variable parameters (n-times): - * - * always: - * - * \param type DB item type - * - * then one of them: - * - * \param GLITE_LBU_DB_TYPE_TINYINT int c - * \param GLITE_LBU_DB_TYPE_INT long int i - * \param GLITE_LBU_DB_TYPE_...BLOB/TEXT void *b, unsigned long len - * \param GLITE_LBU_DB_TYPE_[VAR]CHAR char *str - * \param GLITE_LBU_DB_TYPE_DATE/TIME/DATETIME time_t t - * \param GLITE_LBU_DB_TYPE_TIMESTAMP time_t t - * \param GLITE_LBU_DB_TYPE_NULL - - * - * \return number of affected rows, -1 on error - */ -int glite_lbu_ExecStmt(glite_lbu_Statement stmt, int n, ...); - - -/** - * @} database group - */ - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.lb-utils.db/project/build.number b/org.glite.lb-utils.db/project/build.number deleted file mode 100644 index 5cfec85..0000000 --- a/org.glite.lb-utils.db/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build = 0 diff --git a/org.glite.lb-utils.db/project/build.properties b/org.glite.lb-utils.db/project/build.properties deleted file mode 100755 index 1df02e3..0000000 --- a/org.glite.lb-utils.db/project/build.properties +++ /dev/null @@ -1,3 +0,0 @@ -lb-utils.subsystem.name = org.glite.lb-utils -lb-utils.subsystem.prefix = lb-utils - diff --git a/org.glite.lb-utils.db/project/configure.properties.xml b/org.glite.lb-utils.db/project/configure.properties.xml deleted file mode 100644 index 276b497..0000000 --- a/org.glite.lb-utils.db/project/configure.properties.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbutilsprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -flavour=${with.globus.thr.flavor} - -glite_location=${with.glite.location} -mysql_prefix=${with.mysql.prefix} -mysql_version=${ext.mysql.version} -cppunit_prefix=${with.cppunit.prefix} - - -PROJECT_NAME = "Glite LB/JP Utils: Database Module" -PROJECT_NUMBER = ${module.version} -OUTPUT_DIRECTORY = ${component.dir}/doc/C -OPTIMIZE_OUTPUT_FOR_C = YES -INPUT = ../interface/db.h -SHOW_DIRECTORIES = NO -FULL_PATH_NAMES = NO -EXTRACT_ALL = YES -PDF_HYPERLINKS = YES -USE_PDFLATEX = YES -MACRO_EXPANSION = YES -EXPAND_ONLY_PREDEF = YES -#PREDEFINED = _EDG_WLL_EVENT_COMMON -HAVE_DOT = NO - - - - diff --git a/org.glite.lb-utils.db/project/properties.xml b/org.glite.lb-utils.db/project/properties.xml deleted file mode 100644 index d01c359..0000000 --- a/org.glite.lb-utils.db/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.db/project/tar_exclude b/org.glite.lb-utils.db/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.lb-utils.db/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.lb-utils.db/project/version.properties b/org.glite.lb-utils.db/project/version.properties deleted file mode 100755 index 6f1f8ab..0000000 --- a/org.glite.lb-utils.db/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version = 0.0.0 -module.age = 0 \ No newline at end of file diff --git a/org.glite.lb-utils.db/src/db.c b/org.glite.lb-utils.db/src/db.c deleted file mode 100644 index bce48b8..0000000 --- a/org.glite.lb-utils.db/src/db.c +++ /dev/null @@ -1,1039 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "db.h" - - -#define GLITE_LBU_MYSQL_INDEX_VERSION 40001 -#define GLITE_LBU_MYSQL_PREPARED_VERSION 40102 -#define BUF_INSERT_ROW_ALLOC_BLOCK 1000 -#ifndef GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH -#define GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH 256 -#endif - - -#define CLR_ERR(CTX) lbu_clrerr((CTX)) -#define ERR(CTX, CODE, DESC) lbu_err((CTX), (CODE), (DESC), __FUNCTION__, __LINE__) -#define STATUS(CTX) ((CTX)->err.code) -#define MY_ERR(CTX) myerr((CTX), __FUNCTION__, __LINE__) -#define MY_ERRSTMT(STMT) myerrstmt((STMT), __FUNCTION__, __LINE__) -#define MY_ISOKSTMT(STMT, RETRY) myisokstmt((STMT), __FUNCTION__, __LINE__, (RETRY)) - -#define USE_TRANS(CTX) ((CTX->caps & GLITE_LBU_DB_CAP_TRANSACTIONS) != 0) - -#define dprintf(CTX, FMT...) if (CTX->caps & GLITE_LBU_DB_CAP_ERRORS) fprintf(stderr, ##FMT) - - -struct glite_lbu_DBContext_s { - MYSQL *mysql; - const char *cs; - int have_caps; - int caps; - struct { - int code; - char *desc; - } err; -}; - - -struct glite_lbu_Statement_s { - glite_lbu_DBContext ctx; - - /* for simple commands */ - MYSQL_RES *result; - - /* for prepared commands */ - MYSQL_STMT *stmt; - unsigned long nrfields; -}; - - -struct glite_lbu_bufInsert_s { - glite_lbu_DBContext ctx; - char *table_name; - char *columns; /* names of columns to be inserted into - * (values separated with commas) */ - char **rows; /* each row hold string of one row to be inserted - * (values separated with commas) */ - long rec_num, /* actual number of rows in structure */ - rec_size; /* approx. size of a real insert string */ - long size_limit, /* size and # of records limit which trigger */ - record_limit; /* real insert; zero means unlimitted */ -}; - - -/* - * mapping glite DB types to mysql types - */ -int glite_type_to_mysql[] = { - MYSQL_TYPE_NULL, - MYSQL_TYPE_TINY, - MYSQL_TYPE_LONG, - MYSQL_TYPE_TINY_BLOB, - MYSQL_TYPE_TINY_BLOB, - MYSQL_TYPE_BLOB, - MYSQL_TYPE_BLOB, - MYSQL_TYPE_MEDIUM_BLOB, - MYSQL_TYPE_MEDIUM_BLOB, - MYSQL_TYPE_LONG_BLOB, - MYSQL_TYPE_LONG_BLOB, - MYSQL_TYPE_VAR_STRING, - MYSQL_TYPE_STRING, - MYSQL_TYPE_DATE, - MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME, - MYSQL_TYPE_TIMESTAMP, -}; - - - -static int lbu_clrerr(glite_lbu_DBContext ctx); -static int lbu_err(glite_lbu_DBContext ctx, int code, const char *desc, const char *func, int line); -static int myerr(glite_lbu_DBContext ctx, const char *source, int line); -static int myerrstmt(glite_lbu_Statement stmt, const char *source, int line); -static int myisokstmt(glite_lbu_Statement stmt, const char *source, int line, int *retry); -static int db_connect(glite_lbu_DBContext ctx, const char *cs, MYSQL **mysql); -static void db_close(MYSQL *mysql); -static int transaction_test(glite_lbu_DBContext ctx, MYSQL *m2, int *have_transactions); -static int FetchRowSimple(glite_lbu_DBContext ctx, MYSQL_RES *result, unsigned long *lengths, char **results); -static int FetchRowPrepared(glite_lbu_DBContext ctx, glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results); -void set_time(MYSQL_TIME *mtime, const time_t time); -time_t get_time(const MYSQL_TIME *mtime); - - -/* ---- common ---- */ - - -int glite_lbu_DBError(glite_lbu_DBContext ctx, char **text, char **desc) { - if (text) *text = strdup(strerror(ctx->err.code)); - if (desc) { - if (ctx->err.desc) *desc = strdup(ctx->err.desc); - else *desc = NULL; - } - - return ctx->err.code; -} - - -int glite_lbu_InitDBContext(glite_lbu_DBContext *ctx) { - *ctx = calloc(1, sizeof **ctx); - return *ctx == NULL ? ENOMEM : 0; -} - - -void glite_lbu_FreeDBContext(glite_lbu_DBContext ctx) { - if (ctx) { - assert(ctx->mysql == NULL); - free(ctx->err.desc); - free(ctx); - } -} - - -int glite_lbu_DBConnect(glite_lbu_DBContext ctx, const char *cs) { - if (db_connect(ctx, cs, &ctx->mysql) != 0) return STATUS(ctx); - return 0; -} - - -void glite_lbu_DBClose(glite_lbu_DBContext ctx) { - db_close(ctx->mysql); - ctx->mysql = NULL; -} - - -int glite_lbu_DBQueryCaps(glite_lbu_DBContext ctx) { - MYSQL *m = ctx->mysql; - MYSQL *m2; - int major,minor,sub,version,caps,have_transactions=0; - const char *ver_s; - - if (ctx->have_caps) return ctx->caps; - - caps = 0; - - ver_s = mysql_get_server_info(m); - if (!ver_s || 3 != sscanf(ver_s,"%d.%d.%d",&major,&minor,&sub)) - return ERR(ctx, EINVAL, "problem retreiving MySQL version"); - version = 10000*major + 100*minor + sub; - - if (version >= GLITE_LBU_MYSQL_INDEX_VERSION) caps |= GLITE_LBU_DB_CAP_INDEX; - if (version >= GLITE_LBU_MYSQL_PREPARED_VERSION) caps |= GLITE_LBU_DB_CAP_PREPARED; - - CLR_ERR(ctx); - - if (db_connect(ctx, ctx->cs, &m2) == 0) { - transaction_test(ctx, m2, &have_transactions); - db_close(m2); - } - if (have_transactions) caps |= GLITE_LBU_DB_CAP_TRANSACTIONS; - - if (STATUS(ctx) == 0) { - ctx->have_caps = 1; - return caps; - } else return -1; -} - - -void glite_lbu_DBSetCaps(glite_lbu_DBContext ctx, int caps) { - ctx->caps = caps; -} - - -int glite_lbu_Transaction(glite_lbu_DBContext ctx) { - if (USE_TRANS(ctx)) { - if (glite_lbu_ExecSQL(ctx, "SET AUTOCOMMIT=0", NULL) < 0) goto err; - if (glite_lbu_ExecSQL(ctx, "BEGIN", NULL) < 0) goto err; - } -err: - return STATUS(ctx); -} - - -int glite_lbu_Commit(glite_lbu_DBContext ctx) { - if (USE_TRANS(ctx)) { - if (glite_lbu_ExecSQL(ctx, "COMMIT", NULL) < 0) goto err; - if (glite_lbu_ExecSQL(ctx, "SET AUTOCOMMIT=1", NULL) < 0) goto err; - } -err: - return STATUS(ctx); -} - - -int glite_lbu_Rollback(glite_lbu_DBContext ctx) { - if (USE_TRANS(ctx)) { - if (glite_lbu_ExecSQL(ctx, "ROLLBACK", NULL) < 0) goto err; - if (glite_lbu_ExecSQL(ctx, "SET AUTOCOMMIT=1", NULL) < 0) goto err; - } -err: - return STATUS(ctx); -} - - -int glite_lbu_FetchRow(glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results) { - memset(results, 0, n * sizeof(*results)); - if (stmt->result) return FetchRowSimple(stmt->ctx, stmt->result, lengths, results); - else return FetchRowPrepared(stmt->ctx, stmt, n, lengths, results); -} - - -void glite_lbu_FreeStmt(glite_lbu_Statement *stmt) { - if (*stmt) { - if ((*stmt)->result) mysql_free_result((*stmt)->result); - if ((*stmt)->stmt) mysql_stmt_close((*stmt)->stmt); - free(*stmt); - *stmt = NULL; - } -} - - -int glite_lbu_QueryIndices(glite_lbu_DBContext ctx, const char *table, char ***key_names, char ****column_names) { - glite_lbu_Statement stmt = NULL; - - int i,j,ret; - -/* XXX: "show index from" columns. Matches at least MySQL 4.0.11 */ - char *showcol[12]; - int Key_name,Seq_in_index,Column_name,Sub_part; - - char **keys = NULL; - int *cols = NULL; - char **col_names = NULL; - - int nkeys = 0; - - char ***idx = NULL; - - Key_name = Seq_in_index = Column_name = Sub_part = -1; - - if (glite_lbu_ExecSQL(ctx,"show index from states",&stmt)<0) - return STATUS(ctx); - - while ((ret = glite_lbu_FetchRow(stmt,sizeof(showcol)/sizeof(showcol[0]),NULL,showcol)) > 0) { - assert(ret <= sizeof showcol/sizeof showcol[0]); - - if (!col_names) { - col_names = malloc(ret * sizeof col_names[0]); - glite_lbu_QueryColumns(stmt,col_names); - for (i=0; i= 0 && Seq_in_index >= 0 && - Column_name >= 0 && Sub_part >= 0); - - } - - for (i=0; imysql, cmd)) { - /* error occured */ - switch (merr = mysql_errno(ctx->mysql)) { - case 0: - break; - case ER_DUP_ENTRY: - ERR(ctx, EEXIST, mysql_error(ctx->mysql)); - return -1; - break; - case CR_SERVER_LOST: - if (retry_nr <= 0) - do_reconnect = 1; - break; - default: - MY_ERR(ctx); - return -1; - break; - } - } - retry_nr++; - } - - if (stmt) { - *stmt = calloc(1, sizeof(**stmt)); - if (!*stmt) { - ERR(ctx, ENOMEM, NULL); - return -1; - } - (**stmt).ctx = ctx; - (**stmt).result = mysql_store_result(ctx->mysql); - if (!(**stmt).result) { - if (mysql_errno(ctx->mysql)) { - MY_ERR(ctx); - *stmt = NULL; - return -1; - } - } - } else { - MYSQL_RES *r = mysql_store_result(ctx->mysql); - mysql_free_result(r); - } -#ifdef LBS_DB_PROFILE - pid = getpid(); - gettimeofday(&end,NULL); - end.tv_usec -= start.tv_usec; - end.tv_sec -= start.tv_sec; - if (end.tv_usec < 0) { end.tv_sec--; end.tv_usec += 1000000; } - - sum.tv_usec += end.tv_usec; - sum.tv_sec += end.tv_sec + sum.tv_usec / 1000000; - sum.tv_usec -= 1000000 * (sum.tv_usec / 1000000); - fprintf(stderr,"[%d] %s\n[%d] %3ld.%06ld (sum: %3ld.%06ld)\n",pid,txt,pid,end.tv_sec,end.tv_usec,sum.tv_sec,sum.tv_usec); -#endif - - return mysql_affected_rows(ctx->mysql); -} - - -int glite_lbu_QueryColumns(glite_lbu_Statement stmt, char **cols) -{ - int i = 0; - MYSQL_FIELD *f; - - if (!stmt->result) return ERR(stmt->ctx, EINVAL, "QueryColumns implemented only for simple API"); - while ((f = mysql_fetch_field(stmt->result))) cols[i++] = f->name; - return i == 0; -} - - -void glite_lbu_TimeToDB(time_t t, char **str) { - struct tm *tm = gmtime(&t); - - asprintf(str,"'%4d-%02d-%02d %02d:%02d:%02d'",tm->tm_year+1900,tm->tm_mon+1, - tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); -} - - -time_t glite_lbu_DBToTime(const char *str) { - struct tm tm; - - memset(&tm,0,sizeof(tm)); - setenv("TZ","UTC",1); tzset(); - sscanf(str,"%4d-%02d-%02d %02d:%02d:%02d", - &tm.tm_year,&tm.tm_mon,&tm.tm_mday, - &tm.tm_hour,&tm.tm_min,&tm.tm_sec); - tm.tm_year -= 1900; - tm.tm_mon--; - - return mktime(&tm); -} - -/* ---- prepared --- */ - -int glite_lbu_PrepareStmt(glite_lbu_DBContext ctx, const char *sql, glite_lbu_Statement *stmt) { - int ret, retry; - MYSQL_RES *meta; - - // init - *stmt = calloc(1, sizeof(**stmt)); - (*stmt)->ctx = ctx; - - // create the SQL command - if (((*stmt)->stmt = mysql_stmt_init(ctx->mysql)) == NULL) - return MY_ERRSTMT(*stmt); - - // prepare the SQL command - retry = 1; - do { - mysql_stmt_prepare((*stmt)->stmt, sql, strlen(sql)); - ret = MY_ISOKSTMT(*stmt, &retry); - } while (ret == 0); - if (ret == -1) goto failed; - - // number of fields (0 for no results) - if ((meta = mysql_stmt_result_metadata((*stmt)->stmt)) != NULL) { - (*stmt)->nrfields = mysql_num_fields(meta); - mysql_free_result(meta); - } else - (*stmt)->nrfields = 0; - - return CLR_ERR(ctx); - -failed: - glite_lbu_FreeStmt(stmt); - return STATUS(ctx); -} - - -int glite_lbu_ExecStmt(glite_lbu_Statement stmt, int n, ...) { - int i; - va_list ap; - glite_lbu_DBType type; - char *pchar; - long int *plint; - MYSQL_TIME *ptime; - glite_lbu_DBContext ctx; - int ret, retry; - MYSQL_BIND *binds = NULL; - void **data = NULL; - unsigned long *lens; - - // gather parameters - if (n) { - binds = calloc(n, sizeof(MYSQL_BIND)); - data = calloc(n, sizeof(void *)); - lens = calloc(n, sizeof(unsigned long *)); - } - va_start(ap, n); - for (i = 0; i < n; i++) { - type = va_arg(ap, glite_lbu_DBType); - switch (type) { - case GLITE_LBU_DB_TYPE_TINYINT: - pchar = binds[i].buffer = data[i] = malloc(sizeof(char)); - *pchar = va_arg(ap, int); - break; - - case GLITE_LBU_DB_TYPE_INT: - plint = binds[i].buffer = data[i] = malloc(sizeof(long int)); - *plint = va_arg(ap, long int); - break; - - case GLITE_LBU_DB_TYPE_TINYBLOB: - case GLITE_LBU_DB_TYPE_TINYTEXT: - case GLITE_LBU_DB_TYPE_BLOB: - case GLITE_LBU_DB_TYPE_TEXT: - case GLITE_LBU_DB_TYPE_MEDIUMBLOB: - case GLITE_LBU_DB_TYPE_MEDIUMTEXT: - case GLITE_LBU_DB_TYPE_LONGBLOB: - case GLITE_LBU_DB_TYPE_LONGTEXT: - binds[i].buffer = va_arg(ap, void *); - binds[i].length = &lens[i]; - lens[i] = va_arg(ap, unsigned long); - break; - - case GLITE_LBU_DB_TYPE_VARCHAR: - case GLITE_LBU_DB_TYPE_CHAR: - binds[i].buffer = va_arg(ap, char *); - binds[i].length = &lens[i]; - lens[i] = binds[i].buffer ? strlen((char *)binds[i].buffer) : 0; - break; - - case GLITE_LBU_DB_TYPE_DATE: - case GLITE_LBU_DB_TYPE_TIME: - case GLITE_LBU_DB_TYPE_DATETIME: - case GLITE_LBU_DB_TYPE_TIMESTAMP: - ptime = binds[i].buffer = data[i] = malloc(sizeof(MYSQL_TIME)); - set_time(ptime, va_arg(ap, time_t)); - break; - - case GLITE_LBU_DB_TYPE_NULL: - break; - - default: - assert("unimplemented parameter assign" == NULL); - break; - } - binds[i].buffer_type = glite_type_to_mysql[type]; - } - va_end(ap); - - // bind parameters - if (mysql_stmt_bind_param(stmt->stmt, binds) != 0) { - MY_ERRSTMT(stmt); - goto failed; - } - - // run - ctx = stmt->ctx; - retry = 1; - do { - mysql_stmt_execute(stmt->stmt); - ret = MY_ISOKSTMT(stmt, &retry); - } while (ret == 0); - if (ret == -1) goto failed; - - // result - retry = 1; - do { - mysql_stmt_store_result(stmt->stmt); - ret = MY_ISOKSTMT(stmt, &retry); - } while (ret == 0); - if (ret == -1) goto failed; - - // free params - for (i = 0; i < n; i++) free(data[i]); - free(data); - free(binds); - free(lens); - CLR_ERR(ctx); - return mysql_stmt_affected_rows(stmt->stmt); - -failed: - for (i = 0; i < n; i++) free(data[i]); - free(data); - free(binds); - free(lens); - return -1; -} - - -int glite_lbu_bufferedInsertInit(glite_lbu_DBContext ctx, glite_lbu_bufInsert *bi, void *mysql, const char *table_name, long size_limit, long record_limit, const char *columns) -{ - *bi = calloc(1, sizeof(*bi)); - (*bi)->ctx = ctx; - (*bi)->table_name = strdup(table_name); - (*bi)->columns = strdup(columns); - (*bi)->rec_num = 0; - (*bi)->rec_size = 0; - (*bi)->rows = calloc(record_limit, sizeof(*((*bi)->rows)) ); - (*bi)->size_limit = size_limit; - (*bi)->record_limit = record_limit; - - return CLR_ERR(ctx); -} - - -static int flush_bufferd_insert(glite_lbu_bufInsert bi) -{ - char *stmt, *vals, *temp; - long i; - - - if (!bi->rec_num) - return STATUS(bi->ctx); - - asprintf(&vals,"(%s)", bi->rows[0]); - for (i=1; i < bi->rec_num; i++) { - // XXX: use string add (preallocated memory) - asprintf(&temp,"%s,(%s)", vals, bi->rows[i]); - free(vals); vals = temp; temp = NULL; - free(bi->rows[i]); - bi->rows[i] = NULL; - } - - trio_asprintf(&stmt, "insert into %|Ss(%|Ss) values %s;", - bi->table_name, bi->columns, vals); - - if (glite_lbu_ExecSQL(bi->ctx,stmt,NULL) < 0) { - if (STATUS(bi->ctx) == EEXIST) - CLR_ERR(bi->ctx); - } - - /* reset bi counters */ - bi->rec_size = 0; - bi->rec_num = 0; - - free(vals); - free(stmt); - - return STATUS(bi->ctx); -} - - -int glite_lbu_bufferedInsert(glite_lbu_bufInsert bi, const char *row) -{ - bi->rows[bi->rec_num++] = strdup(row); - bi->rec_size += strlen(row); - - if ((bi->size_limit && bi->rec_size >= bi->size_limit) || - (bi->record_limit && bi->rec_num >= bi->record_limit)) - { - if (flush_bufferd_insert(bi)) - return STATUS(bi->ctx); - } - - return CLR_ERR(bi->ctx); -} - - -static void free_buffered_insert(glite_lbu_bufInsert bi) { - long i; - - free(bi->table_name); - free(bi->columns); - for (i=0; i < bi->rec_num; i++) { - free(bi->rows[i]); - } - free(bi->rows); -} - - -int glite_lbu_bufferedInsertClose(glite_lbu_bufInsert bi) -{ - if (flush_bufferd_insert(bi)) - return STATUS(bi->ctx); - free_buffered_insert(bi); - - return CLR_ERR(bi->ctx); -} - - -/* - * helping compatibility function: clear error from the context - */ -static int lbu_clrerr(glite_lbu_DBContext ctx) { - ctx->err.code = 0; - if (ctx->err.desc) { - free(ctx->err.desc); - ctx->err.desc = NULL; - } - return 0; -} - - -/* - * helping compatibility function: sets error on the context - */ -static int lbu_err(glite_lbu_DBContext ctx, int code, const char *desc, const char *func, int line) { - if (code) { - ctx->err.code = code; - free(ctx->err.desc); - ctx->err.desc = desc ? strdup(desc) : NULL; - dprintf(ctx, "[db %d] %s:%d %s\n", getpid(), func, line, desc); - return code; - } else - return ctx->err.code; -} - - -/* - * helping function: find oud mysql error and sets on the context - */ -static int myerr(glite_lbu_DBContext ctx, const char *source, int line) { - return lbu_err(ctx, EIO, mysql_error(ctx->mysql), source, line); -} - - -/* - * helping function: find oud mysql stmt error and sets on the context - */ -static int myerrstmt(glite_lbu_Statement stmt, const char *source, int line) { - return lbu_err(stmt->ctx, EIO, mysql_stmt_error(stmt->stmt), source, line); -} - - -/* - * Ehelping function: error handle - * - * \return -1 failed - * \return 0 retry - * \return 1 OK - */ -static int myisokstmt(glite_lbu_Statement stmt, const char *source, int line, int *retry) { - switch (mysql_stmt_errno(stmt->stmt)) { - case 0: - return 1; - break; - case ER_DUP_ENTRY: - lbu_err(stmt->ctx, EEXIST, mysql_stmt_error(stmt->stmt), source, line); - return -1; - break; - case CR_SERVER_LOST: - if (*retry > 0) { - (*retry)--; - return 0; - } else - return -1; - break; - default: - myerrstmt(stmt, source, line); - return -1; - break; - } -} - - -/* - * mysql connect - */ -static int db_connect(glite_lbu_DBContext ctx, const char *cs, MYSQL **mysql) { - char *buf = NULL; - char *host,*user,*pw,*db; - char *slash,*at,*colon; - int ret; - - // needed for SQL result parameters - assert(sizeof(int) >= sizeof(my_bool)); - - if (!cs) return ERR(ctx, EINVAL, "connect string not specified"); - - if (!(*mysql = mysql_init(NULL))) return ERR(ctx, ENOMEM, NULL); - - mysql_options(*mysql, MYSQL_READ_DEFAULT_FILE, "my"); - - host = user = pw = db = NULL; - - buf = strdup(cs); - slash = strchr(buf,'/'); - at = strrchr(buf,'@'); - colon = strrchr(buf,':'); - - if (!slash || !at || !colon) { - free(buf); - db_close(*mysql); - *mysql = NULL; - return ERR(ctx, EINVAL, "Invalid DB connect string"); - } - - *slash = *at = *colon = 0; - host = at+1; - user = buf; - pw = slash+1; - db = colon+1; - - /* ljocha: CLIENT_FOUND_ROWS added to make authorization check - * working in update_notif(). - * Hope it does not break anything else */ - if (!mysql_real_connect(*mysql,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) { - free(buf); - ret = MY_ERR(ctx); - glite_lbu_DBClose(ctx); - return ret; - } - free(buf); - - ctx->cs = cs; - return 0; -} - - -/* - * mysql close - */ -static void db_close(MYSQL *mysql) { - if (mysql) mysql_close(mysql); -} - - -/* - * test transactions capability: - * - * 1) with connection 1 create testing table test - * 2) with connection 1 insert a value - * 3) with connection 2 look for a value, transactions are for no error and - * no items found - * 4) with connection 1 commit and drop the table - */ -static int transaction_test(glite_lbu_DBContext ctx, MYSQL *m2, int *have_transactions) { - MYSQL *m1; - char *desc, *cmd_create, *cmd_insert, *cmd_select, *cmd_drop; - int retval; - int err; - pid_t pid; - - ctx->caps |= GLITE_LBU_DB_CAP_TRANSACTIONS; - pid = getpid(); - *have_transactions = 0; - - asprintf(&cmd_create, "CREATE TABLE test%d (item INT) ENGINE='innodb'", pid); - asprintf(&cmd_insert, "INSERT INTO test%d (item) VALUES (1)", pid); - asprintf(&cmd_select, "SELECT item FROM test%d", pid); - asprintf(&cmd_drop, "DROP TABLE test%d", pid); - - m1 = ctx->mysql; - //glite_lbu_ExecSQL(ctx, cmd_drop, NULL); - if (glite_lbu_ExecSQL(ctx, cmd_create, NULL) != 0) goto err1; - if (glite_lbu_Transaction(ctx) != 0) goto err2; - if (glite_lbu_ExecSQL(ctx, cmd_insert, NULL) != 1) goto err2; - - ctx->mysql = m2; - if ((retval = glite_lbu_ExecSQL(ctx, cmd_select, NULL)) == -1) goto err2; - - ctx->mysql = m1; - if (glite_lbu_Commit(ctx) != 0) goto err2; - if (glite_lbu_ExecSQL(ctx, cmd_drop, NULL) != 0) goto err1; - -#ifdef LBS_DB_PROFILE - fprintf(stderr, "[%d] use_transactions = %d\n", getpid(), USE_TRANS(ctx)); -#endif - - *have_transactions = retval == 0; - goto ok; -err2: - err = ctx->err.code; - desc = ctx->err.desc; - glite_lbu_ExecSQL(ctx, cmd_drop, NULL); - ctx->err.code = err; - ctx->err.desc = desc; -err1: -ok: - free(cmd_create); - free(cmd_insert); - free(cmd_select); - free(cmd_drop); - return STATUS(ctx); -} - - -/* - * simple version of the fetch - */ -static int FetchRowSimple(glite_lbu_DBContext ctx, MYSQL_RES *result, unsigned long *lengths, char **results) { - MYSQL_ROW row; - int nr, i; - unsigned long *len; - - CLR_ERR(ctx); - - if (!(row = mysql_fetch_row(result))) { - if (mysql_errno((MYSQL *) ctx->mysql)) { - MY_ERR(ctx); - return -1; - } else return 0; - } - - nr = mysql_num_fields(result); - len = mysql_fetch_lengths(result); - for (i=0; inrfields) { - ERR(ctx, EINVAL, "bad number of result fields"); - return -1; - } - - // space for results - if (n) binds = calloc(n, sizeof(MYSQL_BIND)); - if (!lengths) { - lens = calloc(n, sizeof(unsigned long)); - lengths = lens; - } - for (i = 0; i < n; i++) { - binds[i].buffer_type = MYSQL_TYPE_VAR_STRING; - binds[i].buffer_length = GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH - 1; - binds[i].length = &lengths[i]; - binds[i].buffer = results[i] = calloc(1, GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH); - } - if (mysql_stmt_bind_result(stmt->stmt, binds) != 0) goto failedstmt; - - // fetch data, all can be truncated - retry = 1; - do { - switch(mysql_stmt_fetch(stmt->stmt)) { -#ifdef MYSQL_DATA_TRUNCATED - case MYSQL_DATA_TRUNCATED: -#endif - case 0: - ret = 1; break; - case 1: ret = MY_ISOKSTMT(stmt, &retry); break; - case MYSQL_NO_DATA: ret = 0; goto quit; /* it's OK */ - default: ERR(ctx, EIO, "other fetch error"); goto failed; - } - } while (ret == 0); - if (ret == -1) goto failed; - - // check if all fileds had enough buffer space - for (i = 0; i < n; i++) { - // fetch the rest if needed - if (lengths[i] > binds[i].buffer_length) { - unsigned int fetched; - - fetched = binds[i].buffer_length; - if ((results[i] = realloc(results[i], lengths[i] + 1)) == NULL) { - ERR(ctx, ENOMEM, "insufficient memory for field data"); - goto failed; - } - results[i][lengths[i]] = '\000'; - binds[i].buffer = results[i] + fetched; - binds[i].buffer_length = lengths[i] - fetched; - - retry = 1; - do { - switch (mysql_stmt_fetch_column(stmt->stmt, binds + i, i, fetched)) { - case 0: ret = 1; break; - case 1: ret = MY_ISOKSTMT(stmt, &retry); break; - case MYSQL_NO_DATA: ret = 0; goto quit; /* it's OK */ - default: ERR(ctx, EIO, "other fetch error"); goto failed; - } - } while (ret == 0); - if (ret == -1) goto failed; - } - } - - CLR_ERR(ctx); - free(binds); - free(lens); - return n; - -failedstmt: - MY_ERRSTMT(stmt); -failed: - ret = -1; -quit: - free(binds); - free(lens); - for (i = 0; i < n; i++) { - free(results[i]); - results[i] = NULL; - } - return ret; -} - - -void set_time(MYSQL_TIME *mtime, const time_t time) { - struct tm tm; - - gmtime_r(&time, &tm); - memset(mtime, 0, sizeof *mtime); - mtime->year = tm.tm_year + 1900; - mtime->month = tm.tm_mon + 1; - mtime->day = tm.tm_mday; - mtime->hour = tm.tm_hour; - mtime->minute = tm.tm_min; - mtime->second = tm.tm_sec; -} - - -time_t get_time(const MYSQL_TIME *mtime) { - struct tm tm; - - memset(&tm, 0, sizeof(tm)); - setenv("TZ","UTC",1); tzset(); - tm.tm_year = mtime->year - 1900; - tm.tm_mon = mtime->month - 1; - tm.tm_mday = mtime->day; - tm.tm_hour = mtime->hour; - tm.tm_min = mtime->minute; - tm.tm_sec = mtime->second; - - return mktime(&tm); -} diff --git a/org.glite.lb-utils.jobid/.cvsignore b/org.glite.lb-utils.jobid/.cvsignore deleted file mode 100755 index 1df717b..0000000 --- a/org.glite.lb-utils.jobid/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.lb-utils.jobid/LICENSE b/org.glite.lb-utils.jobid/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.lb-utils.jobid/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb-utils.jobid/Makefile b/org.glite.lb-utils.jobid/Makefile deleted file mode 100644 index 986b5e0..0000000 --- a/org.glite.lb-utils.jobid/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -# Default values -top_srcdir=. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -package=glite-lb-utils-jobid -version=0.0.0 -PREFIX=/opt/glite -lbuprefix=lbu - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -VPATH=${top_srcdir}/src:${top_srcdir}/test::${top_srcdir}/doc - -CC=gcc - -DEBUG:=-g -O0 -Wall - -CFLAGS:=${DEBUG} -I${top_srcdir}/src -I${top_srcdir}/interface -I. -D_GNU_SOURCE - -COMPILE:=libtool --mode=compile ${CC} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -OBJS:=cjobid.o strmd5.o -LOBJS:=${OBJS:.o=.lo} - -HDRS:=cjobid.h strmd5.h Exception.h JobId.h JobIdExceptions.h - -STATICLIB:=libglite_lbu_jobid.a -LTLIB:=libglite_lbu_jobid.la - -default: all - -all compile: ${STATICLIB} ${LTLIB} - -# to use libtool versioning correcty, we should have: -# -# current = major + minor + offset -# revision = patch -# age = minor -# -# where offset is a sum of maximal released minor's of all previous major's -# -# version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :` - -# counted minors: n/a -offset=0 - -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${OBJS} - ${LINK} ${version_info} -o $@ ${LOBJS} - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -check: - @true - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - mkdir -p ${PREFIX}/lib - mkdir -p ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${LTLIB} ${PREFIX}/lib - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - if [ x${DOSTAGE} = xyes ]; then \ - mkdir -p ${PREFIX}/include/${globalprefix}/${lbuprefix} ; \ - (cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbuprefix}) ; \ - install -m 644 ${STATICLIB} ${PREFIX}/lib; \ - fi - -clean: - -%.o: %.c - ${COMPILE} ${CFLAGS} -c $< diff --git a/org.glite.lb-utils.jobid/build.xml b/org.glite.lb-utils.jobid/build.xml deleted file mode 100644 index e6cc422..0000000 --- a/org.glite.lb-utils.jobid/build.xml +++ /dev/null @@ -1,129 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.jobid/interface/Exception.h b/org.glite.lb-utils.jobid/interface/Exception.h deleted file mode 100644 index 21a9064..0000000 --- a/org.glite.lb-utils.jobid/interface/Exception.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H -#define GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H - -/* - * Exception.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - * Contributors are mentioned in the code where appropriate. - */ - -#include -#include -//#include -#include // For logging exceptions to log file -#include // list the exception codes -#include -#include -#include // base ancestor stl::exception - - -namespace glite { - namespace lb_utils { - namespace exception { - -extern pthread_mutex_t METHOD_MUTEX; // used in order to store info into a file (rather then syslog) -#define GLITE_STACK_TRY(method_name) std::string METHOD = method_name ; int LINE = __LINE__ ; try { -#define GLITE_STACK_CATCH() } catch (glite::lb_utils::exception::Exception &exc){ exc.push_back ( __FILE__ , LINE, METHOD ); throw exc ; } catch (std::exception &ex){ glite::lb_utils::exception::Exception exc( __FILE__ , LINE, METHOD, 0, "Standard exception: " + std::string(ex.what()) ); throw exc; } - -/** - * The Exception base classe contains attributes into which are placed exception information and provides - * constructor that beyond the error code take parameters specifying the source file and line number - * (e.g. through __FILE__ and __LINE__) where the error has been generated and string messages, - * allowing an easy way of storing the origin of the exception. - * Moreover it provides methods for getting all the exception information and for logging them either - * in a log file or to the syslog daemon. - * Each of the derived types may contain its private attributes describing the actual error instance in detail. - * Moreover each exception has an attribute representing the exception identifier that is set by the - * class constructor and allows the identification of the original exception. - * - * @version 0.1 - * @date 22 July 2004 - * @author Alessandro Maraschini -*/ - -class Exception : public std::exception{ - public: - /** - * Constructor Update all mandatory fields - * @param method the name of the method that raised the exception - * @param source The source that raised the exception (could be the file path, the class Name, etc etc) - * @param exc the previous exception as in the stack trace */ - Exception ( const std::string& source, const std::string& method, Exception *exc); - /** - * Constructor Update all mandatory fields - * @param code the code representing the thrown exception - * @param exception the name of the thrown exception - * @param method the name of the method that raised the exception - * @param source The source that raised the exception (could be the file path, the class Name, etc etc) */ - Exception ( const std::string& source, const std::string& method, int code, const std::string& exception); - - /** - * Constructor Update all mandatory fields - * @param source the path of the file that raised the exception - * @param line_number the number of the line in the file that raised the exception - * @param method the name of the method that raised the exception - * @param code the code representing the thrown exception - * @param exception the name of the thrown exception */ - Exception (const std::string& source, int line_number, const std::string& method, int code, const std::string& exception); - /** - * Default Destructor - */ - virtual ~Exception() throw (); - /** - * Return a string debug message containing information about Exception thrown - * Debug message contains all the attributes stored in an exception instance such as the method, the file and the line - * that threw the exception. - *@return the debug message string representation - */ - virtual std::string dbgMessage(); - /** - * Return the error code - * @return The integer representing the code of the error that generated the exception - */ - virtual int getCode(); - - /** - * return the Error Message associated to the Exception - * @return The Exception string message representation - */ - virtual const char* what() const throw (); - - /** - * Print Exception error information into a log file - * @param logfile the file where to log exception information - */ - virtual void log(const std::string& logfile = ""); - /** - * Retrieve the Exception name - * @return the name of the Exception thrown - */ - virtual std::string getExceptionName(); - - /** - * Retrieve the Stack of the exception as a list of previous generated exceptions - *@return the string representation of the stack trace: each line correspond to an exception message - */ - virtual std::string printStackTrace() ; - /** - * Return the list of methods that caused the Exception - */ - virtual std::vector getStackTrace() ; - /** - * Update stack information - */ - virtual void push_back ( const std::string& source, int line_number, const std::string& method ) ; - protected: - /** Empty constructor*/ - Exception(); - /** integer error code representing the cause of the error */ - int error_code; - /** string exception message representation*/ - std::string error_message ; - /** line number where the exception was raised */ - int line; - /** The name of the file where the exception was raised */ - std::string source_file; - /** the name of the exception */ - std::string exception_name; - /** the name of the method where the expceiton was raised */ - std::string method_name ; - /** a string representation of the stacktrace */ - std::string stack; - /** the actual internal stacktrace representation */ - std::vector< std::string> stack_strings ; - /** the name of the ancestor exception */ - std::string ancestor ; -}; //End Exception Class -}}} // Closing namespace -#endif diff --git a/org.glite.lb-utils.jobid/interface/JobId.h b/org.glite.lb-utils.jobid/interface/JobId.h deleted file mode 100644 index b99992d..0000000 --- a/org.glite.lb-utils.jobid/interface/JobId.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_JOBID_H -#define GLITE_WMSUTILS_JOBID_JOBID_H - -/* - * JobId.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - * - */ - -#include -#include - -#include "glite/lb-utils/cjobid.h" - -typedef struct _glite_lbu_jobid_s* glite_lbu_jobid_t; - -namespace glite { -namespace lb_utils { -namespace jobid { - -/** - * Managing Identification, checking, retreiving info from a job - * File name: JobId.h - * The JobId class provides a representation of the Datagrid job identifier - * (dg_jobId) and the methods for manipulating it. - * We remind that the format of the dg_jobId is as follows: - * :/ - * - * @ingroup common - * @version 0.1 - * @date 15 April 2002 - * @author Alessandro Maraschini */ - -class JobId { -public: - /**@name Constructors/Destructor */ - //@{ - /** Instantiates an empty JobId object */ - JobId() ; - /** - * Instantiates a JobId object from the passed dg_jobId in string format. - * @param job_id_string a string representig a classAd expression - * @throws WrongIdException When a string is passed in a wrong format - */ - JobId(const std::string& job_id_string); - JobId(const JobId&); - JobId(const glite_lbu_JobId&); - /** - * Destructor - * Destroy the Job Id instance - */ - ~JobId() ; - //@} - - /**@name Miscellaneous */ - //@{ - /** Unsets the JobId instance. Clear all it's memebers */ - void clear() ; - /** - * Check wheater the jobId has been already created (true) or not (false) - *@return true (jobId created) or false (jobId not yet created) - */ - bool isSet() { return ( m_JobId != 0 ) ; } - /** - * Set the JobId instance according to the LB and RB server addresses and the unique string passed as input parameters. - * @param lb_server Loggin and Bookkeeping server address - * @param port Loggin and Bookkeeping port ( dafault value is 9000 ) - * @param unique A Unique identification ( automatically generatad by md5 protocol ) - * @throws WrongIdException When one parameter has been passed in a wrong format */ - void setJobId(const std::string& lb_server, int port = 0, const std::string& unique = ""); - //@} - /**@name Get Methods */ - //@{ - /** @return the LB address into its string format - * @throws EmptyIdException If the jobId has not been initialised yet */ - std::string getServer() const; - /** @return the Unique string into its string format - * @throws EmptyIdException If the jobId has not been initialised yet */ - std::string getUnique() const; - //@} - /** This method sets the JobId instance from the JobId in string format given - * as input. - * @param dg_JobId the string representing the job - * @throws WrongIdException When a string is passed in a wrong format */ - void fromString ( const std::string& dg_JobId ); - /** Converts the jobId into a string - @return the string representation of a JobId*/ - std::string toString() const; - /** casting operator */ - operator const glite_lbu_JobId() const { return m_JobId; } - /** Operator "=" create a deep copy of the JobId instance*/ - JobId & operator=(JobId const &); - /** Operator "=" create a deep copy of the JobId instance*/ - JobId & operator=(const glite_lbu_JobId &); - /** Retrieve the internal id reference - *@return the JobId internal reference used by some LB methods */ - glite_lbu_JobId getId() const ; -private: - // This Variable stores the Job unique identification String - glite_lbu_JobId m_JobId; - mutable char* m_pStr; - mutable char* m_pBkserver; - mutable char* m_pUnique; - /** Operator "<"*/ - friend bool operator<(JobId const& lhs, JobId const& rhs); - /** Operator "=="*/ - friend bool operator==(JobId const& lhs, JobId const& rhs); -}; - -inline bool operator<(JobId const& lhs, JobId const& rhs) -{ - return strcmp ( lhs.m_pStr , rhs.m_pStr ) <0 ; -} - -inline bool operator==(JobId const& lhs, JobId const& rhs) -{ -return strcmp ( lhs.m_pStr , rhs.m_pStr ) ==0 ; -} - -std::ostream& operator<<(std::ostream& os, JobId const& id); - -} // namespace jobid -} // namespace lb_utils -} // namespace glite - -#endif // GLITE_WMSUTILS_JOBID_JOBID_H diff --git a/org.glite.lb-utils.jobid/interface/JobIdExceptions.h b/org.glite.lb-utils.jobid/interface/JobIdExceptions.h deleted file mode 100644 index d154adf..0000000 --- a/org.glite.lb-utils.jobid/interface/JobIdExceptions.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_EXCEPTIONS_H -#define GLITE_WMSUTILS_JOBID_EXCEPTIONS_H - -/* - * JobIdExceptions.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - */ - -#include "glite/lb-utils/Exception.h" - -namespace glite { -namespace lb_utils { -namespace jobid { - -/** - * JobIdException - Exception thrown by JobId Class - * @ingroup Common - * @version 0.1 - * @date 15 April 2002 - * @author Alessandro Maraschini -*/ - -class JobIdException : public glite::lb_utils::exception::Exception { -public: - /** - * Update all mandatory Exception Information - */ - JobIdException (const std::string& file, - int line, - const std::string& method, - int code, - const std::string& exception_name) ; -};//End CLass JobIdException - -/** -* WrongIdFieldException -* This Exception is thrown when a Job Id syntax error is found -* A valid Job Identification string should be made as follows: -* :/ */ -class WrongIdException : public JobIdException { -public: - /** - * Constructor - * @param file - The source file which has generated the Exception - * @param line - The line number in the source file where the Exception has been thrown - * @param method - The Name of the method which has thrown the Exception - * @param code - The Code of the Error raised - * @param field - The wrong expression catched */ - WrongIdException(const std::string& file, - int line, - const std::string& method, - int code ); -}; //End CLass WrongIdException -/** -* EmptyIdException -* This Exception is thrown when the user tries to get information from a JobId -* which has not been initialized yet, i.e tries to use the get Methods -*/ -class EmptyIdException : public JobIdException { -public: - /** - * Constructor - * @param file - The source file which has generated the Exception - * @param line - The line number in the source file where the Exception has been thrown - * @param method - The Name of the method which has thrown the Exception - * @param code - The Code of the Error raised - * @param field - The Empty filed requested for */ - EmptyIdException::EmptyIdException(const std::string& file, - int line, - const std::string& method, - int code , - const std::string& field ); -}; //End CLass EmptyIdException - -} // namespace jobid -} // namespace lb_utils -} // namespace glite - -#endif // GLITE_WMSUTILS_JOBID_EXCEPTIONS_H - diff --git a/org.glite.lb-utils.jobid/interface/cjobid.h b/org.glite.lb-utils.jobid/interface/cjobid.h deleted file mode 100755 index f802ce7..0000000 --- a/org.glite.lb-utils.jobid/interface/cjobid.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _GLITE_JOBID_H -#define _GLITE_JOBID_H - -/*! - * \file cjobid.h - * \brief L&B consumer API - */ - -#ident "$Header$" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _glite_lbu_JobId *glite_lbu_JobId; - -#define GLITE_WMSC_JOBID_DEFAULT_PORT 9000 /**< Default port where bookkeeping server listens */ -#define GLITE_WMSC_JOBID_PROTO_PREFIX "https://" /**< JobId protocol prefix */ - - -/* All the pointer functions return malloc'ed objects (or NULL on error) */ - -/** - * Create a Job ID. - * See the lb_draft document for details on its construction and components - * \param bkserver book keeping server hostname - * \param port port for the bk service - * \param jobid new created job id - * \ret al 0 success - * \retval EINVAL invalid bkserver - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdCreate(const char * bkserver, int port, glite_lbu_JobId * jobid); - -/** - * Recreate a Job ID - * \param bkserver bookkeeping server hostname - * \param port port for the bk service - * \param unique string which represent created jobid (if NULL then new - * one is created) - * \param jobid new created job id - * \retval 0 success - * \retval EINVAL invalid bkserver - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdRecreate(const char *bkserver, int port, const char * unique, glite_lbu_JobId * jobid); - -/** - * Create copy of Job ID - * \param in jobid for duplication - * \param jobid duplicated jobid - * \retval 0 for success - * \retval EINVAL invalid jobid - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdDup(const glite_lbu_JobId in, glite_lbu_JobId * jobid); - -/* - * Free jobid structure - * \param jobid for dealocation - */ -void glite_lbu_JobIdFree(glite_lbu_JobId jobid); - -/** - * Parse Job ID string and creates jobid structure - * \param jobidstr string representation of jobid - * \param jobid parsed job id - * \retval 0 for success - * \retval EINVAL jobidstr can't be parsed - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdParse(const char* jobidstr, glite_lbu_JobId * jobid); - -/** - * Unparse Job ID (produce the string form of JobId). - * \param jobid to be converted to string - * \return allocated string which represents jobid - */ -char* glite_lbu_JobIdUnparse(const glite_lbu_JobId jobid); - -/** - * Extract bookkeeping server address (address:port) - * \param jobid from which the bkserver address should be extracted - * \retval pointer to allocated string with bkserver address - * \retval NULL if jobid is 0 or memory allocation fails - */ -char* glite_lbu_JobIdGetServer(const glite_lbu_JobId jobid); - -/** - * Extract bookkeeping server address and port - * \param jobid from which the bkserver address should be extracted - * \param srvName pointer where to return server name - * \param srvPort pointer where to return server port - * */ -void glite_lbu_JobIdGetServerParts(const glite_lbu_JobId jobid, char **srvName, unsigned int *srvPort); - -/** - * Extract unique string - * \param jobid - * \retval pointer to allocated unique string representing jobid - * \retval NULL if jobid is 0 or memory allocation fails - */ -char* glite_lbu_JobIdGetUnique(const glite_lbu_JobId jobid); - -#ifdef __cplusplus -} -#endif - -#endif /* _GLITE_JOBID_H */ diff --git a/org.glite.lb-utils.jobid/interface/strmd5.h b/org.glite.lb-utils.jobid/interface/strmd5.h deleted file mode 100755 index 27d8544..0000000 --- a/org.glite.lb-utils.jobid/interface/strmd5.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _GLITE_STRMD5_H -#define _GLITE_STRMD5_H - -#ident "$Header$" - -/* Compute MD5 sum of the first argument. - * The sum is returned in the 16-byte array pointed to by 2nd argument - * (if not NULL) - * - * Return value: ASCII string of the sum, i.e. 32 characters [0-9a-f] - * (pointer to static area, changed by subsequent calls) - */ - -#ifdef USE_MBUF -char *strmd5(const char *src, unsigned char *dst); -#endif - -/** - * Returns: allocated 32bytes long ASCII string with md5 sum - * of the first argument - */ -char *str2md5(const char *src); - -/** - * Returns: allocated 22bytes long ASCII string with md5 sum in base64 - * format of the source argument - */ -char *str2md5base64(const char *src); - -#endif /* _GLITE_STRMD5_H */ diff --git a/org.glite.lb-utils.jobid/project/build.number b/org.glite.lb-utils.jobid/project/build.number deleted file mode 100644 index 5cfec85..0000000 --- a/org.glite.lb-utils.jobid/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build = 0 diff --git a/org.glite.lb-utils.jobid/project/build.properties b/org.glite.lb-utils.jobid/project/build.properties deleted file mode 100755 index 89232f3..0000000 --- a/org.glite.lb-utils.jobid/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# temporary hack before lb-utils are integrated - -lb-utils.subsystem.name = org.glite.lb-utils -lb-utils.subsystem.prefix = lb-utils diff --git a/org.glite.lb-utils.jobid/project/configure.properties.xml b/org.glite.lb-utils.jobid/project/configure.properties.xml deleted file mode 100644 index 23ba931..0000000 --- a/org.glite.lb-utils.jobid/project/configure.properties.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbuprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} - - - - diff --git a/org.glite.lb-utils.jobid/project/properties.xml b/org.glite.lb-utils.jobid/project/properties.xml deleted file mode 100644 index 1adf343..0000000 --- a/org.glite.lb-utils.jobid/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.jobid/project/tar_exclude b/org.glite.lb-utils.jobid/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.lb-utils.jobid/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.lb-utils.jobid/project/version.properties b/org.glite.lb-utils.jobid/project/version.properties deleted file mode 100755 index 52a0f68..0000000 --- a/org.glite.lb-utils.jobid/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version = 1.0.0 -module.age = 0 diff --git a/org.glite.lb-utils.jobid/src/cjobid.c b/org.glite.lb-utils.jobid/src/cjobid.c deleted file mode 100755 index 6d6a73f..0000000 --- a/org.glite.lb-utils.jobid/src/cjobid.c +++ /dev/null @@ -1,260 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "cjobid.h" -#include "strmd5.h" - -struct _glite_lbu_JobId { - char *id; /* unique job identification */ - /* additional information */ - char *BShost;/* bookkeeping server hostname */ - unsigned int BSport; /* bookkeeping server port */ - char *info; /* additional information (after ? in URI) */ -}; - -int glite_lbu_JobIdCreate(const char *bkserver, int port, glite_lbu_JobId *jobId) -{ - return glite_lbu_JobIdRecreate(bkserver, port, NULL, jobId); -} - - -int glite_lbu_JobIdRecreate(const char* bkserver, int port, const char *unique, glite_lbu_JobId *jobId) -{ - glite_lbu_JobId out; - char hostname[200]; /* used to hold string for encrypt */ - struct timeval tv; - int skip; - char* portbeg; - - struct hostent* he; - - if (!bkserver) - return EINVAL; - - if (unique == NULL) { - gethostname(hostname, 100); - he = gethostbyname(hostname); - assert(he->h_length > 0); - gettimeofday(&tv, NULL); - srandom(tv.tv_usec); - - skip = strlen(hostname); - skip += sprintf(hostname + skip, "-IP:0x%x-pid:%d-rnd:%d-time:%d:%d", - *((int*)he->h_addr_list[0]), getpid(), (int)random(), - (int)tv.tv_sec, (int)tv.tv_usec); - } - - *jobId = NULL; - out = (glite_lbu_JobId) malloc (sizeof(*out)); - if (!out) - return ENOMEM; - - memset(out, 0, sizeof(*out)); - - /* check if it begins with prefix */ - /* unsupported */ - if (strncmp(bkserver, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX)-1) == 0) - return EINVAL; - - out->BShost = strdup(bkserver); - portbeg = strchr(out->BShost, ':'); - if (portbeg) { - *portbeg = 0; - /* try to get port number */ - if (port == 0) - port = atoi(portbeg + 1); - } - - if (port == 0) - port = GLITE_WMSC_JOBID_DEFAULT_PORT; - - out->BSport = port; - - out->id = (unique) ? strdup(unique) : str2md5base64(hostname); - //printf("Encrypt: %s\nBASE64 %s\n", hostname, out->id); - - if (!out->id || !out->BShost) { - glite_lbu_JobIdFree(out); - return ENOMEM; - } - - *jobId = out; - return 0; -} - - -int glite_lbu_JobIdDup(const glite_lbu_JobId in, glite_lbu_JobId *out) -{ - glite_lbu_JobId jid; - *out = NULL; - if (in == NULL) - return 0; - - jid = malloc(sizeof(*jid)); - if (!jid) - return ENOMEM; - - memset(jid, 0,sizeof(*jid)); - jid->BShost = strdup(in->BShost); - jid->id = strdup(in->id); - if (in->info) - jid->info = strdup(in->info); - - if (jid->BShost == NULL || jid->id == NULL) { - glite_lbu_JobIdFree(jid); - return ENOMEM; - } - - jid->BSport = in->BSport; - *out = jid; - return 0; -} - - -// XXX -// use recreate -// parse name, port, unique -int glite_lbu_JobIdParse(const char *idString, glite_lbu_JobId *jobId) -{ - char *pom, *pom1, *pom2; - glite_lbu_JobId out; - - *jobId = NULL; - - out = (glite_lbu_JobId) malloc (sizeof(*out)); - if (out == NULL ) - return ENOMEM; - - memset(out,0,sizeof(*out)); - - if (strncmp(idString, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1)) { - out->BShost = (char *) NULL; - out->BSport = 0; - - free(out); - return EINVAL; - } - - pom = strdup(idString + sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1); - pom1 = strchr(pom, '/'); - pom2 = strchr(pom, ':'); - - if (!pom1) { free(pom); free(out); return EINVAL; } - - if ( pom2 && (pom1 > pom2)) { - pom[pom2-pom] = '\0'; - out->BShost = strdup(pom); - pom[pom1-pom] = '\0'; - out->BSport = (unsigned int) strtoul(pom2 + 1,NULL,10); - } else { - pom[pom1-pom] = '\0'; - out->BShost = strdup(pom); - out->BSport = GLITE_WMSC_JOBID_DEFAULT_PORT; - } - - /* XXX: localhost not supported in jobid - if (!strncmp(out->BShost,"localhost",9) { - free(pom); - free(out->BShost); - free(out); - return EINVAL; - } - */ - - /* additional info from URI */ - pom2 = strchr(pom1+1,'?'); - if (pom2) { - *pom2 = 0; - out->info = strdup(pom2+1); - } - - /* extract the unique part */ - out->id = strdup(pom1+1); - - for (pom1 = out->BShost; *pom1; pom1++) - if (isspace(*pom1)) break; - - for (pom2 = out->id; *pom2; pom2++) - if (isspace(*pom2)) break; - - if (*pom1 || *pom2) { - free(pom); - glite_lbu_JobIdFree(out); - return EINVAL; - } - - free(pom); - *jobId = out; - return 0; -} - - -void glite_lbu_JobIdFree(glite_lbu_JobId job) -{ - if (job) { - free(job->id); - free(job->BShost); - free(job->info); - free(job); - } -} - - -char* glite_lbu_JobIdUnparse(const glite_lbu_JobId jobid) -{ - char *out, port[40]; - - if (!jobid) - return NULL; - - if (jobid->BSport) - sprintf(port,":%d",jobid->BSport); - else - *port = 0; - - asprintf(&out, GLITE_WMSC_JOBID_PROTO_PREFIX"%s%s/%s%s%s", - jobid->BShost,port, - jobid->id, - (jobid->info ? "?" : ""), - (jobid->info ? jobid->info : "")); - - return out; -} - - -char* glite_lbu_JobIdGetServer(const glite_lbu_JobId jobid) -{ - char *bs = NULL; - - if (jobid) - asprintf(&bs, "%s:%u", jobid->BShost, - jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT); - - return bs; -} - - -void glite_lbu_JobIdGetServerParts(const glite_lbu_JobId jobid, char **srvName, unsigned int *srvPort) -{ - if (jobid) { - *srvName = strdup(jobid->BShost); - *srvPort = jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT; - } -} - - -char* glite_lbu_JobIdGetUnique(const glite_lbu_JobId jobid) -{ - return jobid ? strdup(jobid->id) : NULL; -} diff --git a/org.glite.lb-utils.jobid/src/strmd5.c b/org.glite.lb-utils.jobid/src/strmd5.c deleted file mode 100755 index 775aee8..0000000 --- a/org.glite.lb-utils.jobid/src/strmd5.c +++ /dev/null @@ -1,122 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include - -#include "strmd5.h" - -#if USE_MBUF /* let's try without it */ -#warning Thread unsafe! -static char mbuf[33]; -#endif - -static int base64_encode(const void *enc, int enc_size, char *out, int out_max_size) -{ - static const char* b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; - - unsigned char* enc_buf = (unsigned char*)enc; - int out_size = 0; - unsigned int bits = 0; - unsigned int shift = 0; - - while ( out_size < out_max_size ) { - if ( enc_size>0 ) { - // Shift in byte - bits <<= 8; - bits |= *enc_buf; - shift += 8; - // Next byte - enc_buf++; - enc_size--; - } else if ( shift>0 ) { - // Pad last bits to 6 bits - will end next loop - bits <<= 6 - shift; - shift = 6; - } else { - // Terminate with Mime style '=' - *out = '='; - out_size++; - - return out_size; - } - - // Encode 6 bit segments - while ( shift>=6 ) { - shift -= 6; - *out = b64[ (bits >> shift) & 0x3F ]; - out++; - out_size++; - } - } - - // Output overflow - return -1; -} - -#ifdef USE_MBUF -char *strmd5(const char *s, unsigned char *digest) -{ - MD5_CTX md5; - unsigned char d[16]; - int i; - - MD5_Init(&md5); - MD5_Update(&md5,s,strlen(s)); - MD5_Final(d,&md5); - - if (digest) memcpy(digest,d,sizeof(d)); - - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - mbuf[32] = 0; - return (char *) mbuf; -} -#endif - -char *str2md5(const char *s) -{ - MD5_CTX md5; - unsigned char d[16]; - char* ret = malloc(33); - int i; - - if (!ret) - return NULL; - - MD5_Init(&md5); - MD5_Update(&md5, s, strlen(s)); - MD5_Final(d, &md5); - - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - ret[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - ret[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - ret[32] = 0; - return ret; -} - -char *str2md5base64(const char *s) -{ - MD5_CTX md5; - unsigned char d[16]; - char buf[50]; - int l; - - MD5_Init(&md5); - MD5_Update(&md5, s, strlen(s)); - MD5_Final(d, &md5); - - l = base64_encode(d, 16, buf, sizeof(buf) - 1); - if (l < 1) - return NULL; - buf[l - 1] = 0; - return strdup(buf); -} diff --git a/org.glite.lb-utils.server-bones/.cvsignore b/org.glite.lb-utils.server-bones/.cvsignore deleted file mode 100755 index 1df717b..0000000 --- a/org.glite.lb-utils.server-bones/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.lb-utils.server-bones/LICENSE b/org.glite.lb-utils.server-bones/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.lb-utils.server-bones/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb-utils.server-bones/build.xml b/org.glite.lb-utils.server-bones/build.xml deleted file mode 100644 index efe49ad..0000000 --- a/org.glite.lb-utils.server-bones/build.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.server-bones/project/build.number b/org.glite.lb-utils.server-bones/project/build.number deleted file mode 100644 index 5cfec85..0000000 --- a/org.glite.lb-utils.server-bones/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build = 0 diff --git a/org.glite.lb-utils.server-bones/project/build.properties b/org.glite.lb-utils.server-bones/project/build.properties deleted file mode 100755 index e69de29..0000000 diff --git a/org.glite.lb-utils.server-bones/project/configure.properties.xml b/org.glite.lb-utils.server-bones/project/configure.properties.xml deleted file mode 100644 index 6ad627b..0000000 --- a/org.glite.lb-utils.server-bones/project/configure.properties.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - diff --git a/org.glite.lb-utils.server-bones/project/properties.xml b/org.glite.lb-utils.server-bones/project/properties.xml deleted file mode 100644 index a76d544..0000000 --- a/org.glite.lb-utils.server-bones/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.server-bones/project/version.properties b/org.glite.lb-utils.server-bones/project/version.properties deleted file mode 100755 index 6f1f8ab..0000000 --- a/org.glite.lb-utils.server-bones/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version = 0.0.0 -module.age = 0 \ No newline at end of file diff --git a/org.glite.lb-utils.trio/.cvsignore b/org.glite.lb-utils.trio/.cvsignore deleted file mode 100755 index 1df717b..0000000 --- a/org.glite.lb-utils.trio/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.lb-utils.trio/LICENSE b/org.glite.lb-utils.trio/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.lb-utils.trio/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb-utils.trio/Makefile b/org.glite.lb-utils.trio/Makefile deleted file mode 100644 index 96a8386..0000000 --- a/org.glite.lb-utils.trio/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -# Default values -top_srcdir=. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -package=glite-lb-utils-trio -version=0.0.0 -PREFIX=/opt/glite -lbuprefix=lbu - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -VPATH=${top_srcdir}/src:${top_srcdir}/test::${top_srcdir}/doc - -CC=gcc - -DEBUG:=-g -O0 -Wall - -CFLAGS:=${DEBUG} -I${top_srcdir}/src -I${top_srcdir}/interface -I. -DDATAGRID_EXTENSION - -COMPILE:=libtool --mode=compile ${CC} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -REPORTS:=${top_srcdir}/reports -TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit -ldl -TEST_INC:=-I${cppunit_prefix}/include - - -OBJS:=trio.o strio.o escape.o -LOBJS:=${OBJS:.o=.lo} - -HDRS:=trio.h escape.h - -STATICLIB:=libglite_lbu_trio.a -LTLIB:=libglite_lbu_trio.la - -default: all - -all compile: ${STATICLIB} ${LTLIB} - -# to use libtool versioning correcty, we should have: -# -# current = major + minor + offset -# revision = patch -# age = minor -# -# where offset is a sum of maximal released minor's of all previous major's -# -# version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :` - -# counted minors: n/a -offset=0 - -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${OBJS} - ${LINK} ${version_info} -o $@ ${LOBJS} - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -check: compile mkreports runtest - -mkreports: - -mkdir ${REPORTS} - -runtest: trio_test - ./trio_test ${REPORTS}/trio.xml - -trio_test: trio_test.cpp - ${CXX} -c ${CFLAGS} ${TEST_INC} $< - ${LINKXX} -o $@ trio_test.o ${LTLIB} ${TEST_LIBS} - - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - mkdir -p ${PREFIX}/lib - mkdir -p ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${LTLIB} ${PREFIX}/lib - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - if [ x${DOSTAGE} = xyes ]; then \ - mkdir -p ${PREFIX}/include/${globalprefix}/${lbuprefix} ; \ - (cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbuprefix}) ; \ - install -m 644 ${STATICLIB} ${PREFIX}/lib; \ - fi - -clean: - -%.o: %.c - ${COMPILE} ${CFLAGS} -c $< diff --git a/org.glite.lb-utils.trio/build.xml b/org.glite.lb-utils.trio/build.xml deleted file mode 100644 index 7e38dda..0000000 --- a/org.glite.lb-utils.trio/build.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.trio/interface/escape.h b/org.glite.lb-utils.trio/interface/escape.h deleted file mode 100644 index 4795f68..0000000 --- a/org.glite.lb-utils.trio/interface/escape.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ -#define __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ -/*! - * \file escape.h - */ - -#ident "$Header$" - - -/*! - * \fn char *glite_lbu_EscapeULM(const char *str) - * \param str a string to escape - * \return new (allocated) escaped string - * \brief in given string (ULM) escape all ULM_QM, ULM_BS and ULM_LF by ULM_BS - */ - -char *glite_lbu_EscapeULM(const char *); - - -/*! - * \fn char *glite_lbu_UnescapeULM(const char *str) - * \param str a string to unescape - * \return new (allocated) unescaped string - * \brief in given string (ULM) unescape all escaped ULM_QM, ULM_BS and ULM_LF - */ - -char *glite_lbu_UnescapeULM(const char *); - - -/*! - * \fn char *glite_lbu_EscapeXML(const char *str); - * \param str a string to escape - * \return new (allocated) escaped string - * \brief in given string (XML) escape all unwanted characters - */ - -char *glite_lbu_EscapeXML(const char *); - - -/*! - * \fn char *glite_lbu_UnescapeXML(const char *str) - * \param str a string to unescape - * \return new (allocated) unescaped string - * \brief in given string (XML) unescape all escaped characters - */ - -char *glite_lbu_UnescapeXML(const char *); - - -/*! - * \fn char *glite_lbu_EscapeSQL(const char *str) - * \param str a string to escape - * \return new (allocated) escaped string - * \briefin given string (SQL) escape all unwanted characters - */ - -char *glite_lbu_EscapeSQL(const char *); - -#endif /* __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ */ diff --git a/org.glite.lb-utils.trio/interface/trio.h b/org.glite.lb-utils.trio/interface/trio.h deleted file mode 100644 index 04f133c..0000000 --- a/org.glite.lb-utils.trio/interface/trio.h +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************/ - -#ifndef TRIO_TRIO_H -#define TRIO_TRIO_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* make utility and C++ compiler in Windows NT fails to find this symbol */ -#if defined(WIN32) && !defined(isascii) -# define isascii ((unsigned)(x) < 0x80) -#endif - -/* - * Error codes. - * - * Remember to add a textual description to trio_strerror. - */ -enum { - TRIO_EOF = 1, - TRIO_EINVAL = 2, - TRIO_ETOOMANY = 3, - TRIO_EDBLREF = 4, - TRIO_EGAP = 5, - TRIO_ENOMEM = 6, - TRIO_ERANGE = 7 -}; - -/* Error macros */ -#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF) -#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8) -#define TRIO_ERROR_NAME(x) trio_strerror(x) - -const char *trio_strerror(int); - -/************************************************************************* - * Print Functions - */ - -int trio_printf(const char *format, ...); -int trio_vprintf(const char *format, va_list args); -int trio_printfv(const char *format, void **args); - -int trio_fprintf(FILE *file, const char *format, ...); -int trio_vfprintf(FILE *file, const char *format, va_list args); -int trio_fprintfv(FILE *file, const char *format, void **args); - -int trio_dprintf(int fd, const char *format, ...); -int trio_vdprintf(int fd, const char *format, va_list args); -int trio_dprintfv(int fd, const char *format, void **args); - -/* trio_sprintf(target, format, ...) - * trio_snprintf(target, maxsize, format, ...) - * - * Build 'target' according to 'format' and succesive - * arguments. This is equal to the sprintf() and - * snprintf() functions. - */ -int trio_sprintf(char *buffer, const char *format, ...); -int trio_vsprintf(char *buffer, const char *format, va_list args); -int trio_sprintfv(char *buffer, const char *format, void **args); - -int trio_snprintf(char *buffer, size_t max, const char *format, ...); -int trio_vsnprintf(char *buffer, size_t bufferSize, const char *format, - va_list args); -int trio_snprintfv(char *buffer, size_t bufferSize, const char *format, - void **args); - -int trio_snprintfcat(char *buffer, size_t max, const char *format, ...); -int trio_vsnprintfcat(char *buffer, size_t bufferSize, const char *format, - va_list args); - -char *trio_aprintf(const char *format, ...); -char *trio_vaprintf(const char *format, va_list args); - -int trio_asprintf(char **ret, const char *format, ...); -int trio_vasprintf(char **ret, const char *format, va_list args); - -/************************************************************************* - * Scan Functions - */ -int trio_scanf(const char *format, ...); -int trio_vscanf(const char *format, va_list args); -int trio_scanfv(const char *format, void **args); - -int trio_fscanf(FILE *file, const char *format, ...); -int trio_vfscanf(FILE *file, const char *format, va_list args); -int trio_fscanfv(FILE *file, const char *format, void **args); - -int trio_dscanf(int fd, const char *format, ...); -int trio_vdscanf(int fd, const char *format, va_list args); -int trio_dscanfv(int fd, const char *format, void **args); - -int trio_sscanf(const char *buffer, const char *format, ...); -int trio_vsscanf(const char *buffer, const char *format, va_list args); -int trio_sscanfv(const char *buffer, const char *format, void **args); - -/************************************************************************* - * Renaming - */ -#ifdef TRIO_REPLACE_STDIO -/* Replace the functions */ -#ifndef HAVE_PRINTF -# define printf trio_printf -#endif -#ifndef HAVE_VPRINTF -# define vprintf trio_vprintf -#endif -#ifndef HAVE_FPRINTF -# define fprintf trio_fprintf -#endif -#ifndef HAVE_VFPRINTF -# define vfprintf trio_vfprintf -#endif -#ifndef HAVE_SPRINTF -# define sprintf trio_sprintf -#endif -#ifndef HAVE_VSPRINTF -# define vsprintf trio_vsprintf -#endif -#ifndef HAVE_SNPRINTF -# define snprintf trio_snprintf -#endif -#ifndef HAVE_VSNPRINTF -# define vsnprintf trio_vsnprintf -#endif -#ifndef HAVE_SCANF -# define scanf trio_scanf -#endif -#ifndef HAVE_VSCANF -# define vscanf trio_vscanf -#endif -#ifndef HAVE_FSCANF -# define fscanf trio_fscanf -#endif -#ifndef HAVE_VFSCANF -# define vfscanf trio_vfscanf -#endif -#ifndef HAVE_SSCANF -# define sscanf trio_sscanf -#endif -#ifndef HAVE_VSSCANF -# define vsscanf trio_vsscanf -#endif -/* These aren't stdio functions, but we make them look similar */ -#define dprintf trio_dprintf -#define vdprintf trio_vdprintf -#define aprintf trio_aprintf -#define vaprintf trio_vaprintf -#define asprintf trio_asprintf -#define vasprintf trio_vasprintf -#define dscanf trio_dscanf -#define vdscanf trio_vdscanf -#endif - -/* strio compatible names */ -#define StrScan trio_sscanf -#define StrFormat trio_sprintf -#define StrFormatMax trio_snprintf -#define StrFormatAlloc trio_aprintf -#define StrFormatAppendMax trio_snprintfcat - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* TRIO_TRIO_H */ diff --git a/org.glite.lb-utils.trio/project/build.number b/org.glite.lb-utils.trio/project/build.number deleted file mode 100644 index 5cfec85..0000000 --- a/org.glite.lb-utils.trio/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build = 0 diff --git a/org.glite.lb-utils.trio/project/build.properties b/org.glite.lb-utils.trio/project/build.properties deleted file mode 100755 index 89232f3..0000000 --- a/org.glite.lb-utils.trio/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -# temporary hack before lb-utils are integrated - -lb-utils.subsystem.name = org.glite.lb-utils -lb-utils.subsystem.prefix = lb-utils diff --git a/org.glite.lb-utils.trio/project/configure.properties.xml b/org.glite.lb-utils.trio/project/configure.properties.xml deleted file mode 100644 index d743f4b..0000000 --- a/org.glite.lb-utils.trio/project/configure.properties.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbuprefix=${subsystem.prefix} -package=${module.package.name} -cppunit_prefix=${with.cppunit.prefix} -PREFIX=${install.dir} - - - - - diff --git a/org.glite.lb-utils.trio/project/properties.xml b/org.glite.lb-utils.trio/project/properties.xml deleted file mode 100644 index e472152..0000000 --- a/org.glite.lb-utils.trio/project/properties.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils.trio/project/version.properties b/org.glite.lb-utils.trio/project/version.properties deleted file mode 100755 index 6f1f8ab..0000000 --- a/org.glite.lb-utils.trio/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version = 0.0.0 -module.age = 0 \ No newline at end of file diff --git a/org.glite.lb-utils.trio/src/escape.c b/org.glite.lb-utils.trio/src/escape.c deleted file mode 100644 index 9a1d545..0000000 --- a/org.glite.lb-utils.trio/src/escape.c +++ /dev/null @@ -1,224 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include - -#include "escape.h" - -#define ULM_QM '"' -#define ULM_BS '\\' -#define ULM_LF '\n' - -/* - *---------------------------------------------------------------------- - * - * \fn char *glite_lbu_EscapeULM(const char *str) - * \param str a string to escape - * \return new (allocated) escaped string - * \brief in given string escape all ULM_QM, ULM_BS and ULM_LF by ULM_BS - * - * Calls: malloc, strlen - * - * Algorithm: array lookup - * - the new string will be allocated - * - *---------------------------------------------------------------------- - */ - -char *glite_lbu_EscapeULM(const char *str) -{ -unsigned int i,j; -size_t size; -char *ret; - -if (str == NULL) return NULL; -if ((size = strlen(str)) == 0) return strdup(""); - -ret = (char*) malloc(1+2*size*sizeof(char)); - -j = 0; -for (i=0; i',"gt" }, - { '&',"amp" }, - { '"',"quot" }, - { '\'',"apos" }, - { 0, NULL } -}; - -#define XML_ESCAPE_SET "<>&\"'" - -char *glite_lbu_EscapeXML(const char *in) -{ - const char* tmp_in; - char *out; - int cnt,i,j,k; - - if (!in) return NULL; - - for (cnt = 0, tmp_in = in; *tmp_in != '\0'; ++tmp_in) { - if (strchr(XML_ESCAPE_SET, *tmp_in) || - (*tmp_in & 0x7f) < 0x20 /* control character */ || - (*tmp_in == '%')) cnt++; - } - - out = malloc(strlen(in)+1+cnt*5); - - for (i=j=0; in[i]; i++) { - for (k=0; xml_etab[k].c && xml_etab[k].c != in[i]; k++); - if (xml_etab[k].c) { - int l; - - out[j++] = '&'; - memcpy(out+j,xml_etab[k].e,l=strlen(xml_etab[k].e)); - j += l; - out[j++] = ';'; - } else if ((in[i] & 0x7f) < 0x20 || in[i] == '%') { - sprintf(out+j, "%%%02x", (unsigned char)in[i]); - j+=3; - } else { - out[j++] = in[i]; - } - } - out[j] = 0; - return out; -} - -char *glite_lbu_UnescapeXML(const char *in) -{ - char *out; - int i,j,k; - char xtmp[3]; - unsigned char origchar; - - if (!in) return NULL; - out = malloc(strlen(in)+1); - - for (i=j=0; in[i]; j++) if (in[i] == '&') { - char *s = strchr(in+i,';'); - if (s) { - int l = s-in-i+1; - for (k=0; xml_etab[k].c && strncasecmp(in+i+1,xml_etab[k].e,l-2); k++); - if (xml_etab[k].c) { - out[j] = xml_etab[k].c; - i += l; - } else out[j] = in[i++]; - } else out[j] = in[i++]; - } else if (in[i] == '%') { - if (isxdigit(xtmp[0]=in[i+1]) && isxdigit(xtmp[1]=in[i+2])) { - xtmp[2] = '\0'; - origchar = (unsigned char) strtol(xtmp, NULL, 16); - if ((origchar & 0x7f) < 0x20 || origchar == '%') { - out[j] = origchar; - i += 3; - } else out[j] = in[i++]; - } else out[j] = in[i++]; - } else { - out[j] = in[i++]; - } - out[j] = 0; - return out; -} - -char *glite_lbu_EscapeSQL(const char *in) -{ - const char* tmp_in; - char *out = NULL; - int i,j,cnt; - - if (!in) return NULL; - - for (cnt = 0, tmp_in = in; (tmp_in = strchr(tmp_in,'\'')) != NULL; ++tmp_in) { - ++cnt; - } - for (tmp_in = in; (tmp_in = strchr(tmp_in,'\\')) != NULL; ++tmp_in) { - ++cnt; - } - - out = malloc(strlen(in)+1+cnt); - - for (i=j=0; in[i]; i++) { - if (in[i] == '\\') out[j++] = '\\'; - if (in[i] == '\'') out[j++] = '\''; - out[j++] = in[i]; - } - out[j] = 0; - - return out; -} diff --git a/org.glite.lb-utils.trio/src/strio.c b/org.glite.lb-utils.trio/src/strio.c deleted file mode 100644 index f1ab5b8..0000000 --- a/org.glite.lb-utils.trio/src/strio.c +++ /dev/null @@ -1,581 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************/ - -/* - * TODO - * - StrToLongDouble - */ - -static const char rcsid[] = "@(#)$Id$"; - -#if defined(unix) || defined(__xlC__) || defined(__QNX__) -# define PLATFORM_UNIX -#elif defined(WIN32) || defined(_WIN32) -# define PLATFORM_WIN32 -#elif defined(AMIGA) && defined(__GNUC__) -# define PLATFORM_UNIX -#endif - -#if defined(__STDC__) && (__STDC_VERSION__ >= 199901L) -# define TRIO_C99 -#endif - -#include "strio.h" -#include -#include -#include -#include -#include -#include -#ifndef DEBUG -# define NDEBUG -#endif -#include - -#ifndef NULL -# define NULL 0 -#endif -#define NIL ((char)0) -#ifndef FALSE -# define FALSE (1 == 0) -# define TRUE (! FALSE) -#endif - -#define VALID(x) (NULL != (x)) -#define INVALID(x) (NULL == (x)) - -#if defined(PLATFORM_UNIX) -# define USE_STRCASECMP -# define USE_STRNCASECMP -# define USE_STRERROR -# if defined(__QNX__) -# define strcasecmp(x,y) stricmp(x,y) -# define strncasecmp(x,y,n) strnicmp(x,y,n) -# endif -#elif defined(PLATFORM_WIN32) -# define USE_STRCASECMP -# define strcasecmp(x,y) strcmpi(x,y) -#endif - -/************************************************************************* - * StrAppendMax - */ -char *StrAppendMax(char *target, size_t max, const char *source) -{ - assert(VALID(target)); - assert(VALID(source)); - assert(max > 0); - - max -= StrLength(target) + 1; - return (max > 0) ? strncat(target, source, max) : target; -} - -/************************************************************************* - * StrCopyMax - */ -char *StrCopyMax(char *target, size_t max, const char *source) -{ - assert(VALID(target)); - assert(VALID(source)); - assert(max > 0); /* Includes != 0 */ - - target = strncpy(target, source, max - 1); - target[max - 1] = (char)0; - return target; -} - -/************************************************************************* - * StrDuplicate - */ -char *StrDuplicate(const char *source) -{ - char *target; - - assert(VALID(source)); - - target = StrAlloc(StrLength(source) + 1); - if (target) - { - StrCopy(target, source); - } - return target; -} - -/************************************************************************* - * StrDuplicateMax - */ -char *StrDuplicateMax(const char *source, size_t max) -{ - char *target; - size_t len; - - assert(VALID(source)); - assert(max > 0); - - /* Make room for string plus a terminating zero */ - len = StrLength(source) + 1; - if (len > max) - { - len = max; - } - target = StrAlloc(len); - if (target) - { - StrCopyMax(target, len, source); - } - return target; -} - -/************************************************************************* - * StrEqual - */ -int StrEqual(const char *first, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { -#if defined(USE_STRCASECMP) - return (0 == strcasecmp(first, second)); -#else - while ((*first != NIL) && (*second != NIL)) - { - if (toupper(*first) != toupper(*second)) - { - break; - } - first++; - second++; - } - return ((*first == NIL) && (*second == NIL)); -#endif - } - return FALSE; -} - -/************************************************************************* - * StrEqualCase - */ -int StrEqualCase(const char *first, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { - return (0 == strcmp(first, second)); - } - return FALSE; -} - -/************************************************************************* - * StrEqualCaseMax - */ -int StrEqualCaseMax(const char *first, size_t max, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { - return (0 == strncmp(first, second, max)); - } - return FALSE; -} - -/************************************************************************* - * StrEqualLocale - */ -int StrEqualLocale(const char *first, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - -#if defined(LC_COLLATE) - return (strcoll(first, second) == 0); -#else - return StrEqual(first, second); -#endif -} - -/************************************************************************* - * StrEqualMax - */ -int StrEqualMax(const char *first, size_t max, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { -#if defined(USE_STRNCASECMP) - return (0 == strncasecmp(first, second, max)); -#else - /* Not adequately tested yet */ - size_t cnt = 0; - while ((*first != NIL) && (*second != NIL) && (cnt <= max)) - { - if (toupper(*first) != toupper(*second)) - { - break; - } - first++; - second++; - cnt++; - } - return ((cnt == max) || ((*first == NIL) && (*second == NIL))); -#endif - } - return FALSE; -} - -/************************************************************************* - * StrError - */ -const char *StrError(int errorNumber) -{ -#if defined(USE_STRERROR) - return strerror(errorNumber); -#else - return "unknown"; -#endif -} - -/************************************************************************* - * StrFormatDate - */ -size_t StrFormatDateMax(char *target, - size_t max, - const char *format, - const struct tm *datetime) -{ - assert(VALID(target)); - assert(VALID(format)); - assert(VALID(datetime)); - assert(max > 0); - - return strftime(target, max, format, datetime); -} - -/************************************************************************* - * StrHash - */ -unsigned long StrHash(const char *string, int type) -{ - unsigned long value = 0L; - char ch; - - assert(VALID(string)); - - switch (type) - { - case STRIO_HASH_PLAIN: - while ( (ch = *string++) != NIL ) - { - value *= 31; - value += (unsigned long)ch; - } - break; - default: - assert(FALSE); - break; - } - return value; -} - -/************************************************************************* - * StrMatch - */ -int StrMatch(char *string, char *pattern) -{ - assert(VALID(string)); - assert(VALID(pattern)); - - for (; ('*' != *pattern); ++pattern, ++string) - { - if (NIL == *string) - { - return (NIL == *pattern); - } - if ((toupper((int)*string) != toupper((int)*pattern)) - && ('?' != *pattern)) - { - return FALSE; - } - } - /* two-line patch to prevent *too* much recursiveness: */ - while ('*' == pattern[1]) - pattern++; - - do - { - if ( StrMatch(string, &pattern[1]) ) - { - return TRUE; - } - } - while (*string++); - - return FALSE; -} - -/************************************************************************* - * StrMatchCase - */ -int StrMatchCase(char *string, char *pattern) -{ - assert(VALID(string)); - assert(VALID(pattern)); - - for (; ('*' != *pattern); ++pattern, ++string) - { - if (NIL == *string) - { - return (NIL == *pattern); - } - if ((*string != *pattern) - && ('?' != *pattern)) - { - return FALSE; - } - } - /* two-line patch to prevent *too* much recursiveness: */ - while ('*' == pattern[1]) - pattern++; - - do - { - if ( StrMatchCase(string, &pattern[1]) ) - { - return TRUE; - } - } - while (*string++); - - return FALSE; -} - -/************************************************************************* - * StrSpanFunction - * - * Untested - */ -size_t StrSpanFunction(char *source, int (*Function)(int)) -{ - size_t count = 0; - - assert(VALID(source)); - assert(VALID(Function)); - - while (*source != NIL) - { - if (Function(*source)) - break; /* while */ - source++; - count++; - } - return count; -} - -/************************************************************************* - * StrSubstringMax - */ -char *StrSubstringMax(const char *string, size_t max, const char *find) -{ - size_t count; - size_t size; - char *result = NULL; - - assert(VALID(string)); - assert(VALID(find)); - - size = StrLength(find); - if (size <= max) - { - for (count = 0; count <= max - size; count++) - { - if (StrEqualMax(find, size, &string[count])) - { - result = (char *)&string[count]; - break; - } - } - } - return result; -} - -/************************************************************************* - * StrToDouble - * - * double ::= [ ] - * ( | - * | - * ) - * [ [ ] ] - * number ::= 1*( ) - * digit ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ) - * exponential ::= ( 'e' | 'E' ) - * sign ::= ( '-' | '+' ) - * decimal_point ::= '.' - */ -double StrToDouble(const char *source, const char **endp) -{ -#if defined(TRIO_C99) - return strtod(source, endp); -#else - /* Preliminary code */ - int isNegative = FALSE; - int isExponentNegative = FALSE; - unsigned long integer = 0; - unsigned long fraction = 0; - unsigned long fracdiv = 1; - unsigned long exponent = 0; - double value = 0.0; - - /* First try hex-floats */ - if ((source[0] == '0') && ((source[1] == 'x') || (source[1] == 'X'))) - { - source += 2; - while (isxdigit((int)*source)) - { - integer *= 16; - integer += (isdigit((int)*source) - ? (*source - '0') - : 10 + (toupper((int)*source) - 'A')); - source++; - } - if (*source == '.') - { - source++; - while (isxdigit((int)*source)) - { - fraction *= 16; - fraction += (isdigit((int)*source) - ? (*source - '0') - : 10 + (toupper((int)*source) - 'A')); - fracdiv *= 16; - source++; - } - if ((*source == 'p') || (*source == 'P')) - { - source++; - if ((*source == '+') || (*source == '-')) - { - isExponentNegative = (*source == '-'); - source++; - } - while (isdigit((int)*source)) - { - exponent *= 10; - exponent += (*source - '0'); - source++; - } - } - } - } - else /* Then try normal decimal floats */ - { - isNegative = (*source == '-'); - /* Skip sign */ - if ((*source == '+') || (*source == '-')) - source++; - - /* Integer part */ - while (isdigit((int)*source)) - { - integer *= 10; - integer += (*source - '0'); - source++; - } - - if (*source == '.') - { - source++; /* skip decimal point */ - while (isdigit((int)*source)) - { - fraction *= 10; - fraction += (*source - '0'); - fracdiv *= 10; - source++; - } - } - if ((*source == 'e') || (*source == 'E')) - { - source++; /* Skip exponential indicator */ - isExponentNegative = (*source == '-'); - if ((*source == '+') || (*source == '-')) - source++; - while (isdigit((int)*source)) - { - exponent *= 10; - exponent += (*source - '0'); - source++; - } - } - } - - value = (double)integer; - if (fraction != 0) - { - value += (double)fraction / (double)fracdiv; - } - if (exponent != 0) - { - if (isExponentNegative) - value /= pow((double)10, (double)exponent); - else - value *= pow((double)10, (double)exponent); - } - if (isNegative) - value = -value; - - if (endp) - *endp = source; - return value; -#endif -} - -/************************************************************************* - * StrToFloat - */ -float StrToFloat(const char *source, const char **endp) -{ -#if defined(TRIO_C99) - return strtof(source, endp); -#else - return (float)StrToDouble(source, endp); -#endif -} - -/************************************************************************* - * StrToUpper - */ -int StrToUpper(char *target) -{ - int i = 0; - - assert(VALID(target)); - - while (NIL != *target) - { - *target = toupper((int)*target); - target++; - i++; - } - return i; -} diff --git a/org.glite.lb-utils.trio/src/strio.h b/org.glite.lb-utils.trio/src/strio.h deleted file mode 100644 index 68845a3..0000000 --- a/org.glite.lb-utils.trio/src/strio.h +++ /dev/null @@ -1,227 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************/ - -#ifndef TRIO_STRIO_H -#define TRIO_STRIO_H - -#if !(defined(DEBUG) || defined(NDEBUG)) -# define NDEBUG -#endif -#include -#include -#include -#include - -#ifndef STRIO_MALLOC -# define STRIO_MALLOC(n) malloc(n) -#endif -#ifndef STRIO_FREE -# define STRIO_FREE(x) free(x) -#endif - -/* - * StrAppend(target, source) - * StrAppendMax(target, maxsize, source) - * - * Append 'source' to 'target' - * - * target = StrAlloc(size) - * - * Allocate a new string - * - * StrContains(target, substring) - * - * Find out if the string 'substring' is - * contained in the string 'target' - * - * StrCopy(target, source) - * StrCopyMax(target, maxsize, source) - * - * Copy 'source' to 'target' - * - * target = StrDuplicate(source) - * target = StrDuplicateMax(source, maxsize) - * - * Allocate and copy 'source' to 'target' - * - * StrEqual(first, second) - * StrEqualMax(first, maxsize, second) - * - * Compare if 'first' is equal to 'second'. - * Case-independent. - * - * StrEqualCase(first, second) - * StrEqualCaseMax(first, maxsize, second) - * - * Compare if 'first' is equal to 'second' - * Case-dependent. Please note that the use of the - * word 'case' has the opposite meaning as that of - * strcasecmp(). - * - * StrFormat(target, format, ...) - * StrFormatMax(target, maxsize, format, ...) - * - * Build 'target' according to 'format' and succesive - * arguments. This is equal to the sprintf() and - * snprintf() functions. - * - * StrFormatDate(target, format, ...) - * - * StrFree(target) - * - * De-allocates a string - * - * StrHash(string, type) - * - * Calculates the hash value of 'string' based on the - * 'type'. - * - * StrIndex(target, character) - * StrIndexLast(target, character) - * - * Find the first/last occurrence of 'character' in - * 'target' - * - * StrLength(target) - * - * Return the length of 'target' - * - * StrMatch(string, pattern) - * StrMatchCase(string, pattern) - * - * Find 'pattern' within 'string'. 'pattern' may contain - * wildcards such as * (asterics) and ? (question mark) - * which matches zero or more characters and exactly - * on character respectively - * - * StrScan(source, format, ...) - * - * Equal to sscanf() - * - * StrSubstring(target, substring) - * - * Find the first occurrence of the string 'substring' - * within the string 'target' - * - * StrTokenize(target, list) - * - * Split 'target' into the first token delimited by - * one of the characters in 'list'. If 'target' is - * NULL then next token will be returned. - * - * StrToUpper(target) - * - * Convert all lower case characters in 'target' into - * upper case characters. - */ - -enum { - STRIO_HASH_NONE = 0, - STRIO_HASH_PLAIN, - STRIO_HASH_TWOSIGNED -}; - -#if !defined(DEBUG) || defined(__DECC) -#define StrAlloc(n) (char *)STRIO_MALLOC(n) -#define StrAppend(x,y) strcat((x), (y)) -#define StrContains(x,y) (0 != strstr((x), (y))) -#define StrCopy(x,y) strcpy((x), (y)) -#define StrIndex(x,y) strchr((x), (y)) -#define StrIndexLast(x,y) strrchr((x), (y)) -#define StrFree(x) STRIO_FREE(x) -#define StrLength(x) strlen((x)) -#define StrSubstring(x,y) strstr((x), (y)) -#define StrTokenize(x,y) strtok((x), (y)) -#define StrToLong(x,y,n) strtol((x), (y), (n)) -#define StrToUnsignedLong(x,y,n) strtoul((x), (y), (n)) -#else /* DEBUG */ - /* - * To be able to use these macros everywhere, including in - * if() sentences, the assertions are put first in a comma - * seperated list. - * - * Unfortunately the DECC compiler does not seem to like this - * so it will use the un-asserted functions above for the - * debugging case too. - */ -#define StrAlloc(n) \ - (assert((n) > 0),\ - (char *)STRIO_MALLOC(n)) -#define StrAppend(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - strcat((x), (y))) -#define StrContains(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - (0 != strstr((x), (y)))) -#define StrCopy(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - strcpy((x), (y))) -#define StrIndex(x,c) \ - (assert((x) != NULL),\ - strchr((x), (c))) -#define StrIndexLast(x,c) \ - (assert((x) != NULL),\ - strrchr((x), (c))) -#define StrFree(x) \ - (assert((x) != NULL),\ - STRIO_FREE(x)) -#define StrLength(x) \ - (assert((x) != NULL),\ - strlen((x))) -#define StrSubstring(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - strstr((x), (y))) -#define StrTokenize(x,y) \ - (assert((y) != NULL),\ - strtok((x), (y))) -#define StrToLong(x,y,n) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - assert((n) >= 2 && (n) <= 36),\ - strtol((x), (y), (n))) -#define StrToUnsignedLong(x,y,n) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - assert((n) >= 2 && (n) <= 36),\ - strtoul((x), (y), (n))) -#endif /* DEBUG */ - -char *StrAppendMax(char *target, size_t max, const char *source); -char *StrCopyMax(char *target, size_t max, const char *source); -char *StrDuplicate(const char *source); -char *StrDuplicateMax(const char *source, size_t max); -int StrEqual(const char *first, const char *second); -int StrEqualCase(const char *first, const char *second); -int StrEqualCaseMax(const char *first, size_t max, const char *second); -int StrEqualLocale(const char *first, const char *second); -int StrEqualMax(const char *first, size_t max, const char *second); -const char *StrError(int); -size_t StrFormatDateMax(char *target, size_t max, const char *format, const struct tm *datetime); -unsigned long StrHash(const char *string, int type); -int StrMatch(char *string, char *pattern); -int StrMatchCase(char *string, char *pattern); -size_t StrSpanFunction(char *source, int (*Function)(int)); -char *StrSubstringMax(const char *string, size_t max, const char *find); -float StrToFloat(const char *source, const char **target); -double StrToDouble(const char *source, const char **target); -int StrToUpper(char *target); - -#endif /* TRIO_STRIO_H */ diff --git a/org.glite.lb-utils.trio/src/trio.c b/org.glite.lb-utils.trio/src/trio.c deleted file mode 100644 index 6e4211e..0000000 --- a/org.glite.lb-utils.trio/src/trio.c +++ /dev/null @@ -1,5706 +0,0 @@ - -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************* - * - * A note to trio contributors: - * - * Avoid heap allocation at all costs to ensure that the trio functions - * are async-safe. The exceptions are the printf/fprintf functions, which - * uses fputc, and the asprintf functions and the modifier, which - * by design are required to allocate form the heap. - * - ************************************************************************/ - -/* - * TODO: - * - Scan is probably too permissive about its modifiers. - * - C escapes in %#[] ? - * - C99 support has not been properly tested. - * - Multibyte characters (done for format parsing, except scan groups) - * - Complex numbers? (C99 _Complex) - * - Boolean values? (C99 _Bool) - * - C99 NaN(n-char-sequence) missing - * - Should we support the GNU %a alloc modifier? GNU has an ugly hack - * for %a, because C99 used %a for other purposes. If specified as - * %as or %a[ it is interpreted as the alloc modifier, otherwise as - * the C99 hex-float. This means that you cannot scan %as as a hex-float - * immediately followed by an 's'. - * - Scanning of collating symbols. - */ - -static const char rcsid[] = "@(#)$Id$"; - -/************************************************************************* - * Trio include files - */ -#include "trio.h" -#include "triop.h" -#include "strio.h" - -#ifdef DATAGRID_EXTENSION -#include "escape.h" -#endif - -/* - * Encode the error code and the position. This is decoded - * with TRIO_ERROR_CODE and TRIO_ERROR_POSITION. - */ -#if TRIO_ERRORS -# define TRIO_ERROR_RETURN(x,y) (- ((x) + ((y) << 8))) -#else -# define TRIO_ERROR_RETURN(x,y) (-1) -#endif - - -/************************************************************************* - * Platform and compiler support detection - */ -#if defined(unix) || defined(__xlC__) || defined(_AIX) || defined(__QNX__) -# define PLATFORM_UNIX -#elif defined(AMIGA) && defined(__GNUC__) -# define PLATFORM_UNIX -#elif defined(WIN32) || defined(_WIN32) || defined(_MSC_VER) -# define PLATFORM_WIN32 -# define TRIO_MSVC_5 1100 -#endif - -#if defined(__STDC__) && defined(__STDC_VERSION__) -# if (__STDC_VERSION__ >= 199409L) -# define TRIO_COMPILER_SUPPORTS_ISO94 -# endif -# if (__STDC_VERSION__ >= 199901L) -# define TRIO_COMPILER_SUPPORTS_C99 -# endif -#endif - -#if defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED) -# define TRIO_COMPILER_SUPPORTS_UNIX98 -#endif - -#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR -# define TRIO_COMPILER_SUPPORTS_MULTIBYTE -# if !defined(MB_LEN_MAX) -# define MB_LEN_MAX 6 -# endif -#endif - - -/************************************************************************* - * Generic definitions - */ - -#if !(defined(DEBUG) || defined(NDEBUG)) -# define NDEBUG -#endif -#include -#include -#if !defined(TRIO_COMPILER_SUPPORTS_C99) && !defined(isblank) -# define isblank(x) (((x)==32) || ((x)==9)) -#endif -#include -#include -#include -#include -#include -#include - -#ifndef NULL -# define NULL 0 -#endif -#define NIL ((char)0) -#ifndef FALSE -# define FALSE (1 == 0) -# define TRUE (! FALSE) -#endif -#define BOOLEAN_T int - -/* mincore() can be used for debugging purposes */ -#define VALID(x) (NULL != (x)) - -/* xlC crashes on log10(0) */ -#define guarded_log10(x) (((x) == 0.0) ? -HUGE_VAL : log10(x)) -#define guarded_log16(x) (guarded_log10(x) / log10(16.0)) - - -/************************************************************************* - * Platform specific definitions - */ -#if defined(PLATFORM_UNIX) -# include -# include -# include -# define USE_LOCALE -#endif /* PLATFORM_UNIX */ -#if defined(PLATFORM_WIN32) -# include -# define read _read -# define write _write -#endif /* PLATFORM_WIN32 */ - -#if TRIO_WIDECHAR -# if defined(TRIO_COMPILER_SUPPORTS_ISO94) -# include -# include -# else -typedef char wchar_t; -typedef int wint_t; -# define WEOF EOF -# define iswalnum(x) isalnum(x) -# define iswalpha(x) isalpha(x) -# define iswblank(x) isblank(x) -# define iswcntrl(x) iscntrl(x) -# define iswdigit(x) isdigit(x) -# define iswgraph(x) isgraph(x) -# define iswlower(x) islower(x) -# define iswprint(x) isprint(x) -# define iswpunct(x) ispunct(x) -# define iswspace(x) isspace(x) -# define iswupper(x) isupper(x) -# define iswxdigit(x) isxdigit(x) -# endif -#endif - - -/************************************************************************* - * Compiler dependent definitions - */ - -/* Support for long long */ -#ifndef __cplusplus -# if !defined(USE_LONGLONG) -# if defined(__GNUC__) && !defined(__STRICT_ANSI__) -# define USE_LONGLONG -# elif defined(__SUNPRO_C) -# define USE_LONGLONG -# elif defined(_LONG_LONG) || defined(_LONGLONG) -# define USE_LONGLONG -# endif -# endif -#endif - -/* The extra long numbers */ -#if defined(USE_LONGLONG) -typedef signed long long int trio_longlong_t; -typedef unsigned long long int trio_ulonglong_t; -#elif defined(_MSC_VER) -# if (_MSC_VER >= TRIO_MSVC_5) -typedef signed __int64 trio_longlong_t; -typedef unsigned __int64 trio_ulonglong_t; -# else -typedef signed long int trio_longlong_t; -typedef unsigned long int trio_ulonglong_t; -# endif -#else -typedef signed long int trio_longlong_t; -typedef unsigned long int trio_ulonglong_t; -#endif - -/* Maximal and fixed integer types */ -#if defined(TRIO_COMPILER_SUPPORTS_C99) -# include -typedef intmax_t trio_intmax_t; -typedef uintmax_t trio_uintmax_t; -typedef int8_t trio_int8_t; -typedef int16_t trio_int16_t; -typedef int32_t trio_int32_t; -typedef int64_t trio_int64_t; -#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98) -# include -typedef intmax_t trio_intmax_t; -typedef uintmax_t trio_uintmax_t; -typedef int8_t trio_int8_t; -typedef int16_t trio_int16_t; -typedef int32_t trio_int32_t; -typedef int64_t trio_int64_t; -#elif defined(_MSC_VER) && (_MSC_VER >= TRIO_MSVC_5) -typedef trio_longlong_t trio_intmax_t; -typedef trio_ulonglong_t trio_uintmax_t; -typedef __int8 trio_int8_t; -typedef __int16 trio_int16_t; -typedef __int32 trio_int32_t; -typedef __int64 trio_int64_t; -#else -typedef trio_longlong_t trio_intmax_t; -typedef trio_ulonglong_t trio_uintmax_t; -# if defined(TRIO_INT8_T) -typedef TRIO_INT8_T trio_int8_t; -# else -typedef signed char trio_int8_t; -# endif -# if defined(TRIO_INT16_T) -typedef TRIO_INT16_T trio_int16_t; -# else -typedef signed short trio_int16_t; -# endif -# if defined(TRIO_INT32_T) -typedef TRIO_INT32_T trio_int32_t; -# else -typedef signed int trio_int32_t; -# endif -# if defined(TRIO_INT64_T) -typedef TRIO_INT64_T trio_int64_t; -# else -typedef trio_longlong_t trio_int64_t; -# endif -#endif - - -/************************************************************************* - * Internal definitions - */ - -/* Long double sizes */ -#ifdef LDBL_DIG -# define MAX_MANTISSA_DIGITS LDBL_DIG -# define MAX_EXPONENT_DIGITS 4 -#else -# define MAX_MANTISSA_DIGITS DBL_DIG -# define MAX_EXPONENT_DIGITS 3 -#endif - -/* The maximal number of digits is for base 2 */ -#define MAX_CHARS_IN(x) (sizeof(x) * CHAR_BIT) -/* The width of a pointer. The number of bits in a hex digit is 4 */ -#define POINTER_WIDTH ((sizeof("0x") - 1) + sizeof(void *) * CHAR_BIT / 4) - -/* Infinite and Not-A-Number for floating-point */ -#define INFINITE_LOWER "inf" -#define INFINITE_UPPER "INF" -#define LONG_INFINITE_LOWER "infinite" -#define LONG_INFINITE_UPPER "INFINITE" -#define NAN_LOWER "nan" -#define NAN_UPPER "NAN" - -/* Various constants */ -enum { - TYPE_PRINT = 1, - TYPE_SCAN = 2, - - /* Flags. Use maximum 32 */ - FLAGS_NEW = 0, - FLAGS_STICKY = 1, - FLAGS_SPACE = 2 * FLAGS_STICKY, - FLAGS_SHOWSIGN = 2 * FLAGS_SPACE, - FLAGS_LEFTADJUST = 2 * FLAGS_SHOWSIGN, - FLAGS_ALTERNATIVE = 2 * FLAGS_LEFTADJUST, - FLAGS_SHORT = 2 * FLAGS_ALTERNATIVE, - FLAGS_SHORTSHORT = 2 * FLAGS_SHORT, - FLAGS_LONG = 2 * FLAGS_SHORTSHORT, - FLAGS_QUAD = 2 * FLAGS_LONG, - FLAGS_LONGDOUBLE = 2 * FLAGS_QUAD, - FLAGS_SIZE_T = 2 * FLAGS_LONGDOUBLE, - FLAGS_PTRDIFF_T = 2 * FLAGS_SIZE_T, - FLAGS_INTMAX_T = 2 * FLAGS_PTRDIFF_T, - FLAGS_NILPADDING = 2 * FLAGS_INTMAX_T, - FLAGS_UNSIGNED = 2 * FLAGS_NILPADDING, - FLAGS_UPPER = 2 * FLAGS_UNSIGNED, - FLAGS_WIDTH = 2 * FLAGS_UPPER, - FLAGS_WIDTH_PARAMETER = 2 * FLAGS_WIDTH, - FLAGS_PRECISION = 2 * FLAGS_WIDTH_PARAMETER, - FLAGS_PRECISION_PARAMETER = 2 * FLAGS_PRECISION, - FLAGS_BASE = 2 * FLAGS_PRECISION_PARAMETER, - FLAGS_BASE_PARAMETER = 2 * FLAGS_BASE, - FLAGS_FLOAT_E = 2 * FLAGS_BASE_PARAMETER, - FLAGS_FLOAT_G = 2 * FLAGS_FLOAT_E, - FLAGS_QUOTE = 2 * FLAGS_FLOAT_G, - FLAGS_WIDECHAR = 2 * FLAGS_QUOTE, - FLAGS_ALLOC = 2 * FLAGS_WIDECHAR, - FLAGS_IGNORE = 2 * FLAGS_ALLOC, - FLAGS_IGNORE_PARAMETER = 2 * FLAGS_IGNORE, - FLAGS_VARSIZE_PARAMETER = 2 * FLAGS_IGNORE_PARAMETER, - FLAGS_FIXED_SIZE = 2 * FLAGS_VARSIZE_PARAMETER, - /* Reused flags */ - FLAGS_EXCLUDE = FLAGS_SHORT, - FLAGS_USER_DEFINED = FLAGS_IGNORE, - /* Compounded flags */ - FLAGS_ALL_VARSIZES = FLAGS_LONG | FLAGS_QUAD | FLAGS_INTMAX_T | FLAGS_PTRDIFF_T | FLAGS_SIZE_T, - FLAGS_ALL_SIZES = FLAGS_ALL_VARSIZES | FLAGS_SHORTSHORT | FLAGS_SHORT, - - NO_POSITION = -1, - NO_WIDTH = 0, - NO_PRECISION = -1, - NO_SIZE = -1, - - NO_BASE = -1, - MIN_BASE = 2, - MAX_BASE = 36, - BASE_BINARY = 2, - BASE_OCTAL = 8, - BASE_DECIMAL = 10, - BASE_HEX = 16, - - /* Maximal number of allowed parameters */ - MAX_PARAMETERS = 64, - /* Maximal number of characters in class */ - MAX_CHARACTER_CLASS = UCHAR_MAX, - - /* Maximal string lengths for user-defined specifiers */ - MAX_USER_NAME = 64, - MAX_USER_DATA = 256, - - /* Maximal length of locale separator strings */ - MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX, - /* Maximal number of integers in grouping */ - MAX_LOCALE_GROUPS = 64 -}; - -#define NO_GROUPING ((int)CHAR_MAX) - -/* Fundamental formatting parameter types */ -#define FORMAT_UNKNOWN 0 -#define FORMAT_INT 1 -#define FORMAT_DOUBLE 2 -#define FORMAT_CHAR 3 -#define FORMAT_STRING 4 -#define FORMAT_POINTER 5 -#define FORMAT_COUNT 6 -#define FORMAT_PARAMETER 7 -#define FORMAT_GROUP 8 -#if TRIO_GNU -# define FORMAT_ERRNO 9 -#endif -#if TRIO_EXTENSION -# define FORMAT_USER_DEFINED 10 -#endif - -/* Character constants */ -#define CHAR_IDENTIFIER '%' -#define CHAR_BACKSLASH '\\' -#define CHAR_QUOTE '\"' -#define CHAR_ADJUST ' ' - -/* Character class expressions */ -#define CLASS_ALNUM ":alnum:" -#define CLASS_ALPHA ":alpha:" -#define CLASS_CNTRL ":cntrl:" -#define CLASS_DIGIT ":digit:" -#define CLASS_GRAPH ":graph:" -#define CLASS_LOWER ":lower:" -#define CLASS_PRINT ":print:" -#define CLASS_PUNCT ":punct:" -#define CLASS_SPACE ":space:" -#define CLASS_UPPER ":upper:" -#define CLASS_XDIGIT ":xdigit:" - -/* - * SPECIFIERS: - * - * - * a Hex-float - * A Hex-float - * c Character - * C Widechar character (wint_t) - * d Decimal - * e Float - * E Float - * F Float - * F Float - * g Float - * G Float - * i Integer - * m Error message - * n Count - * o Octal - * p Pointer - * s String - * S Widechar string (wchar_t *) - * u Unsigned - * x Hex - * X Hex - * [] Group - * <> User-defined - * - * Reserved: - * - * D Binary Coded Decimal %D(length,precision) (OS/390) - */ -#define SPECIFIER_CHAR 'c' -#define SPECIFIER_STRING 's' -#define SPECIFIER_DECIMAL 'd' -#define SPECIFIER_INTEGER 'i' -#define SPECIFIER_UNSIGNED 'u' -#define SPECIFIER_OCTAL 'o' -#define SPECIFIER_HEX 'x' -#define SPECIFIER_HEX_UPPER 'X' -#define SPECIFIER_FLOAT_E 'e' -#define SPECIFIER_FLOAT_E_UPPER 'E' -#define SPECIFIER_FLOAT_F 'f' -#define SPECIFIER_FLOAT_F_UPPER 'F' -#define SPECIFIER_FLOAT_G 'g' -#define SPECIFIER_FLOAT_G_UPPER 'G' -#define SPECIFIER_POINTER 'p' -#define SPECIFIER_GROUP '[' -#define SPECIFIER_UNGROUP ']' -#define SPECIFIER_COUNT 'n' -#if TRIO_UNIX98 -# define SPECIFIER_CHAR_UPPER 'C' -# define SPECIFIER_STRING_UPPER 'S' -#endif -#if TRIO_C99 -# define SPECIFIER_HEXFLOAT 'a' -# define SPECIFIER_HEXFLOAT_UPPER 'A' -#endif -#if TRIO_GNU -# define SPECIFIER_ERRNO 'm' -#endif -#if TRIO_EXTENSION -# define SPECIFIER_BINARY 'b' -# define SPECIFIER_BINARY_UPPER 'B' -# define SPECIFIER_USER_DEFINED_BEGIN '<' -# define SPECIFIER_USER_DEFINED_END '>' -# define SPECIFIER_USER_DEFINED_SEPARATOR ':' -#endif - -/* - * QUALIFIERS: - * - * - * Numbers = d,i,o,u,x,X - * Float = a,A,e,E,f,F,g,G - * String = s - * Char = c - * - * - * 9$ Position - * Use the 9th parameter. 9 can be any number between 1 and - * the maximal argument - * - * 9 Width - * Set width to 9. 9 can be any number, but must not be postfixed - * by '$' - * - * h Short - * Numbers: - * (unsigned) short int - * - * hh Short short - * Numbers: - * (unsigned) char - * - * l Long - * Numbers: - * (unsigned) long int - * String: - * as the S specifier - * Char: - * as the C specifier - * - * ll Long Long - * Numbers: - * (unsigned) long long int - * - * L Long Double - * Float - * long double - * - * # Alternative - * Float: - * Decimal-point is always present - * String: - * non-printable characters are handled as \number - * - * Spacing - * - * + Sign - * - * - Alignment - * - * . Precision - * - * * Parameter - * print: use parameter - * scan: no parameter (ignore) - * - * q Quad - * - * Z size_t - * - * w Widechar - * - * ' Thousands/quote - * Numbers: - * Integer part grouped in thousands - * Binary numbers: - * Number grouped in nibbles (4 bits) - * String: - * Quoted string - * - * j intmax_t - * t prtdiff_t - * z size_t - * - * ! Sticky - * @ Parameter (for both print and scan) - * - * I n-bit Integer - * Numbers: - * The following options exists - * I8 = 8-bit integer - * I16 = 16-bit integer - * I32 = 32-bit integer - * I64 = 64-bit integer - */ -#define QUALIFIER_POSITION '$' -#define QUALIFIER_SHORT 'h' -#define QUALIFIER_LONG 'l' -#define QUALIFIER_LONG_UPPER 'L' -#define QUALIFIER_ALTERNATIVE '#' -#define QUALIFIER_SPACE ' ' -#define QUALIFIER_PLUS '+' -#define QUALIFIER_MINUS '-' -#define QUALIFIER_DOT '.' -#define QUALIFIER_STAR '*' -#define QUALIFIER_CIRCUMFLEX '^' -#if TRIO_C99 -# define QUALIFIER_SIZE_T 'z' -# define QUALIFIER_PTRDIFF_T 't' -# define QUALIFIER_INTMAX_T 'j' -#endif -#if TRIO_BSD || TRIO_GNU -# define QUALIFIER_QUAD 'q' -#endif -#if TRIO_GNU -# define QUALIFIER_SIZE_T_UPPER 'Z' -#endif -#if TRIO_MISC -# define QUALIFIER_WIDECHAR 'w' -#endif -#if TRIO_MICROSOFT -# define QUALIFIER_FIXED_SIZE 'I' -#endif -#if TRIO_EXTENSION -# define QUALIFIER_QUOTE '\'' -# define QUALIFIER_STICKY '!' -# define QUALIFIER_VARSIZE '&' /* This should remain undocumented */ -# define QUALIFIER_PARAM '@' /* Experimental */ -# define QUALIFIER_COLON ':' /* For scanlists */ -# define QUALIFIER_EQUAL '=' /* For scanlists */ -#endif -#if DATAGRID_EXTENSION -# define QUALIFIER_ESCAPE '|' -#endif - - -/************************************************************************* - * Internal structures - */ - -/* Parameters */ -typedef struct { - int type; - unsigned long flags; - int width; - int precision; - int base; - int varsize; -#ifdef QUALIFIER_ESCAPE - enum dg_escape { ESCAPE_NONE, ESCAPE_ULM, ESCAPE_XML, ESCAPE_SQL } escape; -#endif - int indexAfterSpecifier; - union { - char *string; -#if TRIO_WIDECHAR - wchar_t *wstring; -#endif - void *pointer; - union { - trio_uintmax_t as_signed; - trio_intmax_t as_unsigned; - } number; - double doubleNumber; - double *doublePointer; - long double longdoubleNumber; - long double *longdoublePointer; - int errorNumber; - } data; - /* For the user-defined specifier */ - char user_name[MAX_USER_NAME]; - char user_data[MAX_USER_DATA]; -} parameter_T; - -/* General trio "class" */ -typedef struct _trio_T { - void *location; - void (*OutStream)(struct _trio_T *, int); - void (*InStream)(struct _trio_T *, int *); - /* - * The number of characters that would have been written/read if - * there had been sufficient space. - */ - int processed; - /* - * The number of characters that are actually written/read. - * Processed and committed with only differ for the *nprintf - * and *nscanf functions. - */ - int committed; - int max; - int current; -} trio_T; - -/* References (for user-defined callbacks) */ -typedef struct _reference_T { - trio_T *data; - parameter_T *parameter; -} reference_T; - -/* Registered entries (for user-defined callbacks) */ -typedef struct _userdef_T { - struct _userdef_T *next; - trio_callback_t callback; - char *name; -} userdef_T; - - -/************************************************************************* - * Internal variables - */ - -static const char null[] = "(nil)"; - -#if defined(USE_LOCALE) -static struct lconv *internalLocaleValues = NULL; -#endif - -/* - * UNIX98 says "in a locale where the radix character is not defined, - * the radix character defaults to a period (.)" - */ -static char internalDecimalPoint[MAX_LOCALE_SEPARATOR_LENGTH + 1] = "."; -static char internalThousandSeparator[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ","; -static char internalGrouping[MAX_LOCALE_GROUPS] = { (char)NO_GROUPING }; - -static const char internalDigitsLower[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -static const char internalDigitsUpper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -static BOOLEAN_T internalDigitsUnconverted = TRUE; -static int internalDigitArray[128]; -#if TRIO_EXTENSION -static BOOLEAN_T internalCollationUnconverted = TRUE; -static char internalCollationArray[MAX_CHARACTER_CLASS][MAX_CHARACTER_CLASS]; -#endif - -static volatile trio_callback_t internalEnterCriticalRegion = NULL; -static volatile trio_callback_t internalLeaveCriticalRegion = NULL; -static userdef_T *internalUserDef = NULL; - - -/************************************************************************* - * trio_strerror [public] - */ -const char *trio_strerror(int errorcode) -{ - /* Textual versions of the error codes */ - switch (TRIO_ERROR_CODE(errorcode)) - { - case TRIO_EOF: - return "End of file"; - case TRIO_EINVAL: - return "Invalid argument"; - case TRIO_ETOOMANY: - return "Too many arguments"; - case TRIO_EDBLREF: - return "Double reference"; - case TRIO_EGAP: - return "Reference gap"; - case TRIO_ENOMEM: - return "Out of memory"; - case TRIO_ERANGE: - return "Invalid range"; - default: - return "Unknown"; - } -} - -/************************************************************************* - * TrioIsQualifier [private] - * - * Description: - * Remember to add all new qualifiers to this function. - * QUALIFIER_POSITION must not be added. - */ -static BOOLEAN_T -TrioIsQualifier(const char ch) -{ - /* QUALIFIER_POSITION is not included */ - switch (ch) - { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case QUALIFIER_PLUS: - case QUALIFIER_MINUS: - case QUALIFIER_SPACE: - case QUALIFIER_DOT: - case QUALIFIER_STAR: - case QUALIFIER_ALTERNATIVE: - case QUALIFIER_SHORT: - case QUALIFIER_LONG: - case QUALIFIER_LONG_UPPER: - case QUALIFIER_CIRCUMFLEX: -#if defined(QUALIFIER_SIZE_T) - case QUALIFIER_SIZE_T: -#endif -#if defined(QUALIFIER_PTRDIFF_T) - case QUALIFIER_PTRDIFF_T: -#endif -#if defined(QUALIFIER_INTMAX_T) - case QUALIFIER_INTMAX_T: -#endif -#if defined(QUALIFIER_QUAD) - case QUALIFIER_QUAD: -#endif -#if defined(QUALIFIER_SIZE_T_UPPER) - case QUALIFIER_SIZE_T_UPPER: -#endif -#if defined(QUALIFIER_WIDECHAR) - case QUALIFIER_WIDECHAR: -#endif -#if defined(QUALIFIER_QUOTE) - case QUALIFIER_QUOTE: -#endif -#if defined(QUALIFIER_STICKY) - case QUALIFIER_STICKY: -#endif -#if defined(QUALIFIER_VARSIZE) - case QUALIFIER_VARSIZE: -#endif -#if defined(QUALIFIER_PARAM) - case QUALIFIER_PARAM: -#endif -#if defined(QUALIFIER_FIXED_SIZE) - case QUALIFIER_FIXED_SIZE: -#endif -#ifdef QUALIFIER_ESCAPE - case QUALIFIER_ESCAPE: -#endif - return TRUE; - default: - return FALSE; - } -} - -/************************************************************************* - * TrioGenerateNan [private] - * - * Calculating NaN portably is difficult. Some compilers will emit - * warnings about divide by zero, and others will simply fail to - * generate a NaN. - */ -static double -TrioGenerateNaN(void) -{ -#if defined(TRIO_COMPILER_SUPPORTS_C99) - return nan(NULL); -#elif defined(DBL_QNAN) - return DBL_QNAN; -#elif defined(PLATFORM_UNIX) - double value; - void (*signal_handler)(int); - - signal_handler = signal(SIGFPE, SIG_IGN); - value = 0.0 / 0.0; - signal(SIGFPE, signal_handler); - return value; -#else - return 0.0 / 0.0; -#endif -} - -/************************************************************************* - * TrioIsNan [private] - */ -static int -TrioIsNan(double number) -{ -#ifdef isnan - /* C99 defines isnan() as a macro */ - return isnan(number); -#else - double integral, fraction; - - return (/* NaN is the only number which does not compare to itself */ - (number != number) || - /* Fallback solution if NaN compares to NaN */ - ((number != 0.0) && - (fraction = modf(number, &integral), - integral == fraction))); -#endif -} - -/************************************************************************* - * TrioIsInfinite [private] - */ -static int -TrioIsInfinite(double number) -{ -#ifdef isinf - /* C99 defines isinf() as a macro */ - return isinf(number); -#else - return ((number == HUGE_VAL) ? 1 : ((number == -HUGE_VAL) ? -1 : 0)); -#endif -} - -/************************************************************************* - * TrioSetLocale [private] - */ -#if defined(USE_LOCALE) -static void -TrioSetLocale(void) -{ - internalLocaleValues = (struct lconv *)localeconv(); - if (internalLocaleValues) - { - if ((internalLocaleValues->decimal_point) && - (internalLocaleValues->decimal_point[0] != NIL)) - { - StrCopyMax(internalDecimalPoint, - sizeof(internalDecimalPoint), - internalLocaleValues->decimal_point); - } - if ((internalLocaleValues->thousands_sep) && - (internalLocaleValues->thousands_sep[0] != NIL)) - { - StrCopyMax(internalThousandSeparator, - sizeof(internalThousandSeparator), - internalLocaleValues->thousands_sep); - } - if ((internalLocaleValues->grouping) && - (internalLocaleValues->grouping[0] != NIL)) - { - StrCopyMax(internalGrouping, - sizeof(internalGrouping), - internalLocaleValues->grouping); - } - } -} -#endif /* defined(USE_LOCALE) */ - -/************************************************************************* - * TrioGetPosition [private] - * - * Get the %n$ position. - */ -static int -TrioGetPosition(const char *format, - int *indexPointer) -{ - char *tmpformat; - int number = 0; - int index = *indexPointer; - - number = (int)StrToLong(&format[index], &tmpformat, BASE_DECIMAL); - index = (int)(tmpformat - format); - if ((number != 0) && (QUALIFIER_POSITION == format[index++])) - { - *indexPointer = index; - /* - * number is decreased by 1, because n$ starts from 1, whereas - * the array it is indexing starts from 0. - */ - return number - 1; - } - return NO_POSITION; -} - -/************************************************************************* - * TrioFindNamespace [private] - * - * Find registered user-defined specifier. - * The prev argument is used for optimisation only. - */ -static userdef_T * -TrioFindNamespace(const char *name, userdef_T **prev) -{ - userdef_T *def; - - if (internalEnterCriticalRegion) - (void)internalEnterCriticalRegion(NULL); - - for (def = internalUserDef; def; def = def->next) - { - /* Case-sensitive string comparison */ - if (StrEqualCase(def->name, name)) - break; - - if (prev) - *prev = def; - } - - if (internalLeaveCriticalRegion) - (void)internalLeaveCriticalRegion(NULL); - - return def; -} - -/************************************************************************* - * TrioPreprocess [private] - * - * Description: - * Parse the format string - */ -static int -TrioPreprocess(int type, - const char *format, - parameter_T *parameters, - va_list arglist, - void **argarray) -{ -#if TRIO_ERRORS - /* Count the number of times a parameter is referenced */ - unsigned short usedEntries[MAX_PARAMETERS]; -#endif - /* Parameter counters */ - int parameterPosition; - int currentParam; - int maxParam = -1; - /* Utility variables */ - unsigned long flags; - int width; - int precision; - int varsize; -#ifdef QUALIFIER_ESCAPE - enum dg_escape escape; -#endif - int base; - int index; /* Index into formatting string */ - int dots; /* Count number of dots in modifier part */ - BOOLEAN_T positional; /* Does the specifier have a positional? */ - BOOLEAN_T got_sticky = FALSE; /* Are there any sticky modifiers at all? */ - /* - * indices specifies the order in which the parameters must be - * read from the va_args (this is necessary to handle positionals) - */ - int indices[MAX_PARAMETERS]; - int pos = 0; - /* Various variables */ - char ch; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int charlen; -#endif - int i = -1; - int num; - char *tmpformat; - - -#if TRIO_ERRORS - /* - * The 'parameters' array is not initialized, but we need to - * know which entries we have used. - */ - memset(usedEntries, 0, sizeof(usedEntries)); -#endif - - index = 0; - parameterPosition = 0; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - while (format[index]) - { -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - if (! isascii(format[index])) - { - /* - * Multibyte characters cannot be legal specifiers or - * modifiers, so we skip over them. - */ - charlen = mblen(&format[index], MB_LEN_MAX); - index += (charlen > 0) ? charlen : 1; - continue; /* while */ - } -#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - if (CHAR_IDENTIFIER == format[index++]) - { - if (CHAR_IDENTIFIER == format[index]) - { - index++; - continue; /* while */ - } - - flags = FLAGS_NEW; - dots = 0; - currentParam = TrioGetPosition(format, &index); - positional = (NO_POSITION != currentParam); - if (!positional) - { - /* We have no positional, get the next counter */ - currentParam = parameterPosition; - } - if(currentParam >= MAX_PARAMETERS) - { - /* Bail out completely to make the error more obvious */ - return TRIO_ERROR_RETURN(TRIO_ETOOMANY, index); - } - - if (currentParam > maxParam) - maxParam = currentParam; - - /* Default values */ - width = NO_WIDTH; - precision = NO_PRECISION; - base = NO_BASE; - varsize = NO_SIZE; -#ifdef QUALIFIER_ESCAPE - escape = ESCAPE_NONE; -#endif - - while (TrioIsQualifier(format[index])) - { - ch = format[index++]; - - switch (ch) - { - case QUALIFIER_SPACE: - flags |= FLAGS_SPACE; - break; - - case QUALIFIER_PLUS: - flags |= FLAGS_SHOWSIGN; - break; - - case QUALIFIER_MINUS: - flags |= FLAGS_LEFTADJUST; - flags &= ~FLAGS_NILPADDING; - break; - - case QUALIFIER_ALTERNATIVE: - flags |= FLAGS_ALTERNATIVE; - break; - - case QUALIFIER_DOT: - if (dots == 0) /* Precision */ - { - dots++; - - /* Skip if no precision */ - if (QUALIFIER_DOT == format[index]) - break; - - /* After the first dot we have the precision */ - flags |= FLAGS_PRECISION; - if ((QUALIFIER_STAR == format[index]) || - (QUALIFIER_PARAM == format[index])) - { - index++; - flags |= FLAGS_PRECISION_PARAMETER; - - precision = TrioGetPosition(format, &index); - if (precision == NO_POSITION) - { - parameterPosition++; - if (positional) - precision = parameterPosition; - else - { - precision = currentParam; - currentParam = precision + 1; - } - } - else - { - if (! positional) - currentParam = precision + 1; - if (width > maxParam) - maxParam = precision; - } - if (currentParam > maxParam) - maxParam = currentParam; - } - else - { - precision = StrToLong(&format[index], &tmpformat, BASE_DECIMAL); - index = (int)(tmpformat - format); - } - } - else if (dots == 1) /* Base */ - { - dots++; - - /* After the second dot we have the base */ - flags |= FLAGS_BASE; - if ((QUALIFIER_STAR == format[index]) || - (QUALIFIER_PARAM == format[index])) - { - index++; - flags |= FLAGS_BASE_PARAMETER; - base = TrioGetPosition(format, &index); - if (base == NO_POSITION) - { - parameterPosition++; - if (positional) - base = parameterPosition; - else - { - base = currentParam; - currentParam = base + 1; - } - } - else - { - if (! positional) - currentParam = base + 1; - if (base > maxParam) - maxParam = base; - } - if (currentParam > maxParam) - maxParam = currentParam; - } - else - { - base = StrToLong(&format[index], &tmpformat, BASE_DECIMAL); - if (base > MAX_BASE) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - index = (int)(tmpformat - format); - } - } - else - { - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - break; /* QUALIFIER_DOT */ - - case QUALIFIER_PARAM: - type = TYPE_PRINT; - /* FALLTHROUGH */ - case QUALIFIER_STAR: - /* This has different meanings for print and scan */ - if (TYPE_PRINT == type) - { - /* Read with from parameter */ - flags |= (FLAGS_WIDTH | FLAGS_WIDTH_PARAMETER); - width = TrioGetPosition(format, &index); - if (width == NO_POSITION) - { - parameterPosition++; - if (positional) - width = parameterPosition; - else - { - width = currentParam; - currentParam = width + 1; - } - } - else - { - if (! positional) - currentParam = width + 1; - if (width > maxParam) - maxParam = width; - } - if (currentParam > maxParam) - maxParam = currentParam; - } - else - { - /* Scan, but do not store result */ - flags |= FLAGS_IGNORE; - } - - break; /* QUALIFIER_STAR */ - - case '0': - if (! (flags & FLAGS_LEFTADJUST)) - flags |= FLAGS_NILPADDING; - /* FALLTHROUGH */ - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - flags |= FLAGS_WIDTH; - /* &format[index - 1] is used to "rewind" the read - * character from format - */ - width = StrToLong(&format[index - 1], &tmpformat, BASE_DECIMAL); - index = (int)(tmpformat - format); - break; - - case QUALIFIER_SHORT: - if (flags & FLAGS_SHORTSHORT) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - else if (flags & FLAGS_SHORT) - flags |= FLAGS_SHORTSHORT; - else - flags |= FLAGS_SHORT; - break; - - case QUALIFIER_LONG: - if (flags & FLAGS_QUAD) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - else if (flags & FLAGS_LONG) - flags |= FLAGS_QUAD; - else - flags |= FLAGS_LONG; - break; - - case QUALIFIER_LONG_UPPER: - flags |= FLAGS_LONGDOUBLE; - break; - -#if defined(QUALIFIER_SIZE_T) - case QUALIFIER_SIZE_T: - flags |= FLAGS_SIZE_T; - /* Modify flags for later truncation of number */ - if (sizeof(size_t) == sizeof(trio_ulonglong_t)) - flags |= FLAGS_QUAD; - else if (sizeof(size_t) == sizeof(long)) - flags |= FLAGS_LONG; - break; -#endif - -#if defined(QUALIFIER_PTRDIFF_T) - case QUALIFIER_PTRDIFF_T: - flags |= FLAGS_PTRDIFF_T; - if (sizeof(ptrdiff_t) == sizeof(trio_ulonglong_t)) - flags |= FLAGS_QUAD; - else if (sizeof(ptrdiff_t) == sizeof(long)) - flags |= FLAGS_LONG; - break; -#endif - -#if defined(QUALIFIER_INTMAX_T) - case QUALIFIER_INTMAX_T: - flags |= FLAGS_INTMAX_T; - if (sizeof(trio_intmax_t) == sizeof(trio_ulonglong_t)) - flags |= FLAGS_QUAD; - else if (sizeof(trio_intmax_t) == sizeof(long)) - flags |= FLAGS_LONG; - break; -#endif - -#if defined(QUALIFIER_QUAD) - case QUALIFIER_QUAD: - flags |= FLAGS_QUAD; - break; -#endif - -#if defined(QUALIFIER_FIXED_SIZE) - case QUALIFIER_FIXED_SIZE: - if (flags & FLAGS_FIXED_SIZE) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - if (flags & (FLAGS_ALL_SIZES | FLAGS_LONGDOUBLE | - FLAGS_WIDECHAR | FLAGS_VARSIZE_PARAMETER)) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - if ((format[index] == '6') && - (format[index + 1] == '4')) - { - varsize = sizeof(trio_int64_t); - index += 2; - } - else if ((format[index] == '3') && - (format[index + 1] == '2')) - { - varsize = sizeof(trio_int32_t); - index += 2; - } - else if ((format[index] == '1') && - (format[index + 1] == '6')) - { - varsize = sizeof(trio_int16_t); - index += 2; - } - else if (format[index] == '8') - { - varsize = sizeof(trio_int8_t); - index++; - } - else - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - flags |= FLAGS_FIXED_SIZE; - break; -#endif - -#ifdef QUALIFIER_ESCAPE - case QUALIFIER_ESCAPE: - switch (format[index++]) { - case 'U': escape = ESCAPE_ULM; break; - case 'X': escape = ESCAPE_XML; break; - case 'S': escape = ESCAPE_SQL; break; - default: return TRIO_ERROR_RETURN(TRIO_EINVAL,index); - } - break; -#endif - - -#if defined(QUALIFIER_WIDECHAR) - case QUALIFIER_WIDECHAR: - flags |= FLAGS_WIDECHAR; - break; -#endif - -#if defined(QUALIFIER_SIZE_T_UPPER) - case QUALIFIER_SIZE_T_UPPER: - break; -#endif - -#if defined(QUALIFIER_QUOTE) - case QUALIFIER_QUOTE: - flags |= FLAGS_QUOTE; - break; -#endif - -#if defined(QUALIFIER_STICKY) - case QUALIFIER_STICKY: - flags |= FLAGS_STICKY; - got_sticky = TRUE; - break; -#endif - -#if defined(QUALIFIER_VARSIZE) - case QUALIFIER_VARSIZE: - flags |= FLAGS_VARSIZE_PARAMETER; - parameterPosition++; - if (positional) - varsize = parameterPosition; - else - { - varsize = currentParam; - currentParam = varsize + 1; - } - if (currentParam > maxParam) - maxParam = currentParam; - break; -#endif - - default: - /* Bail out completely to make the error more obvious */ - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - } /* while qualifier */ - - /* - * Parameters only need the type and value. The value is - * read later. - */ - if (flags & FLAGS_WIDTH_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[width] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[width] = pos; - width = pos++; - } - if (flags & FLAGS_PRECISION_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[precision] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[precision] = pos; - precision = pos++; - } - if (flags & FLAGS_BASE_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[base] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[base] = pos; - base = pos++; - } - if (flags & FLAGS_VARSIZE_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[varsize] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[varsize] = pos; - varsize = pos++; - } - - indices[currentParam] = pos; - - switch (format[index++]) - { -#if defined(SPECIFIER_CHAR_UPPER) - case SPECIFIER_CHAR_UPPER: - flags |= FLAGS_WIDECHAR; - /* FALLTHROUGH */ -#endif - case SPECIFIER_CHAR: - if (flags & FLAGS_LONG) - flags |= FLAGS_WIDECHAR; - else if (flags & FLAGS_SHORT) - flags &= ~FLAGS_WIDECHAR; - parameters[pos].type = FORMAT_CHAR; - break; - -#if defined(SPECIFIER_STRING_UPPER) - case SPECIFIER_STRING_UPPER: - flags |= FLAGS_WIDECHAR; - /* FALLTHROUGH */ -#endif - case SPECIFIER_STRING: - if (flags & FLAGS_LONG) - flags |= FLAGS_WIDECHAR; - else if (flags & FLAGS_SHORT) - flags &= ~FLAGS_WIDECHAR; - parameters[pos].type = FORMAT_STRING; - break; - - - case SPECIFIER_GROUP: - if (TYPE_SCAN == type) - { - int depth = 1; - parameters[pos].type = FORMAT_GROUP; - if (format[index] == QUALIFIER_CIRCUMFLEX) - index++; - if (format[index] == SPECIFIER_UNGROUP) - index++; - if (format[index] == QUALIFIER_MINUS) - index++; - /* Skip nested brackets */ - while (format[index] != NIL) - { - if (format[index] == SPECIFIER_GROUP) - { - depth++; - } - else if (format[index] == SPECIFIER_UNGROUP) - { - if (--depth <= 0) - { - index++; - break; - } - } - index++; - } - } - break; - - case SPECIFIER_INTEGER: - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_UNSIGNED: - flags |= FLAGS_UNSIGNED; - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_DECIMAL: - /* Disable base modifier */ - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_DECIMAL; - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_OCTAL: - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_OCTAL; - parameters[pos].type = FORMAT_INT; - break; - -#if defined(SPECIFIER_BINARY) - case SPECIFIER_BINARY_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_BINARY: - flags |= FLAGS_NILPADDING; - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_BINARY; - parameters[pos].type = FORMAT_INT; - break; -#endif - - case SPECIFIER_HEX_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_HEX: - flags |= FLAGS_UNSIGNED; - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_HEX; - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_FLOAT_E_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_FLOAT_E: - flags |= FLAGS_FLOAT_E; - parameters[pos].type = FORMAT_DOUBLE; - break; - - case SPECIFIER_FLOAT_G_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_FLOAT_G: - flags |= FLAGS_FLOAT_G; - parameters[pos].type = FORMAT_DOUBLE; - break; - - case SPECIFIER_FLOAT_F_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_FLOAT_F: - parameters[pos].type = FORMAT_DOUBLE; - break; - - case SPECIFIER_POINTER: - parameters[pos].type = FORMAT_POINTER; - break; - - case SPECIFIER_COUNT: - parameters[pos].type = FORMAT_COUNT; - break; - -#if defined(SPECIFIER_HEXFLOAT) -# if defined(SPECIFIER_HEXFLOAT_UPPER) - case SPECIFIER_HEXFLOAT_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ -# endif - case SPECIFIER_HEXFLOAT: - base = BASE_HEX; - parameters[pos].type = FORMAT_DOUBLE; - break; -#endif - -#if defined(FORMAT_ERRNO) - case SPECIFIER_ERRNO: - parameters[pos].type = FORMAT_ERRNO; - break; -#endif - -#if defined(SPECIFIER_USER_DEFINED_BEGIN) - case SPECIFIER_USER_DEFINED_BEGIN: - { - unsigned int max; - int without_namespace = TRUE; - - parameters[pos].type = FORMAT_USER_DEFINED; - parameters[pos].user_name[0] = NIL; - tmpformat = (char *)&format[index]; - - while ((ch = format[index])) - { - index++; - if (ch == SPECIFIER_USER_DEFINED_END) - { - if (without_namespace) - { - /* We must get the handle first */ - parameters[pos].type = FORMAT_PARAMETER; - parameters[pos].indexAfterSpecifier = index; - parameters[pos].flags = FLAGS_USER_DEFINED; - /* Adjust parameters for insertion of new one */ - pos++; -# if TRIO_ERRORS - usedEntries[currentParam] += 1; -# endif - parameters[pos].type = FORMAT_USER_DEFINED; - currentParam++; - indices[currentParam] = pos; - if (currentParam > maxParam) - maxParam = currentParam; - } - /* Copy the user data */ - max = (unsigned int)(&format[index] - tmpformat); - if (max > MAX_USER_DATA) - max = MAX_USER_DATA; - StrCopyMax(parameters[pos].user_data, - max, - tmpformat); - break; /* while */ - } - if (ch == SPECIFIER_USER_DEFINED_SEPARATOR) - { - without_namespace = FALSE; - /* Copy the namespace for later looking-up */ - max = (int)(&format[index] - tmpformat); - if (max > MAX_USER_NAME) - max = MAX_USER_NAME; - StrCopyMax(parameters[pos].user_name, - max, - tmpformat); - tmpformat = (char *)&format[index]; - } - } - if (ch != SPECIFIER_USER_DEFINED_END) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - break; -#endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */ - - default: - /* Bail out completely to make the error more obvious */ - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - -#if TRIO_ERRORS - /* Count the number of times this entry has been used */ - usedEntries[currentParam] += 1; -#endif - - /* Find last sticky parameters */ - if (got_sticky && !(flags & FLAGS_STICKY)) - { - for (i = pos - 1; i >= 0; i--) - { - if (parameters[i].type == FORMAT_PARAMETER) - continue; - if ((parameters[i].flags & FLAGS_STICKY) && - (parameters[i].type == parameters[pos].type)) - { - /* Do not overwrite current qualifiers */ - flags |= (parameters[i].flags & (unsigned long)~FLAGS_STICKY); - if (width == NO_WIDTH) - width = parameters[i].width; - if (precision == NO_PRECISION) - precision = parameters[i].precision; - if (base == NO_BASE) - base = parameters[i].base; - break; - } - } - } - - parameters[pos].indexAfterSpecifier = index; - parameters[pos].flags = flags; - parameters[pos].width = width; - parameters[pos].precision = precision; - parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base; - parameters[pos].varsize = varsize; -#ifdef QUALIFIER_ESCAPE - parameters[pos].escape = escape; -#endif - pos++; - - if (! positional) - parameterPosition++; - - } /* if identifier */ - - } /* while format characters left */ - - for (num = 0; num <= maxParam; num++) - { -#if TRIO_ERRORS - if (usedEntries[num] != 1) - { - if (usedEntries[num] == 0) /* gap detected */ - return TRIO_ERROR_RETURN(TRIO_EGAP, num); - else /* double references detected */ - return TRIO_ERROR_RETURN(TRIO_EDBLREF, num); - } -#endif - - i = indices[num]; - - /* - * FORMAT_PARAMETERS are only present if they must be read, - * so it makes no sense to check the ignore flag (besides, - * the flags variable is not set for that particular type) - */ - if ((parameters[i].type != FORMAT_PARAMETER) && - (parameters[i].flags & FLAGS_IGNORE)) - continue; /* for all arguments */ - - /* - * The stack arguments are read according to ANSI C89 - * default argument promotions: - * - * char = int - * short = int - * unsigned char = unsigned int - * unsigned short = unsigned int - * float = double - * - * In addition to the ANSI C89 these types are read (the - * default argument promotions of C99 has not been - * considered yet) - * - * long long - * long double - * size_t - * ptrdiff_t - * intmax_t - */ - switch (parameters[i].type) - { - case FORMAT_GROUP: - case FORMAT_STRING: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - parameters[i].data.wstring = (argarray == NULL) - ? va_arg(arglist, wchar_t *) - : (wchar_t *)(argarray[num]); - } - else -#endif - { - parameters[i].data.string = (argarray == NULL) - ? va_arg(arglist, char *) - : (char *)(argarray[num]); - } - break; - - case FORMAT_POINTER: - case FORMAT_COUNT: - case FORMAT_USER_DEFINED: - case FORMAT_UNKNOWN: - parameters[i].data.pointer = (argarray == NULL) - ? va_arg(arglist, void *) - : argarray[num]; - break; - - case FORMAT_CHAR: - case FORMAT_INT: - if (TYPE_SCAN == type) - { - if (argarray == NULL) - parameters[i].data.pointer = - (trio_uintmax_t *)va_arg(arglist, void *); - else - { - if (parameters[i].type == FORMAT_CHAR) - parameters[i].data.pointer = - (trio_uintmax_t *)((char *)argarray[num]); - else if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.pointer = - (trio_uintmax_t *)((short *)argarray[num]); - else - parameters[i].data.pointer = - (trio_uintmax_t *)((int *)argarray[num]); - } - } - else - { -#if defined(QUALIFIER_VARSIZE) || defined(QUALIFIER_FIXED_SIZE) - if ((parameters[i].flags & FLAGS_VARSIZE_PARAMETER) || - (parameters[i].flags & FLAGS_FIXED_SIZE)) - { - if (parameters[i].flags & FLAGS_VARSIZE_PARAMETER) - { - /* - * Variable sizes are mapped onto the fixed sizes, in - * accordance with integer promotion. - * - * Please note that this may not be portable, as we - * only guess the size, not the layout of the numbers. - * For example, if int is little-endian, and long is - * big-endian, then this will fail. - */ - varsize = (int)parameters[parameters[i].varsize].data.number.as_unsigned; - } - else - { - /* Used for the I modifiers */ - varsize = parameters[i].varsize; - } - parameters[i].flags &= ~FLAGS_ALL_VARSIZES; - - if (varsize <= (int)sizeof(int)) - ; - else if (varsize <= (int)sizeof(long)) - parameters[i].flags |= FLAGS_LONG; -#if defined(QUALIFIER_INTMAX_T) - else if (varsize <= (int)sizeof(trio_longlong_t)) - parameters[i].flags |= FLAGS_QUAD; - else - parameters[i].flags |= FLAGS_INTMAX_T; -#else - else - parameters[i].flags |= FLAGS_QUAD; -#endif - } -#endif /* defined(QUALIFIER_VARSIZE) */ -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (parameters[i].flags & FLAGS_SIZE_T) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, size_t) - : (trio_uintmax_t)(*((size_t *)argarray[num])); - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (parameters[i].flags & FLAGS_PTRDIFF_T) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, ptrdiff_t) - : (trio_uintmax_t)(*((ptrdiff_t *)argarray[num])); - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (parameters[i].flags & FLAGS_INTMAX_T) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, trio_intmax_t) - : (trio_uintmax_t)(*((trio_intmax_t *)argarray[num])); - else -#endif - if (parameters[i].flags & FLAGS_QUAD) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, trio_ulonglong_t) - : (trio_uintmax_t)(*((trio_ulonglong_t *)argarray[num])); - else if (parameters[i].flags & FLAGS_LONG) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, long) - : (trio_uintmax_t)(*((long *)argarray[num])); - else - { - if (argarray == NULL) - parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(arglist, int); - else - { - if (parameters[i].type == FORMAT_CHAR) - parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((char *)argarray[num])); - else if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((short *)argarray[num])); - else - parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((int *)argarray[num])); - } - } - } - break; - - case FORMAT_PARAMETER: - /* - * The parameter for the user-defined specifier is a pointer, - * whereas the rest (width, precision, base) uses an integer. - */ - if (parameters[i].flags & FLAGS_USER_DEFINED) - parameters[i].data.pointer = (argarray == NULL) - ? va_arg(arglist, void *) - : argarray[num]; - else - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, int) - : (trio_uintmax_t)(*((int *)argarray[num])); - break; - - case FORMAT_DOUBLE: - if (TYPE_SCAN == type) - { - if (parameters[i].flags & FLAGS_LONG) - parameters[i].data.longdoublePointer = (argarray == NULL) - ? va_arg(arglist, long double *) - : (long double *)((long double *)argarray[num]); - else - { - if (argarray == NULL) - parameters[i].data.doublePointer = - va_arg(arglist, double *); - else - { - if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.doublePointer = - (double *)((float *)argarray[num]); - else - parameters[i].data.doublePointer = - (double *)((double *)argarray[num]); - } - } - } - else - { - if (parameters[i].flags & FLAGS_LONG) - parameters[i].data.longdoubleNumber = (argarray == NULL) - ? va_arg(arglist, long double) - : (long double)(*((long double *)argarray[num])); - else - { - if (argarray == NULL) - parameters[i].data.longdoubleNumber = (long double)va_arg(arglist, double); - else - { - if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.longdoubleNumber = (long double)(*((float *)argarray[num])); - else - parameters[i].data.longdoubleNumber = (long double)(long double)(*((double *)argarray[num])); - } - } - } - break; - -#if defined(FORMAT_ERRNO) - case FORMAT_ERRNO: - parameters[i].data.errorNumber = errno; - break; -#endif - - default: - break; - } - } /* for all specifiers */ - return num; -} - - -/************************************************************************* - * - * @FORMATTING - * - ************************************************************************/ - - -/************************************************************************* - * TrioWriteNumber [private] - * - * Description: - * Output a number. - * The complexity of this function is a result of the complexity - * of the dependencies of the flags. - */ -static void -TrioWriteNumber(trio_T *self, - trio_uintmax_t number, - unsigned long flags, - int width, - int precision, - int base) -{ - BOOLEAN_T isNegative; - char buffer[MAX_CHARS_IN(trio_uintmax_t) * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1]; - char *bufferend; - char *pointer; - const char *digits; - int i; - int length; - char *p; - int charsPerThousand; - int groupingIndex; - int count; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE)); - - digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower; - - isNegative = (flags & FLAGS_UNSIGNED) - ? FALSE - : ((trio_intmax_t)number < 0); - if (isNegative) - number = -number; - - if (flags & FLAGS_QUAD) - number &= (trio_ulonglong_t)-1; - else if (flags & FLAGS_LONG) - number &= (unsigned long)-1; - else - number &= (unsigned int)-1; - - /* Build number */ - pointer = bufferend = &buffer[sizeof(buffer) - 1]; - *pointer-- = NIL; - charsPerThousand = (int)internalGrouping[0]; - groupingIndex = 1; - for (i = 1; i < (int)sizeof(buffer); i++) - { - *pointer-- = digits[number % base]; - number /= base; - if (number == 0) - break; - - if ((flags & FLAGS_QUOTE) - && (charsPerThousand != NO_GROUPING) - && (i % charsPerThousand == 0)) - { - /* - * We are building the number from the least significant - * to the most significant digit, so we have to copy the - * thousand separator backwards - */ - length = StrLength(internalThousandSeparator); - if (((int)(pointer - buffer) - length) > 0) - { - p = &internalThousandSeparator[length - 1]; - while (length-- > 0) - *pointer-- = *p--; - } - - /* Advance to next grouping number */ - switch (internalGrouping[groupingIndex]) - { - case CHAR_MAX: /* Disable grouping */ - charsPerThousand = NO_GROUPING; - break; - case 0: /* Repeat last group */ - break; - default: - charsPerThousand = (int)internalGrouping[groupingIndex++]; - break; - } - } - } - - /* Adjust width */ - width -= (bufferend - pointer) - 1; - - /* Adjust precision */ - if (NO_PRECISION != precision) - { - precision -= (bufferend - pointer) - 1; - if (precision < 0) - precision = 0; - flags |= FLAGS_NILPADDING; - } - - /* Adjust width further */ - if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE)) - width--; - if (flags & FLAGS_ALTERNATIVE) - { - switch (base) - { - case BASE_BINARY: - case BASE_HEX: - width -= 2; - break; - case BASE_OCTAL: - width--; - break; - default: - break; - } - } - - /* Output prefixes spaces if needed */ - if (! ((flags & FLAGS_LEFTADJUST) || - ((flags & FLAGS_NILPADDING) && (precision == NO_PRECISION)))) - { - count = (precision == NO_PRECISION) ? 0 : precision; - while (width-- > count) - self->OutStream(self, CHAR_ADJUST); - } - - /* width has been adjusted for signs and alternatives */ - if (isNegative) - self->OutStream(self, '-'); - else if (flags & FLAGS_SHOWSIGN) - self->OutStream(self, '+'); - else if (flags & FLAGS_SPACE) - self->OutStream(self, ' '); - - if (flags & FLAGS_ALTERNATIVE) - { - switch (base) - { - case BASE_BINARY: - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'B' : 'b'); - break; - - case BASE_OCTAL: - self->OutStream(self, '0'); - break; - - case BASE_HEX: - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); - break; - - default: - break; - } /* switch base */ - } - - /* Output prefixed zero padding if needed */ - if (flags & FLAGS_NILPADDING) - { - if (precision == NO_PRECISION) - precision = width; - while (precision-- > 0) - { - self->OutStream(self, '0'); - width--; - } - } - - /* Output the number itself */ - while (*(++pointer)) - { - self->OutStream(self, *pointer); - } - - /* Output trailing spaces if needed */ - if (flags & FLAGS_LEFTADJUST) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } -} - -/************************************************************************* - * TrioWriteStringCharacter [private] - * - * Description: - * Output a single character of a string - */ -static void -TrioWriteStringCharacter(trio_T *self, - int ch, - unsigned long flags) -{ - if (flags & FLAGS_ALTERNATIVE) - { - if (! (isprint(ch) || isspace(ch))) - { - /* - * Non-printable characters are converted to C escapes or - * \number, if no C escape exists. - */ - self->OutStream(self, CHAR_BACKSLASH); - switch (ch) - { - case '\007': self->OutStream(self, 'a'); break; - case '\b': self->OutStream(self, 'b'); break; - case '\f': self->OutStream(self, 'f'); break; - case '\n': self->OutStream(self, 'n'); break; - case '\r': self->OutStream(self, 'r'); break; - case '\t': self->OutStream(self, 't'); break; - case '\v': self->OutStream(self, 'v'); break; - case '\\': self->OutStream(self, '\\'); break; - default: - self->OutStream(self, 'x'); - TrioWriteNumber(self, (trio_intmax_t)ch, - FLAGS_UNSIGNED | FLAGS_NILPADDING, - 2, 2, BASE_HEX); - break; - } - } - else if (ch == CHAR_BACKSLASH) - { - self->OutStream(self, CHAR_BACKSLASH); - self->OutStream(self, CHAR_BACKSLASH); - } - else - { - self->OutStream(self, ch); - } - } - else - { - self->OutStream(self, ch); - } -} - -/************************************************************************* - * TrioWriteString [private] - * - * Description: - * Output a string - */ -static void -TrioWriteString(trio_T *self, - const char *string, - unsigned long flags, - int width, - int precision) -{ - int length; - int ch; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - - if (string == NULL) - { - string = null; - length = sizeof(null) - 1; - /* Disable quoting for the null pointer */ - flags &= (~FLAGS_QUOTE); - width = 0; - } - else - { - length = StrLength(string); - } - if ((NO_PRECISION != precision) && - (precision < length)) - { - length = precision; - } - width -= length; - - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); - - if (! (flags & FLAGS_LEFTADJUST)) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - - while (length-- > 0) - { - /* The ctype parameters must be an unsigned char (or EOF) */ - ch = (int)((unsigned char)(*string++)); - TrioWriteStringCharacter(self, ch, flags); - } - - if (flags & FLAGS_LEFTADJUST) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); -} - -/************************************************************************* - * TrioWriteWideStringCharacter [private] - * - * Description: - * Output a wide string as a multi-byte sequence - */ -#if TRIO_WIDECHAR -static int -TrioWriteWideStringCharacter(trio_T *self, - wchar_t wch, - unsigned long flags, - int width) -{ - int size; - int i; - int ch; - char *string; - char buffer[MB_LEN_MAX + 1]; - - if (width == NO_WIDTH) - width = sizeof(buffer); - - size = wctomb(buffer, wch); - if ((size <= 0) || (size > width) || (buffer[0] == NIL)) - return 0; - - string = buffer; - i = size; - while ((width >= i) && (width-- > 0) && (i-- > 0)) - { - /* The ctype parameters must be an unsigned char (or EOF) */ - ch = (int)((unsigned char)(*string++)); - TrioWriteStringCharacter(self, ch, flags); - } - return size; -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioWriteString [private] - * - * Description: - * Output a wide character string as a multi-byte string - */ -#if TRIO_WIDECHAR -static void -TrioWriteWideString(trio_T *self, - const wchar_t *wstring, - unsigned long flags, - int width, - int precision) -{ - int length; - int size; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - if (wstring == NULL) - { - TrioWriteString(self, NULL, flags, width, precision); - return; - } - - if (NO_PRECISION == precision) - { - length = INT_MAX; - } - else - { - length = precision; - width -= length; - } - - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); - - if (! (flags & FLAGS_LEFTADJUST)) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - - while (length > 0) - { - size = TrioWriteWideStringCharacter(self, *wstring++, flags, length); - if (size == 0) - break; /* while */ - length -= size; - } - - if (flags & FLAGS_LEFTADJUST) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioWriteDouble [private] - */ -static void -TrioWriteDouble(trio_T *self, - long double longdoubleNumber, - unsigned long flags, - int width, - int precision, - int base) -{ - int charsPerThousand; - int length; - double number; - double workNumber; - int integerDigits; - int fractionDigits; - int exponentDigits; - int expectedWidth; - int exponent; - unsigned int uExponent = 0; - double dblBase; - BOOLEAN_T isNegative; - BOOLEAN_T isExponentNegative = FALSE; - BOOLEAN_T isHex; - const char *digits; - char numberBuffer[MAX_MANTISSA_DIGITS - * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1]; - char *numberPointer; - char exponentBuffer[MAX_EXPONENT_DIGITS + 1]; - char *exponentPointer = NULL; - int groupingIndex; - char *work; - int i; - BOOLEAN_T onlyzero; - int zeroes = 0; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - assert(base == BASE_DECIMAL || base == BASE_HEX); - - number = (double)longdoubleNumber; - - /* Look for infinite numbers and non-a-number first */ - switch (TrioIsInfinite(number)) - { - case 1: - /* Positive infinity */ - TrioWriteString(self, - (flags & FLAGS_UPPER) - ? INFINITE_UPPER - : INFINITE_LOWER, - flags, width, precision); - return; - - case -1: - /* Negative infinity */ - TrioWriteString(self, - (flags & FLAGS_UPPER) - ? "-" INFINITE_UPPER - : "-" INFINITE_LOWER, - flags, width, precision); - return; - - default: - /* Finitude */ - break; - } - if (TrioIsNan(number)) - { - TrioWriteString(self, - (flags & FLAGS_UPPER) - ? NAN_UPPER - : NAN_LOWER, - flags, width, precision); - return; - } - - /* Normal numbers */ - digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower; - isHex = (base == BASE_HEX); - dblBase = (double)base; - - if (precision == NO_PRECISION) - precision = FLT_DIG; - - isNegative = (number < 0.0); - if (isNegative) - number = -number; - - if ((flags & FLAGS_FLOAT_G) || isHex) - { - if (precision == 0) - precision = 1; - - if ((number < 1.0e-4) || (number > pow(10.0, (double)precision))) - { - /* Use scientific notation */ - flags |= FLAGS_FLOAT_E; - } - else if (number < 1.0) - { - /* - * Use normal notation. If the integer part of the number is - * zero, then adjust the precision to include leading fractional - * zeros. - */ - workNumber = fabs(guarded_log10(number)); - if (workNumber - floor(workNumber) < 0.001) - workNumber--; - zeroes = (int)floor(workNumber); - } - } - - if (flags & FLAGS_FLOAT_E) - { - /* Scale the number */ - workNumber = guarded_log10(number); - if (workNumber == -HUGE_VAL) - { - exponent = 0; - /* Undo setting */ - if (flags & FLAGS_FLOAT_G) - flags &= ~FLAGS_FLOAT_E; - } - else - { - exponent = (int)floor(workNumber); - number /= pow(10.0, (double)exponent); - isExponentNegative = (exponent < 0); - uExponent = (isExponentNegative) ? -exponent : exponent; - /* No thousand separators */ - flags &= ~FLAGS_QUOTE; - } - } - - /* - * Truncated number. - * - * precision is number of significant digits for FLOAT_G - * and number of fractional digits for others - */ - integerDigits = (floor(number) > DBL_EPSILON) - ? 1 + (int)guarded_log10(floor(number)) - : 1; - fractionDigits = ((flags & FLAGS_FLOAT_G) && (zeroes == 0)) - ? precision - integerDigits - : zeroes + precision; - - number = floor(0.5 + number * pow(dblBase, (double)fractionDigits)); - workNumber = (isHex - ? guarded_log16(0.5 + number) - : guarded_log10(0.5 + number)); - if ((int)workNumber + 1 > integerDigits + fractionDigits) - { - if (flags & FLAGS_FLOAT_E) - { - /* Adjust if number was rounded up one digit (ie. 0.99 to 1.00) */ - exponent--; - uExponent -= (isExponentNegative) ? 1 : -1; - number /= dblBase; - } - else - { - /* Adjust if number was rounded up one digit (ie. 99 to 100) */ - integerDigits++; - } - } - - /* Build the fraction part */ - numberPointer = &numberBuffer[sizeof(numberBuffer) - 1]; - *numberPointer = NIL; - onlyzero = TRUE; - for (i = 0; i < fractionDigits; i++) - { - *(--numberPointer) = digits[(int)fmod(number, dblBase)]; - number = floor(number / dblBase); - - if ((flags & FLAGS_FLOAT_G) && !(flags & FLAGS_ALTERNATIVE)) - { - /* Prune trailing zeroes */ - if (numberPointer[0] != digits[0]) - onlyzero = FALSE; - else if (onlyzero && (numberPointer[0] == digits[0])) - numberPointer++; - } - else - onlyzero = FALSE; - } - - /* Insert decimal point */ - if ((flags & FLAGS_ALTERNATIVE) || ((fractionDigits > 0) && !onlyzero)) - { - i = StrLength(internalDecimalPoint); - while (i> 0) - { - *(--numberPointer) = internalDecimalPoint[--i]; - } - } - /* Insert the integer part and thousand separators */ - charsPerThousand = (int)internalGrouping[0]; - groupingIndex = 1; - for (i = 1; i < integerDigits + 1; i++) - { - *(--numberPointer) = digits[(int)fmod(number, dblBase)]; - number = floor(number / dblBase); - if (number < DBL_EPSILON) - break; - - if ((i > 0) - && ((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE) - && (charsPerThousand != NO_GROUPING) - && (i % charsPerThousand == 0)) - { - /* - * We are building the number from the least significant - * to the most significant digit, so we have to copy the - * thousand separator backwards - */ - length = StrLength(internalThousandSeparator); - integerDigits += length; - if (((int)(numberPointer - numberBuffer) - length) > 0) - { - work = &internalThousandSeparator[length - 1]; - while (length-- > 0) - *(--numberPointer) = *work--; - } - - /* Advance to next grouping number */ - if (charsPerThousand != NO_GROUPING) - { - switch (internalGrouping[groupingIndex]) - { - case CHAR_MAX: /* Disable grouping */ - charsPerThousand = NO_GROUPING; - break; - case 0: /* Repeat last group */ - break; - default: - charsPerThousand = (int)internalGrouping[groupingIndex++]; - break; - } - } - } - } - - /* Build the exponent */ - exponentDigits = 0; - if (flags & FLAGS_FLOAT_E) - { - exponentPointer = &exponentBuffer[sizeof(exponentBuffer) - 1]; - *exponentPointer-- = NIL; - do { - *exponentPointer-- = digits[uExponent % base]; - uExponent /= base; - exponentDigits++; - } while (uExponent); - } - - /* - * Calculate expected width. - * sign + integer part + thousands separators + decimal point - * + fraction + exponent - */ - expectedWidth = StrLength(numberPointer); - if (isNegative || (flags & FLAGS_SHOWSIGN)) - expectedWidth += sizeof("-") - 1; - if (exponentDigits > 0) - expectedWidth += exponentDigits + - ((exponentDigits > 1) ? sizeof("E+") : sizeof("E+0")) - 1; - if (isHex) - expectedWidth += sizeof("0X") - 1; - - /* Output prefixing */ - if (flags & FLAGS_NILPADDING) - { - /* Leading zeros must be after sign */ - if (isNegative) - self->OutStream(self, '-'); - else if (flags & FLAGS_SHOWSIGN) - self->OutStream(self, '+'); - if (isHex) - { - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); - } - if (!(flags & FLAGS_LEFTADJUST)) - { - for (i = expectedWidth; i < width; i++) - { - self->OutStream(self, '0'); - } - } - } - else - { - /* Leading spaces must be before sign */ - if (!(flags & FLAGS_LEFTADJUST)) - { - for (i = expectedWidth; i < width; i++) - { - self->OutStream(self, CHAR_ADJUST); - } - } - if (isNegative) - self->OutStream(self, '-'); - else if (flags & FLAGS_SHOWSIGN) - self->OutStream(self, '+'); - if (isHex) - { - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); - } - } - /* Output number */ - for (i = 0; numberPointer[i]; i++) - { - self->OutStream(self, numberPointer[i]); - } - /* Output exponent */ - if (exponentDigits > 0) - { - self->OutStream(self, - isHex - ? ((flags & FLAGS_UPPER) ? 'P' : 'p') - : ((flags & FLAGS_UPPER) ? 'E' : 'e')); - self->OutStream(self, (isExponentNegative) ? '-' : '+'); - - /* The exponent must contain at least two digits */ - if (exponentDigits == 1) - self->OutStream(self, '0'); - - for (i = 0; i < exponentDigits; i++) - { - self->OutStream(self, exponentPointer[i + 1]); - } - } - /* Output trailing spaces */ - if (flags & FLAGS_LEFTADJUST) - { - for (i = expectedWidth; i < width; i++) - { - self->OutStream(self, CHAR_ADJUST); - } - } -} - -/************************************************************************* - * TrioFormatProcess [private] - */ -static int -TrioFormatProcess(trio_T *data, - const char *format, - parameter_T *parameters) - -{ -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int charlen; -#endif - int i; - const char *string; - void *pointer; - unsigned long flags; - int width; - int precision; - int base; - int index; - - index = 0; - i = 0; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - while (format[index]) - { -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - if (! isascii(format[index])) - { - charlen = mblen(&format[index], MB_LEN_MAX); - while (charlen-- > 0) - { - data->OutStream(data, format[index++]); - } - continue; /* while */ - } -#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - if (CHAR_IDENTIFIER == format[index]) - { - if (CHAR_IDENTIFIER == format[index + 1]) - { - data->OutStream(data, CHAR_IDENTIFIER); - index += 2; - } - else - { - /* Skip the parameter entries */ - while (parameters[i].type == FORMAT_PARAMETER) - i++; - - flags = parameters[i].flags; - - /* Find width */ - width = parameters[i].width; - if (flags & FLAGS_WIDTH_PARAMETER) - { - /* Get width from parameter list */ - width = (int)parameters[width].data.number.as_signed; - } - - /* Find precision */ - if (flags & FLAGS_PRECISION) - { - precision = parameters[i].precision; - if (flags & FLAGS_PRECISION_PARAMETER) - { - /* Get precision from parameter list */ - precision = (int)parameters[precision].data.number.as_signed; - } - } - else - { - precision = NO_PRECISION; - } - - /* Find base */ - base = parameters[i].base; - if (flags & FLAGS_BASE_PARAMETER) - { - /* Get base from parameter list */ - base = (int)parameters[base].data.number.as_signed; - } - - switch (parameters[i].type) - { - case FORMAT_CHAR: - if (flags & FLAGS_QUOTE) - data->OutStream(data, CHAR_QUOTE); - if (! (flags & FLAGS_LEFTADJUST)) - { - while (--width > 0) - data->OutStream(data, CHAR_ADJUST); - } -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - TrioWriteWideStringCharacter(data, - (wchar_t)parameters[i].data.number.as_signed, - flags, - NO_WIDTH); - } - else -#endif - TrioWriteStringCharacter(data, - (int)parameters[i].data.number.as_signed, - flags); - - if (flags & FLAGS_LEFTADJUST) - { - while(--width > 0) - data->OutStream(data, CHAR_ADJUST); - } - if (flags & FLAGS_QUOTE) - data->OutStream(data, CHAR_QUOTE); - - break; /* FORMAT_CHAR */ - - case FORMAT_INT: - if (base == NO_BASE) - base = BASE_DECIMAL; - - TrioWriteNumber(data, - parameters[i].data.number.as_signed, - flags, - width, - precision, - base); - - break; /* FORMAT_INT */ - - case FORMAT_DOUBLE: - TrioWriteDouble(data, - parameters[i].data.longdoubleNumber, - flags, - width, - precision, - base); - break; /* FORMAT_DOUBLE */ - - case FORMAT_STRING: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - TrioWriteWideString(data, - parameters[i].data.wstring, - flags, - width, - precision); - } - else -#endif -#ifdef QUALIFIER_ESCAPE - { - char *s = NULL; - static const char* empty = "(null)"; - switch (parameters[i].escape) - { - case ESCAPE_ULM: - s = glite_lbu_EscapeULM(parameters[i].data.string); - break; - case ESCAPE_XML: - s = glite_lbu_EscapeXML(parameters[i].data.string); - break; - case ESCAPE_SQL: - s = glite_lbu_EscapeSQL(parameters[i].data.string); - break; - case ESCAPE_NONE: - s = strdup(parameters[i].data.string ? parameters[i].data.string : empty); - break; - } - TrioWriteString(data,s,flags,width,precision); - free(s); - } -#else - { - TrioWriteString(data, - parameters[i].data.string, - flags, - width, - precision); - } -#endif - break; /* FORMAT_STRING */ - - case FORMAT_POINTER: - { - reference_T reference; - - reference.data = data; - reference.parameter = ¶meters[i]; - trio_print_pointer(&reference, parameters[i].data.pointer); - } - break; /* FORMAT_POINTER */ - - case FORMAT_COUNT: - pointer = parameters[i].data.pointer; - if (NULL != pointer) - { - /* - * C99 paragraph 7.19.6.1.8 says "the number of - * characters written to the output stream so far by - * this call", which is data->committed - */ -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (flags & FLAGS_SIZE_T) - *(size_t *)pointer = (size_t)data->committed; - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (flags & FLAGS_PTRDIFF_T) - *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed; - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (flags & FLAGS_INTMAX_T) - *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed; - else -#endif - if (flags & FLAGS_QUAD) - { - *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed; - } - else if (flags & FLAGS_LONG) - { - *(long int *)pointer = (long int)data->committed; - } - else if (flags & FLAGS_SHORT) - { - *(short int *)pointer = (short int)data->committed; - } - else - { - *(int *)pointer = (int)data->committed; - } - } - break; /* FORMAT_COUNT */ - - case FORMAT_PARAMETER: - break; /* FORMAT_PARAMETER */ - -#if defined(FORMAT_ERRNO) - case FORMAT_ERRNO: - string = StrError(parameters[i].data.errorNumber); - if (string) - { - TrioWriteString(data, - string, - flags, - width, - precision); - } - else - { - data->OutStream(data, '#'); - TrioWriteNumber(data, - (trio_intmax_t)parameters[i].data.errorNumber, - flags, - width, - precision, - BASE_DECIMAL); - } - break; /* FORMAT_ERRNO */ -#endif /* defined(FORMAT_ERRNO) */ - -#if defined(FORMAT_USER_DEFINED) - case FORMAT_USER_DEFINED: - { - reference_T reference; - userdef_T *def = NULL; - - if (parameters[i].user_name[0] == NIL) - { - /* Use handle */ - if ((i > 0) || - (parameters[i - 1].type == FORMAT_PARAMETER)) - def = (userdef_T *)parameters[i - 1].data.pointer; - } - else - { - /* Look up namespace */ - def = TrioFindNamespace(parameters[i].user_name, NULL); - } - if (def) { - reference.data = data; - reference.parameter = ¶meters[i]; - def->callback(&reference); - } - } - break; -#endif /* defined(FORMAT_USER_DEFINED) */ - - default: - break; - } /* switch parameter type */ - - /* Prepare for next */ - index = parameters[i].indexAfterSpecifier; - i++; - } - } - else /* not identifier */ - { - data->OutStream(data, format[index++]); - } - } - return data->processed; -} - -/************************************************************************* - * TrioFormatRef [private] - */ -static int -TrioFormatRef(reference_T *reference, - const char *format, - va_list arglist, - void **argarray) -{ - int status; - parameter_T parameters[MAX_PARAMETERS]; - - status = TrioPreprocess(TYPE_PRINT, format, parameters, arglist, argarray); - if (status < 0) - return status; - - return TrioFormatProcess(reference->data, format, parameters); -} - -/************************************************************************* - * TrioFormat [private] - * - * Description: - * This is the main engine for formatting output - */ -static int -TrioFormat(void *destination, - size_t destinationSize, - void (*OutStream)(trio_T *, int), - const char *format, - va_list arglist, - void **argarray) -{ - int status; - trio_T data; - parameter_T parameters[MAX_PARAMETERS]; - - assert(VALID(OutStream)); - assert(VALID(format)); - - memset(&data, 0, sizeof(data)); - data.OutStream = OutStream; - data.location = destination; - data.max = destinationSize; - -#if defined(USE_LOCALE) - if (NULL == internalLocaleValues) - { - TrioSetLocale(); - } -#endif - - status = TrioPreprocess(TYPE_PRINT, format, parameters, arglist, argarray); - if (status < 0) - return status; - - return TrioFormatProcess(&data, format, parameters); -} - -/************************************************************************* - * TrioOutStreamFile [private] - */ -static void -TrioOutStreamFile(trio_T *self, - int output) -{ - FILE *file = (FILE *)self->location; - - assert(VALID(self)); - assert(VALID(file)); - - self->processed++; - self->committed++; - (void)fputc(output, file); -} - -/************************************************************************* - * TrioOutStreamFileDescriptor [private] - */ -static void -TrioOutStreamFileDescriptor(trio_T *self, - int output) -{ - int fd = *((int *)self->location); - char ch; - - assert(VALID(self)); - - ch = (char)output; - (void)write(fd, &ch, sizeof(char)); - self->processed++; - self->committed++; -} - -/************************************************************************* - * TrioOutStreamString [private] - */ -static void -TrioOutStreamString(trio_T *self, - int output) -{ - char **buffer = (char **)self->location; - - assert(VALID(self)); - assert(VALID(buffer)); - - **buffer = (char)output; - (*buffer)++; - self->processed++; - self->committed++; -} - -/************************************************************************* - * TrioOutStreamStringMax [private] - */ -static void -TrioOutStreamStringMax(trio_T *self, - int output) -{ - char **buffer; - - assert(VALID(self)); - buffer = (char **)self->location; - assert(VALID(buffer)); - - if (self->processed < self->max) - { - **buffer = (char)output; - (*buffer)++; - self->committed++; - } - self->processed++; -} - -/************************************************************************* - * TrioOutStreamStringDynamic [private] - */ -#define DYNAMIC_START_SIZE 32 -struct dynamicBuffer { - char *buffer; - size_t length; - size_t allocated; -}; - -static void -TrioOutStreamStringDynamic(trio_T *self, - int output) -{ - struct dynamicBuffer *infop; - - assert(VALID(self)); - assert(VALID(self->location)); - - infop = (struct dynamicBuffer *)self->location; - - if (infop->buffer == NULL) - { - /* Start with a reasonable size */ - infop->buffer = (char *)TRIO_MALLOC(DYNAMIC_START_SIZE); - if (infop->buffer == NULL) - return; /* fail */ - - infop->allocated = DYNAMIC_START_SIZE; - self->processed = 0; - self->committed = 0; - } - else if (self->committed + sizeof(NIL) >= infop->allocated) - { - char *newptr; - - /* Allocate increasing chunks */ - newptr = (char *)TRIO_REALLOC(infop->buffer, infop->allocated * 2); - - if (newptr == NULL) - return; - - infop->buffer = newptr; - infop->allocated *= 2; - } - - infop->buffer[self->committed] = (char)output; - self->committed++; - self->processed++; - - infop->length = self->committed; -} - -/************************************************************************* - * printf - */ -int -trio_printf(const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(stdout, 0, TrioOutStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vprintf(const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioFormat(stdout, 0, TrioOutStreamFile, format, args, NULL); -} - -#ifdef __GNUC__ -#define UNUSED_VAR __attribute__((unused)) -#else -#define UNUSED_VAR -#endif - -static void shutup_unitialized(va_list *dummy UNUSED_VAR) { -} - -int -trio_printfv(const char *format, - void ** args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioFormat(stdout, 0, TrioOutStreamFile, format, dummy, args); -} - -/************************************************************************* - * fprintf - */ -int -trio_fprintf(FILE *file, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(file)); - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(file, 0, TrioOutStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vfprintf(FILE *file, - const char *format, - va_list args) -{ - assert(VALID(file)); - assert(VALID(format)); - - return TrioFormat(file, 0, TrioOutStreamFile, format, args, NULL); -} - -int -trio_fprintfv(FILE *file, - const char *format, - void ** args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(file)); - assert(VALID(format)); - - return TrioFormat(file, 0, TrioOutStreamFile, format, dummy, args); -} - -/************************************************************************* - * dprintf - */ -int -trio_dprintf(int fd, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vdprintf(int fd, - const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, args, NULL); -} - -int -trio_dprintfv(int fd, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, dummy, args); -} - -/************************************************************************* - * sprintf - */ -int -trio_sprintf(char *buffer, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(buffer)); - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(&buffer, 0, TrioOutStreamString, format, args, NULL); - *buffer = NIL; /* Terminate with NIL character */ - va_end(args); - return status; -} - -int -trio_vsprintf(char *buffer, - const char *format, - va_list args) -{ - int status; - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, 0, TrioOutStreamString, format, args, NULL); - *buffer = NIL; - return status; -} - -int -trio_sprintfv(char *buffer, - const char *format, - void **args) -{ - int status; - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, 0, TrioOutStreamString, format, dummy, args); - *buffer = NIL; - return status; -} - -/************************************************************************* - * snprintf - */ -int -trio_snprintf(char *buffer, - size_t bufferSize, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(buffer)); - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0, - TrioOutStreamStringMax, format, args, NULL); - if (bufferSize > 0) - *buffer = NIL; - va_end(args); - return status; -} - -int -trio_vsnprintf(char *buffer, - size_t bufferSize, - const char *format, - va_list args) -{ - int status; - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0, - TrioOutStreamStringMax, format, args, NULL); - if (bufferSize > 0) - *buffer = NIL; - return status; -} - -int -trio_snprintfv(char *buffer, - size_t bufferSize, - const char *format, - void **args) -{ - int status; - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0, - TrioOutStreamStringMax, format, dummy, args); - if (bufferSize > 0) - *buffer = NIL; - return status; -} - -/************************************************************************* - * snprintfcat - * Appends the new string to the buffer string overwriting the '\0' - * character at the end of buffer. - */ -int -trio_snprintfcat(char *buffer, - size_t bufferSize, - const char *format, - ...) -{ - int status; - va_list args; - size_t buf_len; - - va_start(args, format); - - assert(VALID(buffer)); - assert(VALID(format)); - - buf_len = strlen(buffer); - buffer = &buffer[buf_len]; - - status = TrioFormat(&buffer, bufferSize - 1 - buf_len, - TrioOutStreamStringMax, format, args, NULL); - va_end(args); - *buffer = NIL; - return status; -} - -int -trio_vsnprintfcat(char *buffer, - size_t bufferSize, - const char *format, - va_list args) -{ - int status; - size_t buf_len; - assert(VALID(buffer)); - assert(VALID(format)); - - buf_len = strlen(buffer); - buffer = &buffer[buf_len]; - status = TrioFormat(&buffer, bufferSize - 1 - buf_len, - TrioOutStreamStringMax, format, args, NULL); - *buffer = NIL; - return status; -} - -/************************************************************************* - * trio_aprintf - */ - -/* Deprecated */ -char * -trio_aprintf(const char *format, - ...) -{ - va_list args; - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - va_start(args, format); - (void)TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - va_end(args); - if (info.length) { - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - return info.buffer; - } - else - return NULL; -} - -/* Deprecated */ -char * -trio_vaprintf(const char *format, - va_list args) -{ - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - (void)TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - if (info.length) { - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - return info.buffer; - } - else - return NULL; -} - -int -trio_asprintf(char **result, - const char *format, - ...) -{ - va_list args; - int status; - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - va_start(args, format); - status = TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - va_end(args); - if (status < 0) { - *result = NULL; - return status; - } - if (info.length == 0) { - /* - * If the length is zero, no characters have been written and therefore - * no memory has been allocated, but we must to allocate and return an - * empty string. - */ - info.buffer = (char *)TRIO_MALLOC(sizeof(char)); - if (info.buffer == NULL) { - *result = NULL; - return TRIO_ERROR_RETURN(TRIO_ENOMEM, 0); - } - } - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - *result = info.buffer; - - return status; -} - -int -trio_vasprintf(char **result, - const char *format, - va_list args) -{ - int status; - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - status = TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - if (status < 0) { - *result = NULL; - return status; - } - if (info.length == 0) { - info.buffer = (char *)TRIO_MALLOC(sizeof(char)); - if (info.buffer == NULL) { - *result = NULL; - return TRIO_ERROR_RETURN(TRIO_ENOMEM, 0); - } - } - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - *result = info.buffer; - - return status; -} - - -/************************************************************************* - * - * @CALLBACK - * - ************************************************************************/ - - -/************************************************************************* - * trio_register [public] - */ -void * -trio_register(trio_callback_t callback, - const char *name) -{ - userdef_T *def; - userdef_T *prev = NULL; - - if (callback == NULL) - return NULL; - - if (name) - { - /* Handle built-in namespaces */ - if (name[0] == ':') - { - if (StrEqual(name, ":enter")) - { - internalEnterCriticalRegion = callback; - } - else if (StrEqual(name, ":leave")) - { - internalLeaveCriticalRegion = callback; - } - return NULL; - } - - /* Bail out if namespace is too long */ - if (StrLength(name) >= MAX_USER_NAME) - return NULL; - - /* Bail out if namespace already is registered */ - def = TrioFindNamespace(name, &prev); - if (def) - return NULL; - } - - def = (userdef_T *)TRIO_MALLOC(sizeof(userdef_T)); - if (def) - { - if (internalEnterCriticalRegion) - (void)internalEnterCriticalRegion(NULL); - - if (name) - { - /* Link into internal list */ - if (prev == NULL) - internalUserDef = def; - else - prev->next = def; - } - /* Initialize */ - def->callback = callback; - def->name = (name == NULL) - ? NULL - : StrDuplicate(name); - def->next = NULL; - - if (internalLeaveCriticalRegion) - (void)internalLeaveCriticalRegion(NULL); - } - return def; -} - -/************************************************************************* - * trio_unregister [public] - */ -void -trio_unregister(void *handle) -{ - userdef_T *self = (userdef_T *)handle; - userdef_T *def; - userdef_T *prev = NULL; - - assert(VALID(self)); - - if (self->name) - { - def = TrioFindNamespace(self->name, &prev); - if (def) - { - if (internalEnterCriticalRegion) - (void)internalEnterCriticalRegion(NULL); - - if (prev == NULL) - internalUserDef = NULL; - else - prev->next = def->next; - - if (internalLeaveCriticalRegion) - (void)internalLeaveCriticalRegion(NULL); - } - StrFree(self->name); - } - TRIO_FREE(self); -} - -/************************************************************************* - * trio_get_format [public] - */ -const char * -trio_get_format(void *ref) -{ - assert(((reference_T *)ref)->parameter->type == FORMAT_USER_DEFINED); - - return (((reference_T *)ref)->parameter->user_data); -} - -/************************************************************************* - * trio_get_argument [public] - */ -void * -trio_get_argument(void *ref) -{ - assert(((reference_T *)ref)->parameter->type == FORMAT_USER_DEFINED); - - return ((reference_T *)ref)->parameter->data.pointer; -} - -/************************************************************************* - * trio_get_width / trio_set_width [public] - */ -int -trio_get_width(void *ref) -{ - return ((reference_T *)ref)->parameter->width; -} - -void -trio_set_width(void *ref, - int width) -{ - ((reference_T *)ref)->parameter->width = width; -} - -/************************************************************************* - * trio_get_precision / trio_set_precision [public] - */ -int -trio_get_precision(void *ref) -{ - return (((reference_T *)ref)->parameter->precision); -} - -void -trio_set_precision(void *ref, - int precision) -{ - ((reference_T *)ref)->parameter->precision = precision; -} - -/************************************************************************* - * trio_get_base / trio_set_base [public] - */ -int -trio_get_base(void *ref) -{ - return (((reference_T *)ref)->parameter->base); -} - -void -trio_set_base(void *ref, - int base) -{ - ((reference_T *)ref)->parameter->base = base; -} - -/************************************************************************* - * trio_get_long / trio_set_long [public] - */ -int -trio_get_long(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_LONG); -} - -void -trio_set_long(void *ref, - int is_long) -{ - if (is_long) - ((reference_T *)ref)->parameter->flags |= FLAGS_LONG; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_LONG; -} - -/************************************************************************* - * trio_get_longlong / trio_set_longlong [public] - */ -int -trio_get_longlong(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_QUAD); -} - -void -trio_set_longlong(void *ref, - int is_longlong) -{ - if (is_longlong) - ((reference_T *)ref)->parameter->flags |= FLAGS_QUAD; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_QUAD; -} - -/************************************************************************* - * trio_get_longdouble / trio_set_longdouble [public] - */ -int -trio_get_longdouble(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_LONGDOUBLE); -} - -void -trio_set_longdouble(void *ref, - int is_longdouble) -{ - if (is_longdouble) - ((reference_T *)ref)->parameter->flags |= FLAGS_LONGDOUBLE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_LONGDOUBLE; -} - -/************************************************************************* - * trio_get_short / trio_set_short [public] - */ -int -trio_get_short(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SHORT); -} - -void -trio_set_short(void *ref, - int is_short) -{ - if (is_short) - ((reference_T *)ref)->parameter->flags |= FLAGS_SHORT; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHORT; -} - -/************************************************************************* - * trio_get_shortshort / trio_set_shortshort [public] - */ -int -trio_get_shortshort(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SHORTSHORT); -} - -void -trio_set_shortshort(void *ref, - int is_shortshort) -{ - if (is_shortshort) - ((reference_T *)ref)->parameter->flags |= FLAGS_SHORTSHORT; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHORTSHORT; -} - -/************************************************************************* - * trio_get_alternative / trio_set_alternative [public] - */ -int -trio_get_alternative(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_ALTERNATIVE); -} - -void -trio_set_alternative(void *ref, - int is_alternative) -{ - if (is_alternative) - ((reference_T *)ref)->parameter->flags |= FLAGS_ALTERNATIVE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_ALTERNATIVE; -} - -/************************************************************************* - * trio_get_alignment / trio_set_alignment [public] - */ -int -trio_get_alignment(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_LEFTADJUST); -} - -void -trio_set_alignment(void *ref, - int is_leftaligned) -{ - if (is_leftaligned) - ((reference_T *)ref)->parameter->flags |= FLAGS_LEFTADJUST; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_LEFTADJUST; -} - -/************************************************************************* - * trio_get_spacing /trio_set_spacing [public] - */ -int -trio_get_spacing(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SPACE); -} - -void -trio_set_spacing(void *ref, - int is_space) -{ - if (is_space) - ((reference_T *)ref)->parameter->flags |= FLAGS_SPACE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SPACE; -} - -/************************************************************************* - * trio_get_sign / trio_set_sign [public] - */ -int -trio_get_sign(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SHOWSIGN); -} - -void -trio_set_sign(void *ref, - int is_sign) -{ - if (is_sign) - ((reference_T *)ref)->parameter->flags |= FLAGS_SHOWSIGN; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHOWSIGN; -} - -/************************************************************************* - * trio_get_padding / trio_set_padding [public] - */ -int -trio_get_padding(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_NILPADDING); -} - -void -trio_set_padding(void *ref, - int is_padding) -{ - if (is_padding) - ((reference_T *)ref)->parameter->flags |= FLAGS_NILPADDING; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_NILPADDING; -} - -/************************************************************************* - * trio_get_quote / trio_set_quote [public] - */ -int -trio_get_quote(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_QUOTE); -} - -void -trio_set_quote(void *ref, - int is_quote) -{ - if (is_quote) - ((reference_T *)ref)->parameter->flags |= FLAGS_QUOTE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_QUOTE; -} - -/************************************************************************* - * trio_get_upper / trio_set_upper [public] - */ -int -trio_get_upper(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_UPPER); -} - -void -trio_set_upper(void *ref, - int is_upper) -{ - if (is_upper) - ((reference_T *)ref)->parameter->flags |= FLAGS_UPPER; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_UPPER; -} - -/************************************************************************* - * trio_get_largest / trio_set_largest [public] - */ -#if TRIO_C99 -int -trio_get_largest(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_INTMAX_T); -} - -void -trio_set_largest(void *ref, - int is_largest) -{ - if (is_largest) - ((reference_T *)ref)->parameter->flags |= FLAGS_INTMAX_T; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_INTMAX_T; -} -#endif - -/************************************************************************* - * trio_get_ptrdiff / trio_set_ptrdiff [public] - */ -int -trio_get_ptrdiff(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_PTRDIFF_T); -} - -void -trio_set_ptrdiff(void *ref, - int is_ptrdiff) -{ - if (is_ptrdiff) - ((reference_T *)ref)->parameter->flags |= FLAGS_PTRDIFF_T; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_PTRDIFF_T; -} - -/************************************************************************* - * trio_get_size / trio_set_size [public] - */ -#if TRIO_C99 -int -trio_get_size(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SIZE_T); -} - -void -trio_set_size(void *ref, - int is_size) -{ - if (is_size) - ((reference_T *)ref)->parameter->flags |= FLAGS_SIZE_T; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SIZE_T; -} -#endif - -/************************************************************************* - * trio_print_int [public] - */ -void -trio_print_int(void *ref, - int number) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteNumber(self->data, - (trio_intmax_t)number, - self->parameter->flags, - self->parameter->width, - self->parameter->precision, - self->parameter->base); -} - -/************************************************************************* - * trio_print_uint [public] - */ -void -trio_print_uint(void *ref, - unsigned int number) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteNumber(self->data, - (trio_intmax_t)number, - self->parameter->flags | FLAGS_UNSIGNED, - self->parameter->width, - self->parameter->precision, - self->parameter->base); -} - -/************************************************************************* - * trio_print_double [public] - */ -void -trio_print_double(void *ref, - double number) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteDouble(self->data, - number, - self->parameter->flags, - self->parameter->width, - self->parameter->precision, - self->parameter->base); -} - -/************************************************************************* - * trio_print_string [public] - */ -void -trio_print_string(void *ref, - char *string) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteString(self->data, - string, - self->parameter->flags, - self->parameter->width, - self->parameter->precision); -} - -/************************************************************************* - * trio_print_pointer [public] - */ -void -trio_print_pointer(void *ref, - void *pointer) -{ - reference_T *self = (reference_T *)ref; - unsigned long flags; - trio_uintmax_t number; - - if (NULL == pointer) - { - const char *string = null; - while (*string) - self->data->OutStream(self->data, *string++); - } - else - { - /* - * The subtraction of the null pointer is a workaround - * to avoid a compiler warning. The performance overhead - * is negligible (and likely to be removed by an - * optimising compiler). The (char *) casting is done - * to please ANSI C++. - */ - number = (trio_uintmax_t)((char *)pointer - (char *)0); - /* Shrink to size of pointer */ - number &= (trio_uintmax_t)-1; - flags = self->parameter->flags; - flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | - FLAGS_NILPADDING); - TrioWriteNumber(self->data, - (trio_intmax_t)number, - flags, - POINTER_WIDTH, - NO_PRECISION, - BASE_HEX); - } -} - -/************************************************************************* - * trio_print_ref [public] - */ -int -trio_print_ref(void *ref, - const char *format, - ...) -{ - int status; - va_list arglist; - - assert(VALID(format)); - - va_start(arglist, format); - status = TrioFormatRef((reference_T *)ref, format, arglist, NULL); - va_end(arglist); - return status; -} - -/************************************************************************* - * trio_vprint_ref [public] - */ -int -trio_vprint_ref(void *ref, - const char *format, - va_list arglist) -{ - assert(VALID(format)); - - return TrioFormatRef((reference_T *)ref, format, arglist, NULL); -} - -/************************************************************************* - * trio_printv_ref [public] - */ -int -trio_printv_ref(void *ref, - const char *format, - void **argarray) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioFormatRef((reference_T *)ref, format, dummy, argarray); -} - - -/************************************************************************* - * - * @SCANNING - * - ************************************************************************/ - - -/************************************************************************* - * TrioSkipWhitespaces [private] - */ -static int -TrioSkipWhitespaces(trio_T *self) -{ - int ch; - - ch = self->current; - while (isspace(ch)) - { - self->InStream(self, &ch); - } - return ch; -} - -/************************************************************************* - * TrioGetCollation [private] - */ -#if TRIO_EXTENSION -static void -TrioGetCollation() -{ - int i; - int j; - int k; - char first[2]; - char second[2]; - - /* This is computational expensive */ - first[1] = NIL; - second[1] = NIL; - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - { - k = 0; - first[0] = (char)i; - for (j = 0; j < MAX_CHARACTER_CLASS; j++) - { - second[0] = (char)j; - if (StrEqualLocale(first, second)) - internalCollationArray[i][k++] = (char)j; - } - internalCollationArray[i][k] = NIL; - } -} -#endif - -/************************************************************************* - * TrioGetCharacterClass [private] - * - * FIXME: - * multibyte - */ -static int -TrioGetCharacterClass(const char *format, - int *indexPointer, - unsigned long *flagsPointer, - int *characterclass) -{ - int index = *indexPointer; - int i; - char ch; - char range_begin; - char range_end; - - *flagsPointer &= ~FLAGS_EXCLUDE; - - if (format[index] == QUALIFIER_CIRCUMFLEX) - { - *flagsPointer |= FLAGS_EXCLUDE; - index++; - } - /* - * If the ungroup character is at the beginning of the scanlist, - * it will be part of the class, and a second ungroup character - * must follow to end the group. - */ - if (format[index] == SPECIFIER_UNGROUP) - { - characterclass[(int)SPECIFIER_UNGROUP]++; - index++; - } - /* - * Minus is used to specify ranges. To include minus in the class, - * it must be at the beginning of the list - */ - if (format[index] == QUALIFIER_MINUS) - { - characterclass[(int)QUALIFIER_MINUS]++; - index++; - } - /* Collect characters */ - for (ch = format[index]; - (ch != SPECIFIER_UNGROUP) && (ch != NIL); - ch = format[++index]) - { - switch (ch) - { - case QUALIFIER_MINUS: /* Scanlist ranges */ - - /* - * Both C99 and UNIX98 describes ranges as implementation- - * defined. - * - * We support the following behaviour (although this may - * change as we become wiser) - * - only increasing ranges, ie. [a-b] but not [b-a] - * - transitive ranges, ie. [a-b-c] == [a-c] - * - trailing minus, ie. [a-] is interpreted as an 'a' - * and a '-' - * - duplicates (although we can easily convert these - * into errors) - */ - range_begin = format[index - 1]; - range_end = format[++index]; - if (range_end == SPECIFIER_UNGROUP) - { - /* Trailing minus is included */ - characterclass[(int)ch]++; - ch = range_end; - break; /* for */ - } - if (range_end == NIL) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - if (range_begin > range_end) - return TRIO_ERROR_RETURN(TRIO_ERANGE, index); - - for (i = (int)range_begin; i <= (int)range_end; i++) - characterclass[i]++; - - ch = range_end; - break; - -#if TRIO_EXTENSION - - case SPECIFIER_GROUP: - - switch (format[index + 1]) - { - case QUALIFIER_DOT: /* Collating symbol */ - /* - * FIXME: This will be easier to implement when multibyte - * characters have been implemented. Until now, we ignore - * this feature. - */ - for (i = index + 2; ; i++) - { - if (format[i] == NIL) - /* Error in syntax */ - return -1; - else if (format[i] == QUALIFIER_DOT) - break; /* for */ - } - if (format[++i] != SPECIFIER_UNGROUP) - return -1; - - index = i; - break; - - case QUALIFIER_EQUAL: /* Equivalence class expressions */ - { - unsigned int j; - unsigned int k; - - if (internalCollationUnconverted) - { - /* Lazy evalutation of collation array */ - TrioGetCollation(); - internalCollationUnconverted = FALSE; - } - for (i = index + 2; ; i++) - { - if (format[i] == NIL) - /* Error in syntax */ - return -1; - else if (format[i] == QUALIFIER_EQUAL) - break; /* for */ - else - { - /* Mark any equivalent character */ - k = (unsigned int)format[i]; - for (j = 0; internalCollationArray[k][j] != NIL; j++) - characterclass[(int)internalCollationArray[k][j]]++; - } - } - if (format[++i] != SPECIFIER_UNGROUP) - return -1; - - index = i; - } - break; - - case QUALIFIER_COLON: /* Character class expressions */ - - if (StrEqualMax(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isalnum(i)) - characterclass[i]++; - index += sizeof(CLASS_ALNUM) - 1; - } - else if (StrEqualMax(CLASS_ALPHA, sizeof(CLASS_ALPHA) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isalpha(i)) - characterclass[i]++; - index += sizeof(CLASS_ALPHA) - 1; - } - else if (StrEqualMax(CLASS_CNTRL, sizeof(CLASS_CNTRL) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (iscntrl(i)) - characterclass[i]++; - index += sizeof(CLASS_CNTRL) - 1; - } - else if (StrEqualMax(CLASS_DIGIT, sizeof(CLASS_DIGIT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isdigit(i)) - characterclass[i]++; - index += sizeof(CLASS_DIGIT) - 1; - } - else if (StrEqualMax(CLASS_GRAPH, sizeof(CLASS_GRAPH) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isgraph(i)) - characterclass[i]++; - index += sizeof(CLASS_GRAPH) - 1; - } - else if (StrEqualMax(CLASS_LOWER, sizeof(CLASS_LOWER) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (islower(i)) - characterclass[i]++; - index += sizeof(CLASS_LOWER) - 1; - } - else if (StrEqualMax(CLASS_PRINT, sizeof(CLASS_PRINT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isprint(i)) - characterclass[i]++; - index += sizeof(CLASS_PRINT) - 1; - } - else if (StrEqualMax(CLASS_PUNCT, sizeof(CLASS_PUNCT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (ispunct(i)) - characterclass[i]++; - index += sizeof(CLASS_PUNCT) - 1; - } - else if (StrEqualMax(CLASS_SPACE, sizeof(CLASS_SPACE) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isspace(i)) - characterclass[i]++; - index += sizeof(CLASS_SPACE) - 1; - } - else if (StrEqualMax(CLASS_UPPER, sizeof(CLASS_UPPER) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isupper(i)) - characterclass[i]++; - index += sizeof(CLASS_UPPER) - 1; - } - else if (StrEqualMax(CLASS_XDIGIT, sizeof(CLASS_XDIGIT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isxdigit(i)) - characterclass[i]++; - index += sizeof(CLASS_XDIGIT) - 1; - } - else - { - characterclass[(int)ch]++; - } - break; - - default: - characterclass[(int)ch]++; - break; - } - break; - -#endif /* TRIO_EXTENSION */ - - default: - characterclass[(int)ch]++; - break; - } - } - return 0; -} - -/************************************************************************* - * TrioReadNumber [private] - * - * We implement our own number conversion in preference of strtol and - * strtoul, because we must handle 'long long' and thousand separators. - */ -static BOOLEAN_T -TrioReadNumber(trio_T *self, - trio_uintmax_t *target, - unsigned long flags, - int width, - int base) -{ - trio_uintmax_t number = 0; - int digit; - int count; - BOOLEAN_T isNegative = FALSE; - int j; - - assert(VALID(self)); - assert(VALID(self->InStream)); - assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE)); - - if (internalDigitsUnconverted) - { - /* Lazy evaluation of digits array */ - memset(internalDigitArray, -1, sizeof(internalDigitArray)); - for (j = 0; j < (int)sizeof(internalDigitsLower) - 1; j++) - { - internalDigitArray[(int)internalDigitsLower[j]] = j; - internalDigitArray[(int)internalDigitsUpper[j]] = j; - } - internalDigitsUnconverted = FALSE; - } - - TrioSkipWhitespaces(self); - - if (!(flags & FLAGS_UNSIGNED)) - { - /* Leading sign */ - if (self->current == '+') - { - self->InStream(self, NULL); - } - else if (self->current == '-') - { - self->InStream(self, NULL); - isNegative = TRUE; - } - } - - count = self->processed; - - if (flags & FLAGS_ALTERNATIVE) - { - switch (base) - { - case NO_BASE: - case BASE_OCTAL: - case BASE_HEX: - case BASE_BINARY: - if (self->current == '0') - { - self->InStream(self, NULL); - if (self->current) - { - if ((base == BASE_HEX) && - (toupper(self->current) == 'X')) - { - self->InStream(self, NULL); - } - else if ((base == BASE_BINARY) && - (toupper(self->current) == 'B')) - { - self->InStream(self, NULL); - } - } - } - else - return FALSE; - break; - default: - break; - } - } - - while (((width == NO_WIDTH) || (self->processed - count < width)) && - (! ((self->current == EOF) || isspace(self->current)))) - { - if (isascii(self->current)) - { - digit = internalDigitArray[self->current]; - /* Abort if digit is not allowed in the specified base */ - if ((digit == -1) || (digit >= base)) - break; - } - else if (flags & FLAGS_QUOTE) - { - /* Compare with thousands separator */ - for (j = 0; internalThousandSeparator[j] && self->current; j++) - { - if (internalThousandSeparator[j] != self->current) - break; - - self->InStream(self, NULL); - } - if (internalThousandSeparator[j]) - break; /* Mismatch */ - else - continue; /* Match */ - } - else - break; - - number *= base; - number += digit; - - self->InStream(self, NULL); - } - - /* Was anything read at all? */ - if (self->processed == count) - return FALSE; - - if (target) - *target = (isNegative) ? -number : number; - return TRUE; -} - -/************************************************************************* - * TrioReadChar [private] - */ -static int -TrioReadChar(trio_T *self, - char *target, - unsigned long flags, - int width) -{ - int i; - char ch; - trio_uintmax_t number; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - for (i = 0; - (self->current != EOF) && (i < width); - i++) - { - ch = (char)self->current; - self->InStream(self, NULL); - if ((flags & FLAGS_ALTERNATIVE) && (ch == CHAR_BACKSLASH)) - { - switch (self->current) - { - case '\\': ch = '\\'; break; - case 'a': ch = '\007'; break; - case 'b': ch = '\b'; break; - case 'f': ch = '\f'; break; - case 'n': ch = '\n'; break; - case 'r': ch = '\r'; break; - case 't': ch = '\t'; break; - case 'v': ch = '\v'; break; - default: - if (isdigit(self->current)) - { - /* Read octal number */ - if (!TrioReadNumber(self, &number, 0, 3, BASE_OCTAL)) - return 0; - ch = (char)number; - } - else if (toupper(self->current) == 'X') - { - /* Read hexadecimal number */ - self->InStream(self, NULL); - if (!TrioReadNumber(self, &number, 0, 2, BASE_HEX)) - return 0; - ch = (char)number; - } - else - { - ch = (char)self->current; - } - break; - } - } - - if (target) - target[i] = ch; - } - return i + 1; -} - -/************************************************************************* - * TrioReadString [private] - */ -static BOOLEAN_T -TrioReadString(trio_T *self, - char *target, - unsigned long flags, - int width) -{ - int i; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - TrioSkipWhitespaces(self); - - /* - * Continue until end of string is reached, a whitespace is encountered, - * or width is exceeded - */ - for (i = 0; - ((width == NO_WIDTH) || (i < width)) && - (! ((self->current == EOF) || isspace(self->current))); - i++) - { - if (TrioReadChar(self, &target[i], flags, 1) == 0) - break; /* for */ - } - if (target) - target[i] = NIL; - return TRUE; -} - -/************************************************************************* - * TrioReadWideChar [private] - */ -#if TRIO_WIDECHAR -static int -TrioReadWideChar(trio_T *self, - wchar_t *target, - unsigned long flags, - int width) -{ - int i; - int j; - int size; - int amount = 0; - wchar_t wch; - char buffer[MB_LEN_MAX + 1]; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - for (i = 0; - (self->current != EOF) && (i < width); - i++) - { - if (isascii(self->current)) - { - if (TrioReadChar(self, buffer, flags, 1) == 0) - return 0; - buffer[1] = NIL; - } - else - { - /* - * Collect a multibyte character, by enlarging buffer until - * it contains a fully legal multibyte character, or the - * buffer is full. - */ - j = 0; - do - { - buffer[j++] = (char)self->current; - buffer[j] = NIL; - self->InStream(self, NULL); - } - while ((j < (int)sizeof(buffer)) && (mblen(buffer, (size_t)j) != j)); - } - if (target) - { - size = mbtowc(&wch, buffer, sizeof(buffer)); - if (size > 0) - target[i] = wch; - } - amount += size; - self->InStream(self, NULL); - } - return amount; -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioReadWideString [private] - */ -#if TRIO_WIDECHAR -static BOOLEAN_T -TrioReadWideString(trio_T *self, - wchar_t *target, - unsigned long flags, - int width) -{ - int i; - int size; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - TrioSkipWhitespaces(self); - -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - /* - * Continue until end of string is reached, a whitespace is encountered, - * or width is exceeded - */ - for (i = 0; - ((width == NO_WIDTH) || (i < width)) && - (! ((self->current == EOF) || isspace(self->current))); - ) - { - size = TrioReadWideChar(self, &target[i], flags, 1); - if (size == 0) - break; /* for */ - - i += size; - } - if (target) - target[i] = L'\0'; - return TRUE; -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioReadGroup [private] - * - * FIXME: characterclass does not work with multibyte characters - */ -static BOOLEAN_T -TrioReadGroup(trio_T *self, - char *target, - int *characterclass, - unsigned long flags, - int width) -{ - int ch; - int i; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - ch = self->current; - for (i = 0; - ((width == NO_WIDTH) || (i < width)) && - (! ((ch == EOF) || - (((flags & FLAGS_EXCLUDE) != 0) ^ (characterclass[ch] == 0)))); - i++) - { - if (target) - target[i] = (char)ch; - self->InStream(self, &ch); - } - - if (target) - target[i] = NIL; - return TRUE; -} - -/************************************************************************* - * TrioReadDouble [private] - * - * FIXME: - * add long double - */ -static BOOLEAN_T -TrioReadDouble(trio_T *self, - double *target, - unsigned long flags, - int width) -{ - int ch; - char doubleString[512] = ""; - int index = 0; - int start; - int j; - BOOLEAN_T isHex = FALSE; - - if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1)) - width = sizeof(doubleString) - 1; - - TrioSkipWhitespaces(self); - - /* - * Read entire double number from stream. StrToDouble requires a - * string as input, but InStream can be anything, so we have to - * collect all characters. - */ - ch = self->current; - if ((ch == '+') || (ch == '-')) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - width--; - } - - start = index; - switch (ch) - { - case 'n': - case 'N': - /* Not-a-number */ - if (index != 0) - break; - /* FALLTHROUGH */ - case 'i': - case 'I': - /* Infinity */ - while (isalpha(ch) && (index - start < width)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - doubleString[index] = NIL; - - /* Case insensitive string comparison */ - if (StrEqual(&doubleString[start], INFINITE_UPPER) || - StrEqual(&doubleString[start], LONG_INFINITE_UPPER)) - { - *target = ((start == 1 && doubleString[0] == '-')) - ? -HUGE_VAL - : HUGE_VAL; - return TRUE; - } - if (StrEqual(doubleString, NAN_LOWER)) - { - /* NaN must not have a preceeding + nor - */ - *target = TrioGenerateNaN(); - return TRUE; - } - return FALSE; - - default: - break; - } - - if (ch == '0') - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - if (toupper(ch) == 'X') - { - isHex = TRUE; - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - } - while ((ch != EOF) && (index - start < width)) - { - /* Integer part */ - if (isHex ? isxdigit(ch) : isdigit(ch)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - else if (flags & FLAGS_QUOTE) - { - /* Compare with thousands separator */ - for (j = 0; internalThousandSeparator[j] && self->current; j++) - { - if (internalThousandSeparator[j] != self->current) - break; - - self->InStream(self, &ch); - } - if (internalThousandSeparator[j]) - break; /* Mismatch */ - else - continue; /* Match */ - } - else - break; /* while */ - } - if (ch == '.') - { - /* Decimal part */ - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - while ((isHex ? isxdigit(ch) : isdigit(ch)) && - (index - start < width)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - if (isHex ? (toupper(ch) == 'P') : (toupper(ch) == 'E')) - { - /* Exponent */ - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - if ((ch == '+') || (ch == '-')) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - while ((isHex ? isxdigit(ch) : isdigit(ch)) && - (index - start < width)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - } - } - - if ((index == start) || (*doubleString == NIL)) - return FALSE; - - if (flags & FLAGS_LONGDOUBLE) -/* *longdoublePointer = StrToLongDouble()*/ - return FALSE; /* FIXME: Remove when long double is implemented */ - else - { - *target = StrToDouble(doubleString, NULL); - } - return TRUE; -} - -/************************************************************************* - * TrioReadPointer [private] - */ -static BOOLEAN_T -TrioReadPointer(trio_T *self, - void **target, - unsigned long flags) -{ - trio_uintmax_t number; - char buffer[sizeof(null)]; - - flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING); - - if (TrioReadNumber(self, - &number, - flags, - POINTER_WIDTH, - BASE_HEX)) - { - /* - * The strange assignment of number is a workaround for a compiler - * warning - */ - if (target) - *target = (char *)0 + number; - return TRUE; - } - else if (TrioReadString(self, - (flags & FLAGS_IGNORE) - ? NULL - : buffer, - 0, - sizeof(null) - 1)) - { - if (StrEqualCase(buffer, null)) - { - if (target) - *target = NULL; - return TRUE; - } - } - return FALSE; -} - -/************************************************************************* - * TrioScan [private] - */ -static int -TrioScan(const void *source, - size_t sourceSize, - void (*InStream)(trio_T *, int *), - const char *format, - va_list arglist, - void **argarray) -{ -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int charlen; -#endif - int status; - int assignment; - parameter_T parameters[MAX_PARAMETERS]; - trio_T internalData; - trio_T *data; - int ch; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int cnt; -#endif - int index; /* Index of format string */ - int i; /* Index of current parameter */ - unsigned long flags; - int width; - int base; - void *pointer; - - assert(VALID(InStream)); - assert(VALID(format)); - - memset(&internalData, 0, sizeof(internalData)); - data = &internalData; - data->InStream = InStream; - data->location = (void *)source; - data->max = sourceSize; - -#if defined(USE_LOCALE) - if (NULL == internalLocaleValues) - { - TrioSetLocale(); - } -#endif - - status = TrioPreprocess(TYPE_SCAN, format, parameters, arglist, argarray); - if (status < 0) - return status; - - assignment = 0; - i = 0; - index = 0; - data->InStream(data, &ch); - -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - while (format[index]) - { -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - if (! isascii(format[index])) - { - charlen = mblen(&format[index], MB_LEN_MAX); - /* Compare multibyte characters in format string */ - for (cnt = 0; cnt < charlen - 1; cnt++) - { - if (ch != format[index + cnt]) - { - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - data->InStream(data, &ch); - } - continue; /* while */ - } -#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - if (EOF == ch) - return EOF; - - if (CHAR_IDENTIFIER == format[index]) - { - if (CHAR_IDENTIFIER == format[index + 1]) - { - /* Two % in format matches one % in input stream */ - if (CHAR_IDENTIFIER == ch) - { - data->InStream(data, &ch); - index += 2; - continue; /* while format chars left */ - } - else - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - - /* Skip the parameter entries */ - while (parameters[i].type == FORMAT_PARAMETER) - i++; - - flags = parameters[i].flags; - /* Find width */ - width = parameters[i].width; - if (flags & FLAGS_WIDTH_PARAMETER) - { - /* Get width from parameter list */ - width = (int)parameters[width].data.number.as_signed; - } - /* Find base */ - base = parameters[i].base; - if (flags & FLAGS_BASE_PARAMETER) - { - /* Get base from parameter list */ - base = (int)parameters[base].data.number.as_signed; - } - - switch (parameters[i].type) - { - case FORMAT_INT: - { - trio_uintmax_t number; - - if (0 == base) - base = BASE_DECIMAL; - - if (!TrioReadNumber(data, - &number, - flags, - width, - base)) - return assignment; - assignment++; - - if (!(flags & FLAGS_IGNORE)) - { - pointer = parameters[i].data.pointer; -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (flags & FLAGS_SIZE_T) - *(size_t *)pointer = (size_t)number; - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (flags & FLAGS_PTRDIFF_T) - *(ptrdiff_t *)pointer = (ptrdiff_t)number; - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (flags & FLAGS_INTMAX_T) - *(trio_intmax_t *)pointer = (trio_intmax_t)number; - else -#endif - if (flags & FLAGS_QUAD) - *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)number; - else if (flags & FLAGS_LONG) - *(long int *)pointer = (long int)number; - else if (flags & FLAGS_SHORT) - *(short int *)pointer = (short int)number; - else - *(int *)pointer = (int)number; - } - } - break; /* FORMAT_INT */ - - case FORMAT_STRING: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - if (!TrioReadWideString(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.wstring, - flags, - width)) - return assignment; - } - else -#endif - { - if (!TrioReadString(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.string, - flags, - width)) - return assignment; - } - assignment++; - break; /* FORMAT_STRING */ - - case FORMAT_DOUBLE: - if (!TrioReadDouble(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.doublePointer, - flags, - width)) - return assignment; - assignment++; - break; /* FORMAT_DOUBLE */ - - case FORMAT_GROUP: - { - int characterclass[MAX_CHARACTER_CLASS + 1]; - int rc; - - /* Skip over modifiers */ - while (format[index] != SPECIFIER_GROUP) - { - index++; - } - /* Skip over group specifier */ - index++; - - memset(characterclass, 0, sizeof(characterclass)); - rc = TrioGetCharacterClass(format, - &index, - &flags, - characterclass); - if (rc < 0) - return rc; - - if (!TrioReadGroup(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.string, - characterclass, - flags, - parameters[i].width)) - return assignment; - assignment++; - } - break; /* FORMAT_GROUP */ - - case FORMAT_COUNT: - pointer = parameters[i].data.pointer; - if (NULL != pointer) - { -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (flags & FLAGS_SIZE_T) - *(size_t *)pointer = (size_t)data->committed; - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (flags & FLAGS_PTRDIFF_T) - *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed; - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (flags & FLAGS_INTMAX_T) - *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed; - else -#endif - if (flags & FLAGS_QUAD) - { - *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed; - } - else if (flags & FLAGS_LONG) - { - *(long int *)pointer = (long int)data->committed; - } - else if (flags & FLAGS_SHORT) - { - *(short int *)pointer = (short int)data->committed; - } - else - { - *(int *)pointer = (int)data->committed; - } - } - break; /* FORMAT_COUNT */ - - case FORMAT_CHAR: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - if (TrioReadWideChar(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.wstring, - flags, - (width == NO_WIDTH) ? 1 : width) > 0) - return assignment; - } - else -#endif - { - if (TrioReadChar(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.string, - flags, - (width == NO_WIDTH) ? 1 : width) > 0) - return assignment; - } - assignment++; - break; /* FORMAT_CHAR */ - - case FORMAT_POINTER: - if (!TrioReadPointer(data, - (flags & FLAGS_IGNORE) - ? NULL - : (void **)parameters[i].data.pointer, - flags)) - return assignment; - assignment++; - break; /* FORMAT_POINTER */ - - case FORMAT_PARAMETER: - break; /* FORMAT_PARAMETER */ - - default: - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - ch = data->current; - index = parameters[i].indexAfterSpecifier; - i++; - } - else /* Not an % identifier */ - { - if (isspace((int)format[index])) - { - /* Whitespaces may match any amount of whitespaces */ - ch = TrioSkipWhitespaces(data); - } - else if (ch == format[index]) - { - data->InStream(data, &ch); - } - else - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - index++; - } - } - return assignment; -} - -/************************************************************************* - * TrioInStreamFile [private] - */ -static void -TrioInStreamFile(trio_T *self, - int *intPointer) -{ - FILE *file = (FILE *)self->location; - - assert(VALID(self)); - assert(VALID(file)); - - self->current = fgetc(file); - self->processed++; - self->committed++; - - if (VALID(intPointer)) - { - *intPointer = self->current; - } -} - -/************************************************************************* - * TrioInStreamFileDescriptor [private] - */ -static void -TrioInStreamFileDescriptor(trio_T *self, - int *intPointer) -{ - int fd = *((int *)self->location); - int size; - unsigned char input; - - assert(VALID(self)); - - size = read(fd, &input, sizeof(char)); - self->current = (size == 0) ? EOF : input; - self->processed++; - self->committed++; - - if (VALID(intPointer)) - { - *intPointer = self->current; - } -} - -/************************************************************************* - * TrioInStreamString [private] - */ -static void -TrioInStreamString(trio_T *self, - int *intPointer) -{ - unsigned char **buffer; - - assert(VALID(self)); - assert(VALID(self->InStream)); - assert(VALID(self->location)); - - buffer = (unsigned char **)self->location; - self->current = (*buffer)[0]; - if (self->current == NIL) - self->current = EOF; - (*buffer)++; - self->processed++; - self->committed++; - - if (VALID(intPointer)) - { - *intPointer = self->current; - } -} - -/************************************************************************* - * scanf - */ -int -trio_scanf(const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(stdin, 0, TrioInStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vscanf(const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioScan(stdin, 0, TrioInStreamFile, format, args, NULL); -} - -int -trio_scanfv(const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioScan(stdin, 0, TrioInStreamFile, format, dummy, args); -} - -/************************************************************************* - * fscanf - */ -int -trio_fscanf(FILE *file, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(file)); - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(file, 0, TrioInStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vfscanf(FILE *file, - const char *format, - va_list args) -{ - assert(VALID(file)); - assert(VALID(format)); - - return TrioScan(file, 0, TrioInStreamFile, format, args, NULL); -} - -int -trio_fscanfv(FILE *file, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(file)); - assert(VALID(format)); - - return TrioScan(file, 0, TrioInStreamFile, format, dummy, args); -} - -/************************************************************************* - * dscanf - */ -int -trio_dscanf(int fd, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vdscanf(int fd, - const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, args, NULL); -} - -int -trio_dscanfv(int fd, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, dummy, args); -} - -/************************************************************************* - * sscanf - */ -int -trio_sscanf(const char *buffer, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(buffer)); - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(&buffer, 0, TrioInStreamString, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vsscanf(const char *buffer, - const char *format, - va_list args) -{ - assert(VALID(buffer)); - assert(VALID(format)); - - return TrioScan(&buffer, 0, TrioInStreamString, format, args, NULL); -} - -int -trio_sscanfv(const char *buffer, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(buffer)); - assert(VALID(format)); - - return TrioScan(&buffer, 0, TrioInStreamString, format, dummy, args); -} - diff --git a/org.glite.lb-utils.trio/src/triop.h b/org.glite.lb-utils.trio/src/triop.h deleted file mode 100644 index ca49fab..0000000 --- a/org.glite.lb-utils.trio/src/triop.h +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************ - * - * Private functions, types, etc. used for callback functions. - * - * The ref pointer is an opaque type and should remain as such. - * Private data must only be accessible through the getter and - * setter functions. - * - ************************************************************************/ - -#ifndef TRIO_TRIOP_H -#define TRIO_TRIOP_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef TRIO_C99 -# define TRIO_C99 1 -#endif -#ifndef TRIO_BSD -# define TRIO_BSD 1 -#endif -#ifndef TRIO_GNU -# define TRIO_GNU 1 -#endif -#ifndef TRIO_MISC -# define TRIO_MISC 1 -#endif -#ifndef TRIO_UNIX98 -# define TRIO_UNIX98 1 -#endif -#ifndef TRIO_MICROSOFT -# define TRIO_MICROSOFT 1 -#endif -#ifndef TRIO_EXTENSION -# define TRIO_EXTENSION 1 -#endif -#ifndef TRIO_WIDECHAR -# define TRIO_WIDECHAR 0 -#endif -#ifndef TRIO_ERRORS -# define TRIO_ERRORS 1 -#endif - -#ifndef TRIO_MALLOC -# define TRIO_MALLOC(n) malloc(n) -#endif -#ifndef TRIO_REALLOC -# define TRIO_REALLOC(x,n) realloc((x),(n)) -#endif -#ifndef TRIO_FREE -# define TRIO_FREE(x) free(x) -#endif - -typedef int (*trio_callback_t)(void *ref); - -void *trio_register(trio_callback_t callback, const char *name); -void trio_unregister(void *handle); - -const char *trio_get_format(void *ref); -void *trio_get_argument(void *ref); - -/* Modifiers */ -int trio_get_width(void *ref); -void trio_set_width(void *ref, int width); -int trio_get_precision(void *ref); -void trio_set_precision(void *ref, int precision); -int trio_get_base(void *ref); -void trio_set_base(void *ref, int base); -int trio_get_padding(void *ref); -void trio_set_padding(void *ref, int is_padding); -int trio_get_short(void *ref); /* h */ -void trio_set_shortshort(void *ref, int is_shortshort); -int trio_get_shortshort(void *ref); /* hh */ -void trio_set_short(void *ref, int is_short); -int trio_get_long(void *ref); /* l */ -void trio_set_long(void *ref, int is_long); -int trio_get_longlong(void *ref); /* ll */ -void trio_set_longlong(void *ref, int is_longlong); -int trio_get_longdouble(void *ref); /* L */ -void trio_set_longdouble(void *ref, int is_longdouble); -int trio_get_alternative(void *ref); /* # */ -void trio_set_alternative(void *ref, int is_alternative); -int trio_get_alignment(void *ref); /* - */ -void trio_set_alignment(void *ref, int is_leftaligned); -int trio_get_spacing(void *ref); /* (space) */ -void trio_set_spacing(void *ref, int is_space); -int trio_get_sign(void *ref); /* + */ -void trio_set_sign(void *ref, int is_showsign); -int trio_get_quote(void *ref); /* ' */ -void trio_set_quote(void *ref, int is_quote); -int trio_get_upper(void *ref); -void trio_set_upper(void *ref, int is_upper); -#if TRIO_C99 -int trio_get_largest(void *ref); /* j */ -void trio_set_largest(void *ref, int is_largest); -int trio_get_ptrdiff(void *ref); /* t */ -void trio_set_ptrdiff(void *ref, int is_ptrdiff); -int trio_get_size(void *ref); /* z / Z */ -void trio_set_size(void *ref, int is_size); -#endif - -/* Printing */ -int trio_print_ref(void *ref, const char *format, ...); -int trio_vprint_ref(void *ref, const char *format, va_list args); -int trio_printv_ref(void *ref, const char *format, void **args); - -void trio_print_int(void *ref, int number); -void trio_print_uint(void *ref, unsigned int number); -/* void trio_print_long(void *ref, long number); */ -/* void trio_print_ulong(void *ref, unsigned long number); */ -void trio_print_double(void *ref, double number); -void trio_print_string(void *ref, char *string); -void trio_print_pointer(void *ref, void *pointer); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* TRIO_TRIOP_H */ diff --git a/org.glite.lb-utils.trio/test/trio_test.cpp b/org.glite.lb-utils.trio/test/trio_test.cpp deleted file mode 100644 index 3ba4b9c..0000000 --- a/org.glite.lb-utils.trio/test/trio_test.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include - -#include -#include - -#include "trio.h" - -class TrioTest: public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(TrioTest); - CPPUNIT_TEST(escapeULM); - CPPUNIT_TEST(escapeXML); - CPPUNIT_TEST(escapeSQL); - CPPUNIT_TEST_SUITE_END(); - -public: - void escapeULM(); - void escapeXML(); - void escapeSQL(); -}; - -void TrioTest::escapeULM() -{ - char *e, *r = "START we have =, \\\", and \\n in the string END"; - - trio_asprintf(&e,"START %|Us END", "we have =, \", and \n in the string"), - std::cerr << e << std::endl; - - CPPUNIT_ASSERT_MESSAGE("escape ULM failed",!strcmp(e,r)); -} - -void TrioTest::escapeXML() -{ - char *e, *r = "START there is a <tag> containing &something; </tag> END"; - - trio_asprintf(&e,"START %|Xs END", "there is a containing &something; "), - std::cerr << e << std::endl; - - CPPUNIT_ASSERT_MESSAGE("escape XML failed",!strcmp(e,r)); -} - -void TrioTest::escapeSQL() -{ - char *e, *r = "START SQL doesn''t like '' END"; - - trio_asprintf(&e,"START %|Ss END", "SQL doesn't like '"), - std::cerr << e << std::endl; - - CPPUNIT_ASSERT_MESSAGE("escape SQL failed",!strcmp(e,r)); -} - -CPPUNIT_TEST_SUITE_REGISTRATION( TrioTest ); - -#include -#include - -#include -#include -#include -#include -#include -#include - -int main (int argc,const char *argv[]) -{ - CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); - - assert(argc == 2); - std::ofstream xml(argv[1]); - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - CppUnit::TestRunner runner; - runner.addTest(suite); - runner.run(controller); - - CppUnit::XmlOutputter xout( &result, xml ); - CppUnit::CompilerOutputter tout( &result, std::cout); - xout.write(); - tout.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} diff --git a/org.glite.lb-utils/.cvsignore b/org.glite.lb-utils/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.lb-utils/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.lb-utils/LICENSE b/org.glite.lb-utils/LICENSE deleted file mode 100755 index 259a91f..0000000 --- a/org.glite.lb-utils/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb-utils/build.xml b/org.glite.lb-utils/build.xml deleted file mode 100644 index 85553ce..0000000 --- a/org.glite.lb-utils/build.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - Ant build file to build the lb-utils subsystem. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Preparing directories ... - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - <project name="${subsystem.name}" type="post-subsystem" packageName="${global.prefix}-${subsystem.prefix}"/> - - - - diff --git a/org.glite.lb-utils/project/build.number b/org.glite.lb-utils/project/build.number deleted file mode 100644 index 5cfec85..0000000 --- a/org.glite.lb-utils/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build = 0 diff --git a/org.glite.lb-utils/project/build.properties b/org.glite.lb-utils/project/build.properties deleted file mode 100755 index e69de29..0000000 diff --git a/org.glite.lb-utils/project/dependencies.properties b/org.glite.lb-utils/project/dependencies.properties deleted file mode 100644 index c590a39..0000000 --- a/org.glite.lb-utils/project/dependencies.properties +++ /dev/null @@ -1,13 +0,0 @@ - -################################################################### -# System dependencies -################################################################### - -org.glite.version = HEAD -org.glite.lb-utils.version = HEAD - -# Component dependencies tag = do not remove this line = -org.glite.lb-utils.db.version = HEAD -#org.glite.lb-utils.jobid.version = HEAD -#org.glite.lb-utils.server-bones.version = HEAD -#org.glite.lb-utils.trio.version = HEAD diff --git a/org.glite.lb-utils/project/glite.lb-utils.csf.xml b/org.glite.lb-utils/project/glite.lb-utils.csf.xml deleted file mode 100644 index 98945b8..0000000 --- a/org.glite.lb-utils/project/glite.lb-utils.csf.xml +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - The org.glite and org.glite.lb-utils modules have been updated, please rerun the configuration file - - - - - The org.glite and org.glite.lb-utils modules have been updated, please rerun the configuration file - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils/project/properties.xml b/org.glite.lb-utils/project/properties.xml deleted file mode 100644 index 5f9597f..0000000 --- a/org.glite.lb-utils/project/properties.xml +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb-utils/project/taskdefs.xml b/org.glite.lb-utils/project/taskdefs.xml deleted file mode 100644 index 7963150..0000000 --- a/org.glite.lb-utils/project/taskdefs.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - diff --git a/org.glite.lb-utils/project/version.properties b/org.glite.lb-utils/project/version.properties deleted file mode 100755 index 6f1f8ab..0000000 --- a/org.glite.lb-utils/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version = 0.0.0 -module.age = 0 \ No newline at end of file diff --git a/org.glite.lb.client-interface/.cvsignore b/org.glite.lb.client-interface/.cvsignore deleted file mode 100644 index 1df717b..0000000 --- a/org.glite.lb.client-interface/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.lb.client-interface/IMPORTANT-README b/org.glite.lb.client-interface/IMPORTANT-README deleted file mode 100644 index 469e260..0000000 --- a/org.glite.lb.client-interface/IMPORTANT-README +++ /dev/null @@ -1,39 +0,0 @@ -This module is now obsolete. - -Files moved from ./interface to org.glite.lb.client/interface: - -consumer_fake.h -consumer.h -dump.h -Job.h -JobStatus.h.T -load.h -notification.h -Notification.h -producer_fake.h -producer.h.T -purge.h -ServerConnection.h -statistics.h - - -Files moved from ./interface to org.glite.lb.common/interface: - -context.h -CountRef.h -Event.h.T -events.h.T -jobstat.h.T -LoggingExceptions.h -notifid.h - - -Files moved form ./doc to org.glite.lb.client/doc: - -C.dox -CPP.dox -api/api.tex -api/Makefile -api/fig/logging-arch.eps -api/fig/logging-arch.pdf - diff --git a/org.glite.lb.client-interface/LICENSE b/org.glite.lb.client-interface/LICENSE deleted file mode 100644 index 259a91f..0000000 --- a/org.glite.lb.client-interface/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb.client-interface/Makefile b/org.glite.lb.client-interface/Makefile deleted file mode 100644 index fa5226d..0000000 --- a/org.glite.lb.client-interface/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -# Default values -all compile: diff --git a/org.glite.lb.client-interface/build.xml b/org.glite.lb.client-interface/build.xml deleted file mode 100755 index d389be7..0000000 --- a/org.glite.lb.client-interface/build.xml +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb.client-interface/project/build.number b/org.glite.lb.client-interface/project/build.number deleted file mode 100644 index e24af99..0000000 --- a/org.glite.lb.client-interface/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Fri Aug 18 12:25:13 CEST 2006 -module.build=0245 diff --git a/org.glite.lb.client-interface/project/build.properties b/org.glite.lb.client-interface/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.lb.client-interface/project/configure.properties.xml b/org.glite.lb.client-interface/project/configure.properties.xml deleted file mode 100644 index e6996e6..0000000 --- a/org.glite.lb.client-interface/project/configure.properties.xml +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -package=${module.package.name} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -PREFIX=${install.dir} -version=${module.version} - - - diff --git a/org.glite.lb.client-interface/project/properties.xml b/org.glite.lb.client-interface/project/properties.xml deleted file mode 100755 index 31d958b..0000000 --- a/org.glite.lb.client-interface/project/properties.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb.client-interface/project/tar_exclude b/org.glite.lb.client-interface/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.lb.client-interface/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.lb.client-interface/project/version.properties b/org.glite.lb.client-interface/project/version.properties deleted file mode 100644 index 29918df..0000000 --- a/org.glite.lb.client-interface/project/version.properties +++ /dev/null @@ -1,4 +0,0 @@ -# $Id$ -# $Name$ -module.version=2.3.2 -module.age=1 diff --git a/org.glite.lb.proxy/.cvsignore b/org.glite.lb.proxy/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.lb.proxy/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.lb.proxy/LICENSE b/org.glite.lb.proxy/LICENSE deleted file mode 100644 index 259a91f..0000000 --- a/org.glite.lb.proxy/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lb.proxy/Makefile b/org.glite.lb.proxy/Makefile deleted file mode 100644 index 63da29a..0000000 --- a/org.glite.lb.proxy/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -# defaults -top_srcdir=. -stagedir=. -globalprefix=glite -lbprefix=lb -package=glite-lb-server -version=0.2.0 -PREFIX=/opt/glite - -nothrflavour=gcc32 -thrflavour=gcc32pthr -expat_prefix=/opt/expat - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -CC=gcc -YACC=bison -y - -VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples:${top_srcdir}/project - -TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit -TEST_INC:=-I${cppunit_prefix}/include - -ifdef LB_PERF - STATIC_LIB_BK:=${stagedir}/lib/libglite_lb_bkserver_perf.a - LB_PERF_FLAGS:=-DLB_PERF -else - STATIC_LIB_BK:=${stagedir}/lib/libglite_lb_bkserver.a -endif - -SUFFIXES = .T - -DEBUG:=-g -O0 -Wall - -ifdef LB_STANDALONE - LB_STANDALONE_FLAGS:=-DLB_STANDALONE -endif - -CFLAGS:= ${DEBUG} \ - -DVERSION=\"${version}\" \ - -I${stagedir}/include -I${top_srcdir}/src -I. \ - -I${expat_prefix}/include \ - ${COVERAGE_FLAGS} \ - -I${gridsite_prefix}/include \ - -D_GNU_SOURCE ${LB_STANDALONE_FLAGS} ${LB_PERF_FLAGS} - - -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -LINKXX:=libtool --mode=link ${CXX} ${LDFLAGS} -INSTALL:=libtool --mode=install install -LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS} - -archlib:=lib -host_cpu:=${shell uname -m} -ifeq (${host_cpu},x86_64) - archlib:=lib64 -endif - -ifneq (${expat_prefix},/usr) - expatlib := -L${expat_prefix}/lib -endif - - -SRVBONES_LIB:= -L${stagedir}/lib -lglite_lbu_server_bones -GRIDSITE_LIBS = -lgridsite_globus `xml2-config --libs` - -vomsflavour := _${nothrflavour} -ifeq (${nothrflavour},gcc32) - vomsflavour := -endif -ifeq (${nothrflavour},gcc32dbg) - vomsflavour := -endif - -VOMS_LIBS:=-L${voms_prefix}/lib -lvomsc${vomsflavour} -EXT_LIBS:= \ - ${expatlib} -lexpat \ - ${GRIDSITE_LIBS} \ - ${VOMS_LIBS} - - - -LB_PROXY_LIBS:= \ - ${STATIC_LIB_BK} \ - ${SRVBONES_LIB} \ - -lglite_lb_common_${nothrflavour} \ - -lglite_lbu_db \ - -lglite_security_gss_${nothrflavour} \ - ${EXT_LIBS} - - - -glite-lb-proxy: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK} - @echo DEBUG: mysql_version=${mysql_version} mysql_prefix=${mysql_prefix} - @echo DEBUG: shell: x$(shell echo ${mysql_version} | cut -d. -f1,2)x - ${LINK} -o $@ lbproxy.o fake_write2rgma.o ${LB_PROXY_LIBS} - -glite-lb-proxy-perf: lbproxy.o fake_write2rgma.o ${STATIC_LIB_BK} - ${LINK} -o $@ lbproxy.o fake_write2rgma.o ${LB_PROXY_LIBS} - -default all: compile - -compile: glite-lb-proxy - -check: compile - -echo No test so far - -examples: - -doc: - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -install: - -mkdir -p ${PREFIX}/bin ${PREFIX}/etc ${PREFIX}/etc/init.d - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${top_srcdir}/doc/README ${top_srcdir}/doc/README.deploy ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 755 glite-lb-proxy ${PREFIX}/bin/glite-lb-proxy - ${INSTALL} -m 644 ${top_srcdir}/config/glite-lb-dbsetup-proxy.sql ${PREFIX}/etc - ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-lb-proxy - -# don't do it due to RPM conflict -# if [ x${DOSTAGE} != xyes ]; then \ -# ${INSTALL} -m 755 ${stagedir}/bin/glite-lb-interlogd ${PREFIX}/bin; \ -# fi - - -clean: - rm -rvf *.o .libs glite-lb-proxy - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ - -%.o: %.y - ${YACC} -d ${YFLAGS} $< - mv y.tab.c $*.c - mv y.tab.h $*.h - ${CC} -c ${CFLAGS} $*.c - rm $*.c diff --git a/org.glite.lb.proxy/build.xml b/org.glite.lb.proxy/build.xml deleted file mode 100755 index 8364558..0000000 --- a/org.glite.lb.proxy/build.xml +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb.proxy/config/glite-lb-dbsetup-proxy.sql b/org.glite.lb.proxy/config/glite-lb-dbsetup-proxy.sql deleted file mode 100644 index 81266fe..0000000 --- a/org.glite.lb.proxy/config/glite-lb-dbsetup-proxy.sql +++ /dev/null @@ -1,112 +0,0 @@ -create table jobs ( - jobid char(32) binary not null, - dg_jobid varchar(255) binary not null, - userid char(32) binary not null, - aclid char(32) binary null, - - primary key (jobid), - unique (dg_jobid), - index (userid) -) engine=innodb; - -create table users ( - userid char(32) binary not null, - cert_subj varchar(255) binary not null, - - primary key (userid), - unique (cert_subj) -) engine=innodb; - -create table events ( - jobid char(32) binary not null, - event int not null, - code int not null, - prog varchar(255) binary not null, - host varchar(255) binary not null, - time_stamp datetime not null, - userid char(32) binary null, - usec int null, - level int null, - - arrived datetime not null, - - - primary key (jobid,event), - index (time_stamp), - index (host), - index (arrived) -) engine=innodb; - -create table short_fields ( - jobid char(32) binary not null, - event int not null, - name varchar(200) binary not null, - value varchar(255) binary null, - - primary key (jobid,event,name) -) engine=innodb; - -create table long_fields ( - jobid char(32) binary not null, - event int not null, - name varchar(200) binary not null, - value mediumblob null, - - primary key (jobid,event,name) -) engine=innodb; - -create table states ( - jobid char(32) binary not null, - status int not null, - seq int not null, - int_status mediumblob not null, - version varchar(32) not null, - parent_job varchar(32) binary not null, - - primary key (jobid), - index (parent_job) - -) engine=innodb; - -create table status_tags ( - jobid char(32) binary not null, - seq int not null, - name varchar(200) binary not null, - value varchar(255) binary null, - - primary key (jobid,seq,name) -) engine=innodb; - -create table server_state ( - prefix varchar(100) not null, - name varchar(100) binary not null, - value varchar(255) binary not null, - - primary key (prefix,name) -) engine=innodb; - -create table acls ( - aclid char(32) binary not null, - value mediumblob not null, - refcnt int not null, - - primary key (aclid) -) engine=innodb; - -create table notif_registrations ( - notifid char(32) binary not null, - destination varchar(200) not null, - valid datetime not null, - userid char(32) binary not null, - conditions mediumblob not null, - - primary key (notifid) -) engine=innodb; - -create table notif_jobs ( - notifid char(32) binary not null, - jobid char(32) binary not null, - - primary key (notifid,jobid), - index (jobid) -) engine=innodb; diff --git a/org.glite.lb.proxy/config/startup b/org.glite.lb.proxy/config/startup deleted file mode 100755 index b100d62..0000000 --- a/org.glite.lb.proxy/config/startup +++ /dev/null @@ -1,77 +0,0 @@ -#!/bin/sh - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf - -[ -f $GLITE_LOCATION/etc/lb.conf ] && . $GLITE_LOCATION/etc/lb.conf -[ -f $GLITE_LOCATION_VAR/etc/lb.conf ] && . $GLITE_LOCATION_VAR/etc/lb.conf - -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -[ -n "$GLITE_LB_PROXY_PIDFILE" ] && pidfile=$GLITE_LB_PROXY_PIDFILE || - pidfile=$GLITE_LOCATION_VAR/glite-lb-proxy.pid - -start() -{ - if test -z "$GLITE_USER" ;then - echo 'Error: GLITE_USER is not set' - echo FAILED - return 1 - fi - - # - # XXX: Starting proxy only with default socket paths - # - echo -n Starting glite-lb-proxy ... - su - $GLITE_USER -c "$GLITE_LOCATION/bin/glite-lb-proxy \ - -i $pidfile " && echo " done" || echo " FAILED" -} - -stop() -{ - if [ -f $pidfile ]; then - pid=`cat $pidfile` - kill $pid - echo -n Stopping glite-lb-proxy \($pid\) ... - try=0 - while ps p $pid >/dev/null 2>&1; do - sleep 1; - try=`expr $try + 1` - if [ $try = 20 ]; then - echo " giving up after $try retries" - return 1 - fi - done - echo " done" - rm -f $pidfile - else - echo $pidfile does not exist - glite-lb-proxy not running? >&2 - return 1 - fi -} - -status() -{ - if [ -f $pidfile ]; then - pid=`cat $pidfile` - if ps p $pid >/dev/null 2>&1; then - echo glite-lb-proxy running as $pid - return 0 - fi - fi - - echo glite-lb-proxy not running - return 1 -} - -case x$1 in - xstart) start;; - xstop) stop;; - xrestart) stop; start;; - xstatus) status;; - x*) echo usage: $0 start,stop,restart,status >&2 - exit 1;; -esac diff --git a/org.glite.lb.proxy/doc/README b/org.glite.lb.proxy/doc/README deleted file mode 100644 index 97ee74a..0000000 --- a/org.glite.lb.proxy/doc/README +++ /dev/null @@ -1,68 +0,0 @@ -LB proxy usage -============== - -LB proxy accepts LB events, passes them to the full-featured LB servers, and -serves both event and job state queries similarly to the LB server. However, -the results of the queries reflect ONLY LOCAL VIEW of the proxy, i.e. the -events that were logged through it, not regarding other events which may affect -job state too. On the other hand, all the LB proxy operation is synchronous, -i.e. it is guaranteed that a successfully logged event is visible in a query -result immediately, unlike the standard LB logging chain. - -LB proxy is supposed to run on the RB machine, providing the WMS daemons -with optimal LB performance, while offloading the user LB queries to -a dedicated LB server. - -Events are logged to the LB proxy through local UNIX socket. The connection to -the LB proxy is not encrypted, and no SSL-like authentication/authorisation is -used, relying completely on UNIX security mechanism. Because of the missing -SSL authentication the logging user identity has to be specified explicitely -via LB proxy API. - -Due to the synchornous operation LB proxy can help with management of LB -sequence codes. It records the most recent sequence code which can be retrieved -and used later, even by another WMS component. However, this mechanism works -for the "one job instance at time" model only. Once multiple instances of the -same job may co-exist (which may be the case of shallow resubmission), these -are distinguished exactly with the LB seqence code, hence LB proxy cannot -do the job. For this case LB proxy API still provides means of specifying -the sequence code explicitely. - -All jobs are recorded localy in the LB proxy database until job gets into -CLEARED, ABORTED, CANCELED, DONE state. These jobs are then purged from LB -proxy (but they are still available on the LB server). ->>A timeout should be set also, after which job should be purged from LB proxy. -This has to be done by external purge client. << - -Using API -========= -LB proxy uses same API functions for consumer and producer as LB does except the -function names are postfixed with 'Proxy'. I.e. edg_wll_SetLoggingJob() -has its own LB proxy variant edg_wll_SetLoggingJobProxy(). - -For LB proxy comunication are used two separated local unix sockets. One for -consumer other for producer API calls. Their values are set when the LB context -is initialized according to unix enironment variables EDG_WL_LBPROXY_STORE_SOCK -(producer API) and EDG_WL_LBPROXY_SERVE_SOCK (consumer API). If these variables -are not set, default values are used (producer: "/tmp/lb_proxy_store.sock", -consumer: "/tmp/lb_proxy_serve.sock"). After all you can overwrite them with -edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_STORE_SOCK, "path_to_store_socket"); -and -edg_wll_SetParam(ctx, EDG_WLL_PARAM_LBPROXY_SERVE_SOCK, "path_to_serve_socket"); - -Other important difference is in edg_wll_SetLoggingJobProxy(), where it is not -neccessary to give the sequence code parameter. If user do not specify it, LB -proxy gets the actual one from its database. The 'user' attribute of this call -should be the user certificate DN string. If not set, it is set from the unix -environment by default. - -For example you could use: -char *user = "/O=CESNET/O=Masaryk University/CN=Jiri Skrabal"; -edg_wll_SetLoggingJobProxy(ctx, jobid, NULL, user, EDG_WLL_SEQ_NORMAL); - -Only very different LB Proxy call is the 'RegisterJob'. The current -implementation of RegisterJobProxy() talks both to the LB server -bypassing interlogger, and to the LB proxy at once. So for job -registration you should supply the user's credentials to the -context in the same way as it was done until now. The other proxy calls -don't need it. diff --git a/org.glite.lb.proxy/doc/README.deploy b/org.glite.lb.proxy/doc/README.deploy deleted file mode 100644 index 2012717..0000000 --- a/org.glite.lb.proxy/doc/README.deploy +++ /dev/null @@ -1,64 +0,0 @@ -The LB Proxy RPM package contains following files: -bin/glite-lb-interlogd -bin/glite-lb-proxy -etc/glite-lb-dbsetup-proxy.sql -etc/init.d/glite-lb-proxy -share/doc/glite-lb-proxy-1.1.1/LICENSE - -The LB Proxy RPM package depends on glite-lb-client-interface and -glite-lb-common RPM packages. In addition, a reasonable run-time functionality -depends also on glite-lb-logger and running interlogger. - -LB Proxu is supposed to run on RB machine and its outgoing communication goes through -interlogger. As a interlogger could be used that one which is used for any other -logging calls. In fact, using more than one standard interlogger on one machine -has usually not a valid reason. For full LB Proxy functionality you need to -have running LB server (on any location). - -LB Proxy install should follow several steps described bellow: - -0) LB Proxy RPM package install - -1) Create new database in same way as it is done for bkserver. - Database name: lbproxy - Grant privileges to user: lbserver - Database has the same structure as bkserver has (you can use - sql script etc/glite-lb-dbsetup-proxy.sql to create propper tables). - - For better performance it's recommended to use database backend with - transactions. It's set up by default, existing database can be migrated - with etc/glite-lb-dbsetup-migrate2transaction.sql (lb-server package). - -2) Start servers with scripts from distribution - /opt/glite/etc/init.d/glite-lb-locallogger start - /opt/glite/etc/init.d/glite-lb-proxy start - - The glite-lb-locallogger script goes with the glite-lb-logger RPM package. - and runs locallogger and interlogger as well. This is not neccessary to run - locallogger if you do not use direct LB server logging calls, so you can - simply start everythink you need from command line. - - The options to the LB proxy server: - -p, --sock path-name to the local socket - This is the path prefix for both LB Proxy unix - sockets. Default value is "/tmp/lb_proxy_". - -m, --mysql database connect string - This has the same functionality as it is described in LB server - Default value is "lbserver/@localhost:lbproxy". - -d, --debug don't run as daemon, additional diagnostics - -s, --slaves number of slave servers to fork - -l, --semaphores number of semaphores (job locks) to use - -i, --pidfile file to store master pid - --proxy-il-sock socket to send events to interlogger - Default value is "/tmp/interlogger.sock". - --proxy-il-fprefix file prefix for events - Default value is "/tmp/notif_events". - -4) Test the environment basic functionality: - # job_reg uses direct access to the bkserver at `hostname -f`:9000 - # and to the LBProxy store socket (env. var EDG_WL_LBPROXY_STORE_SOCK) - # at once - ./glite-lb-job_reg -m `hostname -f`:9000 -x -s UserInterface - # log usertag COLOR = red to the proxy - ./glite-lb-log_usertag_proxy -s /tmp/lb_proxy_store.sock -j -u test -n color -v red - # and check lbserver values with job_stat diff --git a/org.glite.lb.proxy/examples/test.sh b/org.glite.lb.proxy/examples/test.sh deleted file mode 100755 index 7847dc7..0000000 --- a/org.glite.lb.proxy/examples/test.sh +++ /dev/null @@ -1,266 +0,0 @@ -#!/bin/sh - -# XXX: add path to the stage area -PATH=/home/michal/shared/egee/jra1-head/stage/bin:/home/michal/shared/egee/jra1-head/stage/examples:$PATH - -#set -x - -# Binaries -LOGEV=${LOGEV:-glite-lb-logevent} -JOBLOG=${JOBLOG:-glite-lb-job_log} -JOBREG=${JOBREG:-glite-lb-job_reg} -USERJOBS=${USERJOBS:-glite-lb-user_jobs} -JOBSTAT=${JOBSTAT:-glite-lb-job_status} -PURGE=${PURGE:-glite-lb-purge} - -# -m host -BKSERVER_HOST=${BKSERVER_HOST:-`hostname -f`:9000} -TEST_LBPROXY_STORE_SOCK=${EDG_WL_LBPROXY_STORE_SOCK:-/tmp/lb_proxy_store.sock} -TEST_LBPROXY_SERVE_SOCK=${EDG_WL_LBPROXY_SERVE_SOCK:-/tmp/lb_proxy_serve.sock} - -STATES="aborted cancelled done ready running scheduled waiting" -LBPROXY_PURGE_STATES="cleared done aborted cancelled" -JOBS_ARRAY_SIZE=10 -SAMPLE_JOBS_ARRAY[0]= -SAMPLE_JOBS_STATES[0]= -SAMPLE_JOBS_RESPONSES[0]= - -# some defaults -DEBUG=2 -LOGFD=${LOGFD:-1} -LARGE_STRESS=${LARGE_STRESS:-} - -# timeouts for polling the bkserver -timeout=10 -maxtimeout=300 - -# -# Procedures -# - -# print help message -show_help() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -x | --proxy-sockpath-pref LBProxy socket path prefix." - echo " -j | --jobs-count Count of test(ed) jobs." - echo " -s | --states List of states in which could tested jobs fall." - echo " -p | --proxy-purge-states List of states in which LBProxy purges the job." - echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." - echo " -g | --log 'logfile' Redirect all output to the 'logfile'." - echo "" - echo "For proper operation check your grid-proxy-info" - grid-proxy-info -} - -check_exec() -{ - [ $DEBUG -gt 0 ] && [ -n "$2" ] && echo -n -e "$2\t" || echo -n -e "$1\t" - eval $1 - RV=$? - [ $DEBUG -gt 0 ] && [ $RV -eq 0 ] && echo "OK" || echo "FAILED" - return $RV -} - -# check for existance of needed executable(s) -check_utils() -{ - check_exec 'JOBREG=`which $JOBREG`' "Checkig $JOBREG utility" || exit 1 - check_exec 'JOBLOG=`which $JOBLOG`' "Checkig $JOBLOG utility" || exit 1 - check_exec 'LOGEV=`which $LOGEV`' "Checkig $LOGEV utility" || exit 1 - check_exec 'USERJOBS=`which $USERJOBS`' "Checkig $USERJOBS utility" || exit 1 - check_exec 'JOBSTAT=`which $JOBSTAT`' "Checkig $JOBSTAT utility" || exit 1 -} - -log_ev() -{ -# $LOGEV -j $EDG_JOBID -s NetworkServer -e UserTag --name color --value red - [ $DEBUG -gt 2 ] && echo "$LOGEV -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -log_ev_proxy() -{ -# $LOGEV -x -j $EDG_JOBID -s NetworkServer -e UserTag --name color --value red - - [ $DEBUG -gt 2 ] && echo "$LOGEV -x -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV -x $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -purge() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -a 0 -c 0 -n 0 -o 0 "$@" -} - -purge_proxy() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -x -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -x -a 0 -c 0 -n 0 -o 0 "$@" -} - - -db_clear_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Purging test jobs from db\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - LARGE_STRESS="" - EDG_WL_SEQUENCE="UI=999999:NS=9999999999:WM=999999:BH=9999999999:JSS=999999:LM=999999:LRMS=999999:APP=999999" -# log_ev_proxy -e Clear --reason=PurgingDB -# purge_proxy -# log_ev -e Clear --reason=PurgingDB -# purge - - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" -} - -# Test thet registers jobs -# and checks against lbproxy and bkserver -# -test_gen_sample_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Registering sample jobs\t\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# eval `$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1 | tail -n 2` - TMP=`$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1` - [ $? -ne 0 ] && echo -e "ERROR\n\t$JOBREG error!" - eval `echo "$TMP" | tail -n 2` - test -z "$EDG_JOBID" && echo "test_gen_sample_jobs: $JOBREG failed" && exit 2 - SAMPLE_JOBS_ARRAY[$job]=$EDG_JOBID - - state=`$JOBSTAT $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` - proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` - if test "$state" != "submitted" ; then - echo -e "ERROR\n\tjob ${SAMPLE_JOBS_ARRAY[$job]} not submitted succesfully!" - exit 1; - fi - if test "$state" != "$proxy_state" ; then - echo -e "ERROR\n\tjob $job (${SAMPLE_JOBS_ARRAY[$job]}) records on lbproxy and bkserver differs!" -# exit 1; - fi - SAMPLE_JOBS_STATES[$job]=$state - - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" - [ $DEBUG -gt 1 ] && { - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - echo ${SAMPLE_JOBS_ARRAY[$job]} - job=$(($job + 1)) - done - } -} - -# Test that logs random set of events (for registered jobs) to lbproxy -# and chcecks the state in lbproxy -# and measures the time it takes the state to propagate to bkserver -# -test_logging_events() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Logging events to the lbproxy\t\t" - st_count=`echo $STATES | wc -w` - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` - state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - - source glite-lb-$state.sh $LARGE_STRESS -X $TEST_LBPROXY_STORE_SOCK -m $BKSERVER_HOST -j ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 1>/dev/null - [ $? -ne 0 ] && echo -e "ERROR\n\tglite-lb-$state.sh ${SAMPLE_JOBS_ARRAY[$job]} error!" - proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` - purged=`echo $LBPROXY_PURGE_STATES | grep $state` - bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` - - if test -n "$purged" ; then - echo $proxy_state | grep "No such file or directory" - if test $? -eq 0 ; then - echo -e "ERROR\n\tJob ${SAMPLE_JOBS_ARRAY[$job]} was not purged out from LBProxy!" - exit 1; - fi - fi - if test -z "$purged" ; then - if test "$state" != "$proxy_state" ; then - echo -e "ERROR\n\tevents for job ${SAMPLE_JOBS_ARRAY[$job]} were not logged succesfully!" - exit 1; - fi - fi - - response=0 - while [ "$state" != "$bkserver_state" ] ; do - bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` - [ $DEBUG -gt 0 ] && echo -n "." - sleep $timeout - response=$(($response + $timeout )) - if test $response -gt $maxtimeout ; then - echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job]} as queried from bkserver ($bkserver_state) has not become $state for more than $response seconds!" - exit 1; - fi - done - - SAMPLE_JOBS_STATES[$job]=$state - SAMPLE_JOBS_RESPONSES[$job]=$response - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" - [ $DEBUG -gt 1 ] && { - job=0 - echo "Polling the bkserver took for individual jobs the following time" - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - echo -e "${SAMPLE_JOBS_ARRAY[$job]} (${SAMPLE_JOBS_STATES[$job]})\t${SAMPLE_JOBS_RESPONSES[$job]} seconds" - job=$(($job + 1)) - done - } -} - - -# -# shell starting code - -# without parameters show help message -# test -z "$1" && show_help - -while test -n "$1" -do - case "$1" in - "-h" | "--help") show_help && exit 0 ;; - "-x" | "--proxy-sockpath-pref") - shift - export TEST_LBPROXY_STORE_SOCK=$1store.sock - export TEST_LBPROXY_SERVE_SOCK=$1serve.sock - ;; - "-m" | "--bkserver") shift ; BKSERVER_HOST=$1 ;; - "-j" | "--jobs-count") shift; JOBS_ARRAY_SIZE=$1 ;; - "-s" | "--states") shift; STATES="$1" ;; - "-p" | "--proxy-purge-states") shift; LBPROXY_PURGE_STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; - "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1" ;; - - esac - shift -done - -if test -n "$logfile" ; then - LOGFD=3 - exec 3>$logfile -fi - - -echo "STATES = $STATES" -echo "LBPROXY_PURGE_STATES = $LBPROXY_PURGE_STATES" - -check_utils - -test_gen_sample_jobs -test_logging_events - -db_clear_jobs diff --git a/org.glite.lb.proxy/examples/test1.sh b/org.glite.lb.proxy/examples/test1.sh deleted file mode 100644 index 485418f..0000000 --- a/org.glite.lb.proxy/examples/test1.sh +++ /dev/null @@ -1,295 +0,0 @@ -#!/bin/sh - -# XXX: add path to the stage area -PATH=/home/michal/shared/egee/jra1/stage/bin:/home/michal/shared/egee/jra1/stage/examples:$PATH - -#set -x - -# Binaries -LOGEV=${LOGEV:-glite-lb-logevent} -JOBLOG=${JOBLOG:-glite-lb-job_log} -JOBREG=${JOBREG:-glite-lb-job_reg} -USERJOBS=${USERJOBS:-glite-lb-user_jobs} -JOBSTAT=${JOBSTAT:-glite-lb-job_status} -PURGE=${PURGE:-glite-lb-purge} - -# -m host -BKSERVER_HOST=${BKSERVER_HOST:-`hostname -f`:9000} -TEST_LBPROXY_STORE_SOCK=${EDG_WL_LBPROXY_STORE_SOCK:-/tmp/lb_proxy_store.sock} -TEST_LBPROXY_SERVE_SOCK=${EDG_WL_LBPROXY_SERVE_SOCK:-/tmp/lb_proxy_serve.sock} - -STATES="aborted cancelled done ready running scheduled waiting" -LBPROXY_PURGE_STATES="cleared done aborted cancelled" -JOBS_ARRAY_SIZE=10 -SAMPLE_JOBS_ARRAY[0]= -SAMPLE_JOBS_STATES[0]= -SAMPLE_JOBS_RESPONSES[0]= - -# some defaults -DEBUG=2 -LOGFD=${LOGFD:-1} -LARGE_STRESS=${LARGE_STRESS:-} - -# timeouts for polling the bkserver -timeout=10 -maxtimeout=300 - -# -# Procedures -# - -# print help message -show_help() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -x | --proxy-sockpath-pref LBProxy socket path prefix." - echo " -j | --jobs-count Count of test(ed) jobs." - echo " -s | --states List of states in which could tested jobs fall." - echo " -p | --proxy-purge-states List of states in which LBProxy purges the job." - echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." - echo " -g | --log 'logfile' Redirect all output to the 'logfile'." - echo "" - echo "For proper operation check your grid-proxy-info" - grid-proxy-info -} - -get_time() -{ - sec=`date +%s` - nsec=`date +%N` - time=`echo "1000000000*$sec + $nsec"|bc` -# time=$sec - return 0 -} - -check_exec() -{ - [ $DEBUG -gt 0 ] && [ -n "$2" ] && echo -n -e "$2\t" || echo -n -e "$1\t" - eval $1 - RV=$? - [ $DEBUG -gt 0 ] && [ $RV -eq 0 ] && echo "OK" || echo "FAILED" - return $RV -} - -# check for existance of needed executable(s) -check_utils() -{ - check_exec 'JOBREG=`which $JOBREG`' "Checkig $JOBREG utility" || exit 1 - check_exec 'JOBLOG=`which $JOBLOG`' "Checkig $JOBLOG utility" || exit 1 - check_exec 'LOGEV=`which $LOGEV`' "Checkig $LOGEV utility" || exit 1 - check_exec 'USERJOBS=`which $USERJOBS`' "Checkig $USERJOBS utility" || exit 1 - check_exec 'JOBSTAT=`which $JOBSTAT`' "Checkig $JOBSTAT utility" || exit 1 -} - -log_ev() -{ -# $LOGEV -j $EDG_JOBID -s NetworkServer -n $1 -e UserTag --name color --value red - [ $DEBUG -gt 2 ] && echo "$LOGEV -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -log_ev_proxy() -{ -# $LOGEV -x -j $EDG_JOBID -s NetworkServer -n $1 -e UserTag --name color --value red - - [ $DEBUG -gt 2 ] && echo "$LOGEV -x -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV -x $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -purge() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -a 0 -c 0 -n 0 -o 0 "$@" -} - -purge_proxy() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -x -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -x -a 0 -c 0 -n 0 -o 0 "$@" -} - - -db_clear_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Purging test jobs from db\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - LARGE_STRESS="" - EDG_WL_SEQUENCE="UI=999999:NS=9999999999:WM=999999:BH=9999999999:JSS=999999:LM=999999:LRMS=999999:APP=999999" -# log_ev_proxy -e Clear --reason=PurgingDB -# purge_proxy -# log_ev -e Clear --reason=PurgingDB -# purge - - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" -} - -# Test thet registers jobs -# and checks against lbproxy and bkserver -# -test_gen_sample_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Registering sample jobs\t\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# eval `$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1 | tail -n 2` - TMP=`$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1` - [ $? -ne 0 ] && echo -e "ERROR\n\t$JOBREG error!" - eval `echo "$TMP" | tail -n 2` - if test -z "$EDG_JOBID" ; then - echo "test_gen_sample_jobs: $JOBREG failed" - else - SAMPLE_JOBS_ARRAY[$job]=$EDG_JOBID - fi - -# state=`$JOBSTAT $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# if test "$state" != "submitted" ; then -# echo -e "ERROR\n\tjob ${SAMPLE_JOBS_ARRAY[$job]} not submitted succesfully!" -# fi -# if test "$state" != "$proxy_state" ; then -# echo -e "ERROR\n\tjob (${SAMPLE_JOBS_ARRAY[$job]}) records on lbproxy and bkserver differs!" -# fi -# SAMPLE_JOBS_STATES[$job]=$state - echo -n "." - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" -# [ $DEBUG -gt 1 ] && { -# job=0 -# while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# echo ${SAMPLE_JOBS_ARRAY[$job]} -# job=$(($job + 1)) -# done -# } -} - -# Test that logs random set of events (for registered jobs) to lbproxy -# and checks the state in lbproxy -# and measures the time it takes the state to propagate to bkserver -# -test_logging_events() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Logging events to the lbproxy\t\t" - st_count=`echo $STATES | wc -w` - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - echo -n "." - if test -z "${SAMPLE_JOBS_ARRAY[$job]}" ; then - job=$(($job + 1)) - continue - fi -# tmp=`echo $RANDOM % $st_count + 1 | bc` -# state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - get_time - start=$time - -# source glite-lb-$state.sh $LARGE_STRESS -X $TEST_LBPROXY_STORE_SOCK -m $BKSERVER_HOST -j ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 1>/dev/null -# [ $? -ne 0 ] && echo -e "ERROR\n\tglite-lb-$state.sh ${SAMPLE_JOBS_ARRAY[$job]} error!" - log_ev_proxy -n 100 -e UserTag --tag=color --value=red - -# proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# purged=`echo $LBPROXY_PURGE_STATES | grep $state` -# bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# -# if test -n "$purged" ; then -# echo $proxy_state | grep "No such file or directory" -# if test $? -eq 0 ; then -# echo -e "ERROR\n\tJob ${SAMPLE_JOBS_ARRAY[$job]} was not purged out from LBProxy!" -# exit 1; -# fi -# fi -# if test -z "$purged" ; then -# if test "$state" != "$proxy_state" ; then -# echo -e "ERROR\n\tevents for job ${SAMPLE_JOBS_ARRAY[$job]} were not logged succesfully!" -# exit 1; -# fi -# fi - -# response=0 -# while [ "$state" != "$bkserver_state" ] ; do -# bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# [ $DEBUG -gt 0 ] && echo -n "." -# sleep $timeout -# response=$(($response + $timeout )) -# if test $response -gt $maxtimeout ; then -# echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job]} as queried from bkserver ($bkserver_state) has not become $state for more than $response seconds!" -# exit 1; -# fi -# done -# -# SAMPLE_JOBS_STATES[$job]=$state - get_time - response=`echo "scale=9; ($time - $start)/1000000000"|bc` - SAMPLE_JOBS_RESPONSES[$job]=$response - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" - [ $DEBUG -gt 1 ] && { - job=0 - total=0 -# echo "Sending events took for individual jobs the following time" - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - total=`echo "scale=9; $total + ${SAMPLE_JOBS_RESPONSES[$job]}" |bc` -# echo -e "${SAMPLE_JOBS_ARRAY[$job]} \t${SAMPLE_JOBS_RESPONSES[$job]} seconds" - job=$(($job + 1)) - done - echo -e "Total time for $JOBS_ARRAY_SIZE jobs: \t$total" - echo -e -n "Average time for job: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE"|bc - echo -e -n "Job throughput (jobs/sec): \t" - echo "scale=9; $JOBS_ARRAY_SIZE / $total"|bc - - } -} - - -# -# shell starting code - -# without parameters show help message -# test -z "$1" && show_help - -while test -n "$1" -do - case "$1" in - "-h" | "--help") show_help && exit 0 ;; - "-x" | "--proxy-sockpath-pref") - shift - export TEST_LBPROXY_STORE_SOCK=$1store.sock - export TEST_LBPROXY_SERVE_SOCK=$1serve.sock - ;; - "-m" | "--bkserver") shift ; BKSERVER_HOST=$1 ;; - "-j" | "--jobs-count") shift; JOBS_ARRAY_SIZE=$1 ;; - "-s" | "--states") shift; STATES="$1" ;; - "-p" | "--proxy-purge-states") shift; LBPROXY_PURGE_STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; - "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1" ;; - - esac - shift -done - -if test -n "$logfile" ; then - LOGFD=3 - exec 3>$logfile -fi - - -echo "STATES = $STATES" -echo "LBPROXY_PURGE_STATES = $LBPROXY_PURGE_STATES" - -check_utils - -test_gen_sample_jobs -test_logging_events - -db_clear_jobs diff --git a/org.glite.lb.proxy/examples/test2.sh b/org.glite.lb.proxy/examples/test2.sh deleted file mode 100644 index 54b9416..0000000 --- a/org.glite.lb.proxy/examples/test2.sh +++ /dev/null @@ -1,298 +0,0 @@ -#!/bin/sh - -# XXX: add path to the stage area -PATH=/home/michal/shared/egee/jra1/stage/bin:/home/michal/shared/egee/jra1/stage/examples:$PATH - -#set -x - -# Binaries -LOGEV=${LOGEV:-glite-lb-logevent} -JOBLOG=${JOBLOG:-glite-lb-job_log} -JOBREG=${JOBREG:-glite-lb-job_reg} -USERJOBS=${USERJOBS:-glite-lb-user_jobs} -JOBSTAT=${JOBSTAT:-glite-lb-job_status} -PURGE=${PURGE:-glite-lb-purge} - -# -m host -BKSERVER_HOST=${BKSERVER_HOST:-`hostname -f`:9000} -TEST_LBPROXY_STORE_SOCK=${EDG_WL_LBPROXY_STORE_SOCK:-/tmp/lb_proxy_store.sock} -TEST_LBPROXY_SERVE_SOCK=${EDG_WL_LBPROXY_SERVE_SOCK:-/tmp/lb_proxy_serve.sock} - -STATES="aborted cancelled done ready running scheduled waiting" -LBPROXY_PURGE_STATES="cleared done aborted cancelled" -JOBS_ARRAY_SIZE=10 -EVENT_NUMBER=50 -SAMPLE_JOBS_ARRAY[0]= -SAMPLE_JOBS_STATES[0]= -SAMPLE_JOBS_RESPONSES[0]= - -# some defaults -DEBUG=2 -LOGFD=${LOGFD:-1} -LARGE_STRESS=${LARGE_STRESS:-} - -# timeouts for polling the bkserver -timeout=10 -maxtimeout=300 - -# -# Procedures -# - -# print help message -show_help() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -x | --proxy-sockpath-pref LBProxy socket path prefix." - echo " -j | --jobs-count Count of test(ed) jobs." - echo " -n | --event-count Number of events per job." - echo " -s | --states List of states in which could tested jobs fall." - echo " -p | --proxy-purge-states List of states in which LBProxy purges the job." - echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." - echo " -g | --log 'logfile' Redirect all output to the 'logfile'." - echo "" - echo "For proper operation check your grid-proxy-info" - grid-proxy-info -} - -get_time() -{ - sec=`date +%s` - nsec=`date +%N` - time=`echo "1000000000*$sec + $nsec"|bc` -# time=$sec - return 0 -} - -check_exec() -{ - [ $DEBUG -gt 0 ] && [ -n "$2" ] && echo -n -e "$2\t" || echo -n -e "$1\t" - eval $1 - RV=$? - [ $DEBUG -gt 0 ] && [ $RV -eq 0 ] && echo "OK" || echo "FAILED" - return $RV -} - -# check for existance of needed executable(s) -check_utils() -{ - check_exec 'JOBREG=`which $JOBREG`' "Checkig $JOBREG utility" || exit 1 - check_exec 'JOBLOG=`which $JOBLOG`' "Checkig $JOBLOG utility" || exit 1 - check_exec 'LOGEV=`which $LOGEV`' "Checkig $LOGEV utility" || exit 1 - check_exec 'USERJOBS=`which $USERJOBS`' "Checkig $USERJOBS utility" || exit 1 - check_exec 'JOBSTAT=`which $JOBSTAT`' "Checkig $JOBSTAT utility" || exit 1 -} - -log_ev() -{ -# $LOGEV -j $EDG_JOBID -s NetworkServer -n $1 -e UserTag --name color --value red - [ $DEBUG -gt 2 ] && echo "$LOGEV -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -log_ev_proxy() -{ -# $LOGEV -x -j $EDG_JOBID -s NetworkServer -n $1 -e UserTag --name color --value red - - [ $DEBUG -gt 2 ] && echo "$LOGEV -x -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV -x $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -purge() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -a 0 -c 0 -n 0 -o 0 "$@" -} - -purge_proxy() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -x -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -x -a 0 -c 0 -n 0 -o 0 "$@" -} - - -db_clear_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Purging test jobs from db\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - LARGE_STRESS="" - EDG_WL_SEQUENCE="UI=999999:NS=9999999999:WM=999999:BH=9999999999:JSS=999999:LM=999999:LRMS=999999:APP=999999" -# log_ev_proxy -e Clear --reason=PurgingDB -# purge_proxy -# log_ev -e Clear --reason=PurgingDB -# purge - - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" -} - -# Test thet registers jobs -# and checks against lbproxy and bkserver -# -test_gen_sample_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Registering sample jobs\t\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# eval `$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1 | tail -n 2` - TMP=`$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1` - [ $? -ne 0 ] && echo -e "ERROR\n\t$JOBREG error!" - eval `echo "$TMP" | tail -n 2` - if test -z "$EDG_JOBID" ; then - echo "test_gen_sample_jobs: $JOBREG failed" - else - SAMPLE_JOBS_ARRAY[$job]=$EDG_JOBID - fi - -# state=`$JOBSTAT $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# if test "$state" != "submitted" ; then -# echo -e "ERROR\n\tjob ${SAMPLE_JOBS_ARRAY[$job]} not submitted succesfully!" -# fi -# if test "$state" != "$proxy_state" ; then -# echo -e "ERROR\n\tjob (${SAMPLE_JOBS_ARRAY[$job]}) records on lbproxy and bkserver differs!" -# fi -# SAMPLE_JOBS_STATES[$job]=$state - echo -n "." - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" -# [ $DEBUG -gt 1 ] && { -# job=0 -# while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# echo ${SAMPLE_JOBS_ARRAY[$job]} -# job=$(($job + 1)) -# done -# } -} - -# Test that logs random set of events (for registered jobs) to lbproxy -# and checks the state in lbproxy -# and measures the time it takes the state to propagate to bkserver -# -test_logging_events() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Logging events to the lbproxy\t\t" - st_count=`echo $STATES | wc -w` - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - echo -n "." - if test -z "${SAMPLE_JOBS_ARRAY[$job]}" ; then - job=$(($job + 1)) - continue - fi -# tmp=`echo $RANDOM % $st_count + 1 | bc` -# state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - get_time - start=$time - -# source glite-lb-$state.sh $LARGE_STRESS -X $TEST_LBPROXY_STORE_SOCK -m $BKSERVER_HOST -j ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 1>/dev/null -# [ $? -ne 0 ] && echo -e "ERROR\n\tglite-lb-$state.sh ${SAMPLE_JOBS_ARRAY[$job]} error!" - log_ev_proxy -n $EVENT_NUMBER -e UserTag --tag=color --value=red - -# proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# purged=`echo $LBPROXY_PURGE_STATES | grep $state` -# bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# -# if test -n "$purged" ; then -# echo $proxy_state | grep "No such file or directory" -# if test $? -eq 0 ; then -# echo -e "ERROR\n\tJob ${SAMPLE_JOBS_ARRAY[$job]} was not purged out from LBProxy!" -# exit 1; -# fi -# fi -# if test -z "$purged" ; then -# if test "$state" != "$proxy_state" ; then -# echo -e "ERROR\n\tevents for job ${SAMPLE_JOBS_ARRAY[$job]} were not logged succesfully!" -# exit 1; -# fi -# fi - -# response=0 -# while [ "$state" != "$bkserver_state" ] ; do -# bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# [ $DEBUG -gt 0 ] && echo -n "." -# sleep $timeout -# response=$(($response + $timeout )) -# if test $response -gt $maxtimeout ; then -# echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job]} as queried from bkserver ($bkserver_state) has not become $state for more than $response seconds!" -# exit 1; -# fi -# done -# -# SAMPLE_JOBS_STATES[$job]=$state - get_time - response=`echo "scale=9; ($time - $start)/1000000000"|bc` - SAMPLE_JOBS_RESPONSES[$job]=$response - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" - [ $DEBUG -gt 1 ] && { - job=0 - total=0 -# echo "Sending events took for individual jobs the following time" - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - total=`echo "scale=9; $total + ${SAMPLE_JOBS_RESPONSES[$job]}" |bc` -# echo -e "${SAMPLE_JOBS_ARRAY[$job]} \t${SAMPLE_JOBS_RESPONSES[$job]} seconds" - job=$(($job + 1)) - done - echo -e "Total time for $JOBS_ARRAY_SIZE jobs: \t$total" - echo -e -n "Average time for event: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE / $EVENT_NUMBER"|bc - echo -e -n "Event throughput (events/sec): \t" - echo "scale=9; $EVENT_NUMBER * $JOBS_ARRAY_SIZE / $total"|bc - - } -} - - -# -# shell starting code - -# without parameters show help message -# test -z "$1" && show_help - -while test -n "$1" -do - case "$1" in - "-h" | "--help") show_help && exit 0 ;; - "-x" | "--proxy-sockpath-pref") - shift - export TEST_LBPROXY_STORE_SOCK=$1store.sock - export TEST_LBPROXY_SERVE_SOCK=$1serve.sock - ;; - "-m" | "--bkserver") shift ; BKSERVER_HOST=$1 ;; - "-j" | "--jobs-count") shift; JOBS_ARRAY_SIZE=$1 ;; - "-n" | "--event-count") shift; EVENT_NUMBER=$1 ;; - "-s" | "--states") shift; STATES="$1" ;; - "-p" | "--proxy-purge-states") shift; LBPROXY_PURGE_STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; - "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1" ;; - - esac - shift -done - -if test -n "$logfile" ; then - LOGFD=3 - exec 3>$logfile -fi - - -echo "STATES = $STATES" -echo "LBPROXY_PURGE_STATES = $LBPROXY_PURGE_STATES" - -check_utils - -test_gen_sample_jobs -test_logging_events - -db_clear_jobs diff --git a/org.glite.lb.proxy/examples/test3.sh b/org.glite.lb.proxy/examples/test3.sh deleted file mode 100755 index d8856d9..0000000 --- a/org.glite.lb.proxy/examples/test3.sh +++ /dev/null @@ -1,326 +0,0 @@ -#!/bin/sh - -# XXX: add path to the stage area -PATH=/home/michal/shared/egee/jra1/stage/bin:/home/michal/shared/egee/jra1/stage/examples:$PATH - -#set -x - -# Binaries -LOGEV=${LOGEV:-glite-lb-logevent} -JOBLOG=${JOBLOG:-glite-lb-job_log} -JOBREG=${JOBREG:-glite-lb-job_reg} -USERJOBS=${USERJOBS:-glite-lb-user_jobs} -JOBSTAT=${JOBSTAT:-glite-lb-job_status} -PURGE=${PURGE:-glite-lb-purge} - -# -m host -BKSERVER_HOST=${BKSERVER_HOST:-`hostname -f`:9000} -TEST_LBPROXY_STORE_SOCK=${EDG_WL_LBPROXY_STORE_SOCK:-/tmp/lb_proxy_store.sock} -TEST_LBPROXY_SERVE_SOCK=${EDG_WL_LBPROXY_SERVE_SOCK:-/tmp/lb_proxy_serve.sock} - -STATES="aborted cancelled done ready running scheduled waiting" -LBPROXY_PURGE_STATES="cleared done aborted cancelled" -JOBS_ARRAY_SIZE=10 -SAMPLE_JOBS_ARRAY[0]= -SAMPLE_JOBS_STATES[0]= -SAMPLE_JOBS_RESPONSES[0]= - -# some defaults -DEBUG=2 -LOGFD=${LOGFD:-1} -LARGE_STRESS=${LARGE_STRESS:-} - -# timeouts for polling the bkserver -timeout=10 -maxtimeout=300 - -# -# Procedures -# - -# print help message -show_help() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -x | --proxy-sockpath-pref LBProxy socket path prefix." - echo " -j | --jobs-count Count of test(ed) jobs." - echo " -n | --subjobs Number of subjobs." - echo " -s | --states List of states in which could tested jobs fall." - echo " -p | --proxy-purge-states List of states in which LBProxy purges the job." - echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." - echo " -g | --log 'logfile' Redirect all output to the 'logfile'." - echo "" - echo "For proper operation check your grid-proxy-info" - grid-proxy-info -} - -get_time() -{ - sec=`date +%s` - nsec=`date +%N` - time=`echo "1000000000*$sec + $nsec"|bc` -# time=$sec - return 0 -} - -check_exec() -{ - [ $DEBUG -gt 0 ] && [ -n "$2" ] && echo -n -e "$2\t" || echo -n -e "$1\t" - eval $1 - RV=$? - [ $DEBUG -gt 0 ] && [ $RV -eq 0 ] && echo "OK" || echo "FAILED" - return $RV -} - -# check for existance of needed executable(s) -check_utils() -{ - check_exec 'JOBREG=`which $JOBREG`' "Checkig $JOBREG utility" || exit 1 - check_exec 'JOBLOG=`which $JOBLOG`' "Checkig $JOBLOG utility" || exit 1 - check_exec 'LOGEV=`which $LOGEV`' "Checkig $LOGEV utility" || exit 1 - check_exec 'USERJOBS=`which $USERJOBS`' "Checkig $USERJOBS utility" || exit 1 - check_exec 'JOBSTAT=`which $JOBSTAT`' "Checkig $JOBSTAT utility" || exit 1 -} - -log_ev() -{ -# $LOGEV -j $EDG_JOBID -s NetworkServer -n $1 -e UserTag --name color --value red - [ $DEBUG -gt 2 ] && echo "$LOGEV -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -log_ev_proxy() -{ -# $LOGEV -x -j $EDG_JOBID -s NetworkServer -n $1 -e UserTag --name color --value red - - [ $DEBUG -gt 2 ] && echo "$LOGEV -x -j \"$EDG_JOBID\" -s UserInterface -c \"$EDG_WL_SEQUENCE\" $@" - EDG_WL_SEQUENCE=`$LOGEV -x $LARGE_STRESS -j $EDG_JOBID -s UserInterface -c $EDG_WL_SEQUENCE "$@"` - test $? -ne 0 -o -z "$EDG_WL_SEQUENCE" && echo "missing EDG_WL_SEQUENCE from $LOGEV" -} - -purge() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -a 0 -c 0 -n 0 -o 0 "$@" -} - -purge_proxy() -{ - [ $DEBUG -gt 2 ] && echo "$PURGE -x -a 0 -c 0 -n 0 -o 0 $@" - $PURGE -x -a 0 -c 0 -n 0 -o 0 "$@" -} - - -db_clear_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Purging test jobs from db\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - LARGE_STRESS="" - EDG_WL_SEQUENCE="UI=999999:NS=9999999999:WM=999999:BH=9999999999:JSS=999999:LM=999999:LRMS=999999:APP=999999" -# log_ev_proxy -e Clear --reason=PurgingDB -# purge_proxy -# log_ev -e Clear --reason=PurgingDB -# purge - - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" -} - -# Test thet registers jobs -# and checks against lbproxy and bkserver -# -test_gen_sample_jobs() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Registering sample jobs\t\t\t" - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# eval `$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1 | tail -n 2` - get_time - start=$time - [ $? -ne 0 ] && echo -e "ERROR\n\t$JOBREG error!" - if [[ -z $SUBJOBS ]] ; then - TMP=`$JOBREG -x -m $BKSERVER_HOST -s UserInterface 2>&1` - get_time - eval `echo "$TMP" | tail -n 2` - else - TMP=`$JOBREG -x -m $BKSERVER_HOST -s UserInterface -n $SUBJOBS 2>&1` - get_time - eval `echo "$TMP" | grep DAG_JOBID` - EDG_JOBID=$EDG_WL_DAG_JOBID - fi - if test -z "$EDG_JOBID" ; then - echo "test_gen_sample_jobs: $JOBREG failed" - else - SAMPLE_JOBS_ARRAY[$job]=$EDG_JOBID - response=`echo "scale=9; ($time - $start)/1000000000"|bc` - SAMPLE_JOBS_RESPONSES[$job]=$response - fi - -# state=`$JOBSTAT $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK $EDG_JOBID 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# if test "$state" != "submitted" ; then -# echo -e "ERROR\n\tjob ${SAMPLE_JOBS_ARRAY[$job]} not submitted succesfully!" -# fi -# if test "$state" != "$proxy_state" ; then -# echo -e "ERROR\n\tjob (${SAMPLE_JOBS_ARRAY[$job]}) records on lbproxy and bkserver differs!" -# fi -# SAMPLE_JOBS_STATES[$job]=$state - echo -n "." - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" - [ $DEBUG -gt 1 ] && { - job=0 - total=0 -# echo "Registration took for individual jobs the following time" - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - total=`echo "scale=9; $total + ${SAMPLE_JOBS_RESPONSES[$job]}" |bc` -# echo -e "${SAMPLE_JOBS_ARRAY[$job]} \t${SAMPLE_JOBS_RESPONSES[$job]} seconds" - job=$(($job + 1)) - done - echo "Registration results:" - echo -e "Total time for $JOBS_ARRAY_SIZE jobs with $SUBJOBS subjobs: \t$total" - echo -e -n "Average time for registration: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE / $SUBJOBS"|bc - echo -e -n "Registration throughput (jobs/sec): \t" - echo "scale=9; $SUBJOBS * $JOBS_ARRAY_SIZE / $total"|bc - - } -# [ $DEBUG -gt 1 ] && { -# job=0 -# while [ $job -lt $JOBS_ARRAY_SIZE ] ; do -# echo ${SAMPLE_JOBS_ARRAY[$job]} -# job=$(($job + 1)) -# done -# } -} - -# Test that logs random set of events (for registered jobs) to lbproxy -# and checks the state in lbproxy -# and measures the time it takes the state to propagate to bkserver -# -test_logging_events() -{ - [ $DEBUG -gt 0 ] && echo -n -e "Logging events to the lbproxy\t\t" - st_count=`echo $STATES | wc -w` - job=0 - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - echo -n "." - if test -z "${SAMPLE_JOBS_ARRAY[$job]}" ; then - job=$(($job + 1)) - continue - fi -# tmp=`echo $RANDOM % $st_count + 1 | bc` -# state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - get_time - start=$time - -# source glite-lb-$state.sh $LARGE_STRESS -X $TEST_LBPROXY_STORE_SOCK -m $BKSERVER_HOST -j ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 1>/dev/null -# [ $? -ne 0 ] && echo -e "ERROR\n\tglite-lb-$state.sh ${SAMPLE_JOBS_ARRAY[$job]} error!" - log_ev_proxy -n 100 -e UserTag --tag=color --value=red - -# proxy_state=`$JOBSTAT -x $TEST_LBPROXY_SERVE_SOCK ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# purged=`echo $LBPROXY_PURGE_STATES | grep $state` -# bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# -# if test -n "$purged" ; then -# echo $proxy_state | grep "No such file or directory" -# if test $? -eq 0 ; then -# echo -e "ERROR\n\tJob ${SAMPLE_JOBS_ARRAY[$job]} was not purged out from LBProxy!" -# exit 1; -# fi -# fi -# if test -z "$purged" ; then -# if test "$state" != "$proxy_state" ; then -# echo -e "ERROR\n\tevents for job ${SAMPLE_JOBS_ARRAY[$job]} were not logged succesfully!" -# exit 1; -# fi -# fi - -# response=0 -# while [ "$state" != "$bkserver_state" ] ; do -# bkserver_state=`$JOBSTAT ${SAMPLE_JOBS_ARRAY[$job]} 2>&1 | grep "state :" | cut -d " " -f 3 | tr A-Z a-z` -# [ $DEBUG -gt 0 ] && echo -n "." -# sleep $timeout -# response=$(($response + $timeout )) -# if test $response -gt $maxtimeout ; then -# echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job]} as queried from bkserver ($bkserver_state) has not become $state for more than $response seconds!" -# exit 1; -# fi -# done -# -# SAMPLE_JOBS_STATES[$job]=$state - get_time - response=`echo "scale=9; ($time - $start)/1000000000"|bc` - SAMPLE_JOBS_RESPONSES[$job]=$response - job=$(($job + 1)) - done - [ $DEBUG -gt 0 ] && echo "OK" - [ $DEBUG -gt 1 ] && { - job=0 - total=0 -# echo "Sending events took for individual jobs the following time" - while [ $job -lt $JOBS_ARRAY_SIZE ] ; do - total=`echo "scale=9; $total + ${SAMPLE_JOBS_RESPONSES[$job]}" |bc` -# echo -e "${SAMPLE_JOBS_ARRAY[$job]} \t${SAMPLE_JOBS_RESPONSES[$job]} seconds" - job=$(($job + 1)) - done - echo -e "Total time for $JOBS_ARRAY_SIZE jobs: \t$total" - echo -e -n "Average time for job: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE"|bc - echo -e -n "Job throughput (jobs/sec): \t" - echo "scale=9; $JOBS_ARRAY_SIZE / $total"|bc - - } -} - - -# -# shell starting code - -# without parameters show help message -# test -z "$1" && show_help - -while test -n "$1" -do - case "$1" in - "-h" | "--help") show_help && exit 0 ;; - "-x" | "--proxy-sockpath-pref") - shift - export TEST_LBPROXY_STORE_SOCK=$1store.sock - export TEST_LBPROXY_SERVE_SOCK=$1serve.sock - ;; - "-m" | "--bkserver") shift ; BKSERVER_HOST=$1 ;; - "-j" | "--jobs-count") shift; JOBS_ARRAY_SIZE=$1 ;; - "-n" | "--subjobs") shift; SUBJOBS="$1" ;; - "-s" | "--states") shift; STATES="$1" ;; - "-p" | "--proxy-purge-states") shift; LBPROXY_PURGE_STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; - "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1" ;; - - esac - shift -done - -if test -n "$logfile" ; then - LOGFD=3 - exec 3>$logfile -fi - - -echo "STATES = $STATES" -echo "LBPROXY_PURGE_STATES = $LBPROXY_PURGE_STATES" - -check_utils - -test_gen_sample_jobs -#test_logging_events - -db_clear_jobs diff --git a/org.glite.lb.proxy/project/build.number b/org.glite.lb.proxy/project/build.number deleted file mode 100644 index 4c4eb57..0000000 --- a/org.glite.lb.proxy/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Fri Aug 18 12:34:06 CEST 2006 -module.build=0100 diff --git a/org.glite.lb.proxy/project/build.properties b/org.glite.lb.proxy/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.lb.proxy/project/configure.properties.xml b/org.glite.lb.proxy/project/configure.properties.xml deleted file mode 100644 index dec83a3..0000000 --- a/org.glite.lb.proxy/project/configure.properties.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -expat_prefix=${with.expat.prefix} -mysql_prefix=${with.mysql.prefix} -mysql_version=${ext.mysql.version} -gridsite_prefix=${with.gridsite.prefix} -gsoap_prefix=${with.gsoap.prefix} -cppunit_prefix=${with.cppunit.prefix} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} - - - diff --git a/org.glite.lb.proxy/project/properties.xml b/org.glite.lb.proxy/project/properties.xml deleted file mode 100755 index 3bc980c..0000000 --- a/org.glite.lb.proxy/project/properties.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb.proxy/project/tar_exclude b/org.glite.lb.proxy/project/tar_exclude deleted file mode 100644 index b3133e4..0000000 --- a/org.glite.lb.proxy/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure-options.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.lb.proxy/project/version.properties b/org.glite.lb.proxy/project/version.properties deleted file mode 100644 index 02f9404..0000000 --- a/org.glite.lb.proxy/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Sep 02 14:18:53 CEST 2005 -module.version=1.4.1 -module.age=3 diff --git a/org.glite.lb.proxy/src/fake_write2rgma.c b/org.glite.lb.proxy/src/fake_write2rgma.c deleted file mode 100755 index 4f49a05..0000000 --- a/org.glite.lb.proxy/src/fake_write2rgma.c +++ /dev/null @@ -1,21 +0,0 @@ -#ident "$Header$" - -#include - -#include "glite/lb/jobstat.h" - -char* write2rgma_statline(edg_wll_JobStat *stat) -{ - fputs("fake write2rgma_statline()\n",stderr); - return NULL; -} - -void write2rgma_status(edg_wll_JobStat *stat) -{ - fputs("fake write2rgma_statline()\n",stderr); -} - -void write2rgma_chgstatus(edg_wll_JobStat *stat, char *prev_statline) -{ - fputs("fake write2rgma_chgstatus()\n",stderr); -} diff --git a/org.glite.lb.proxy/src/lbproxy.c b/org.glite.lb.proxy/src/lbproxy.c deleted file mode 100644 index ba563b5..0000000 --- a/org.glite.lb.proxy/src/lbproxy.c +++ /dev/null @@ -1,652 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glite/lb/srvbones.h" -#include "glite/lb/context.h" -#include "glite/lb/context-int.h" -#ifdef LB_PERF -#include "glite/lb/lb_perftest.h" -#include "glite/lb/srv_perf.h" - -enum lb_srv_perf_sink sink_mode; -#endif - -extern int edg_wll_DBCheckVersion(edg_wll_Context, const char *); -extern edg_wll_ErrorCode edg_wll_Open(edg_wll_Context ctx, char *cs); -extern edg_wll_ErrorCode edg_wll_Close(edg_wll_Context); -extern int edg_wll_StoreProtoProxy(edg_wll_Context ctx); -extern int edg_wll_ServerHTTP(edg_wll_Context ctx); - -extern char *lbproxy_ilog_socket_path; -extern char *lbproxy_ilog_file_prefix; - - -#define DEFAULTCS "lbserver/@localhost:lbproxy" - -#define CON_QUEUE 20 /* accept() */ -#define SLAVE_OVERLOAD 10 /* queue items per slave */ -#define IDLE_TIMEOUT 10 /* keep idle connection that many seconds */ -#define REQUEST_TIMEOUT 120 /* one client may ask one slave multiple times */ -#define SLAVE_CONNS_MAX 500 /* commit suicide after that many connections */ - -/* file to store pid and generate semaphores key - */ -#ifndef GLITE_LBPROXY_PIDFILE -#define GLITE_LBPROXY_PIDFILE "/var/run/glite-lbproxy.pid" -#endif - -#ifndef GLITE_LBPROXY_SOCK_PREFIX -#define GLITE_LBPROXY_SOCK_PREFIX "/tmp/lb_proxy_" -#endif - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; } -#endif - -#define sizofa(a) (sizeof(a)/sizeof((a)[0])) - - -int debug = 0; -static const int one = 1; -static char *dbstring = NULL; -static char sock_store[PATH_MAX], - sock_serve[PATH_MAX]; -static int slaves = 10, - semaphores = -1, - con_queue = CON_QUEUE, - semset; -static char host[300]; -static char * port; -int transactions = -1; -int use_dbcaps = 0; - - -static struct option opts[] = { - {"port", 1, NULL, 'p'}, - {"con-queue", 1, NULL, 'c'}, - {"debug", 0, NULL, 'd'}, - {"silent", 0, NULL, 'z'}, - {"mysql", 1, NULL, 'm'}, - {"slaves", 1, NULL, 's'}, - {"semaphores", 1, NULL, 'l'}, - {"pidfile", 1, NULL, 'i'}, - {"proxy-il-sock", 1, NULL, 'X'}, - {"proxy-il-fprefix", 1, NULL, 'Y'}, -#ifdef LB_PERF - {"perf-sink", 1, NULL, 'K'}, -#endif - {"transactions", 1, NULL, 'b'}, - {NULL,0,NULL,0} -}; - -static const char *get_opt_string = "p:c:dm:s:l:i:X:Y:zb:" -#ifdef LB_PERF - "K:" -#endif -; - -static void usage(char *me) -{ - fprintf(stderr,"usage: %s [option]\n" - "\t-p, --sock\t\t path-name to the local socket\n" - "\t-c, --con-queue\t\t size of the connection queue (accept)\n" - "\t-m, --mysql\t\t database connect string\n" - "\t-d, --debug\t\t don't run as daemon, additional diagnostics\n" - "\t-s, --slaves\t\t number of slave servers to fork\n" - "\t-l, --semaphores\t number of semaphores (job locks) to use\n" - "\t-i, --pidfile\t\t file to store master pid\n" - "\t-X, --proxy-il-sock\t socket to send events to\n" - "\t-Y, --proxy-il-fprefix\t file prefix for events\n" - "\t-z, --silent\t\t don't print diagnostic, even if -d is on\n" -#ifdef LB_PERF - "\t-K, --perf-sink\t where to sink events\n" -#endif - "\t-b, --transactions\t transactions force switch\n" - ,me); -} - -static void wait_for_open(edg_wll_Context,const char *); -static int decrement_timeout(struct timeval *, struct timeval, struct timeval); - - - -/* - * SERVER BONES structures and handlers - */ -int clnt_data_init(void **); - - /* - * Serve & Store handlers - */ -int clnt_reject(int); -int handle_conn(int, struct timeval *, void *); -int accept_serve(int, struct timeval *, void *); -int accept_store(int, struct timeval *, void *); -int clnt_disconnect(int, struct timeval *, void *); - -#define SRV_SERVE 0 -#define SRV_STORE 1 -static struct glite_srvbones_service service_table[] = { - { "serve", -1, handle_conn, accept_serve, clnt_reject, clnt_disconnect }, - { "store", -1, handle_conn, accept_store, clnt_reject, clnt_disconnect }, -}; - -struct clnt_data_t { - edg_wll_Context ctx; - glite_lbu_DBContext dbctx; - int dbcaps; -}; - - - -int main(int argc, char *argv[]) -{ - int i; - struct sockaddr_un a; - int opt; - char pidfile[PATH_MAX] = GLITE_LBPROXY_PIDFILE, - socket_path_prefix[PATH_MAX] = GLITE_LBPROXY_SOCK_PREFIX, - *name; - FILE *fpid; - key_t semkey; - edg_wll_Context ctx; - struct timeval to; - int silent = 0; - - - name = strrchr(argv[0],'/'); - if (name) name++; else name = argv[0]; - - if (geteuid()) snprintf(pidfile,sizeof pidfile,"%s/glite_lb_proxy.pid", getenv("HOME")); - - while ((opt = getopt_long(argc, argv, get_opt_string, opts, NULL)) != EOF) switch (opt) { - case 'p': strcpy(socket_path_prefix, optarg); break; - case 'b': transactions = atoi(optarg); break; - case 'c': con_queue = atoi(optarg); break; - case 'd': debug = 1; break; - case 'z': silent = 1; break; - case 'm': dbstring = optarg; break; - case 's': slaves = atoi(optarg); break; - case 'l': semaphores = atoi(optarg); break; - case 'X': lbproxy_ilog_socket_path = strdup(optarg); break; - case 'Y': lbproxy_ilog_file_prefix = strdup(optarg); break; - case 'i': strcpy(pidfile, optarg); break; -#ifdef LB_PERF - case 'K': sink_mode = atoi(optarg); break; -#endif - case '?': usage(name); return 1; - } - - if ( optind < argc ) { usage(name); return 1; } - - setlinebuf(stdout); - setlinebuf(stderr); - - fpid = fopen(pidfile,"r"); - if ( fpid ) { - int opid = -1; - - if ( fscanf(fpid,"%d",&opid) == 1 ) { - if ( !kill(opid,0) ) { - fprintf(stderr,"%s: another instance running, pid = %d\n",name,opid); - return 1; - } - else if (errno != ESRCH) { perror("kill()"); return 1; } - } - fclose(fpid); - } else if (errno != ENOENT) { perror(pidfile); return 1; } - - fpid = fopen(pidfile, "w"); - if ( !fpid ) { perror(pidfile); return 1; } - if (fprintf(fpid, "%d", getpid()) <= 0) { perror(pidfile); return 1; } - if (fclose(fpid) != 0) { perror(pidfile); return 1; } - - semkey = ftok(pidfile,0); - - if ( semaphores == -1 ) semaphores = slaves; - semset = semget(semkey, 0, 0); - if ( semset >= 0 ) semctl(semset, 0, IPC_RMID); - semset = semget(semkey, semaphores, IPC_CREAT | 0600); - if ( semset < 0 ) { perror("semget()"); return 1; } - dprintf(("Using %d semaphores, set id %d\n", semaphores, semset)); - for ( i = 0; i < semaphores; i++ ) { - struct sembuf s; - - s.sem_num = i; s.sem_op = 1; s.sem_flg = 0; - if (semop(semset,&s,1) == -1) { perror("semop()"); return 1; } - } - - gethostname(host, sizeof host); - host[sizeof host - 1] = 0; - asprintf(&port, "%d", GLITE_JOBID_DEFAULT_PORT); - dprintf(("server address: %s:%s\n", host, port)); - - service_table[SRV_SERVE].conn = socket(PF_UNIX, SOCK_STREAM, 0); - if ( service_table[SRV_SERVE].conn < 0 ) { perror("socket()"); return 1; } - memset(&a, 0, sizeof(a)); - a.sun_family = AF_UNIX; - sprintf(sock_serve, "%s%s", socket_path_prefix, "serve.sock"); - strcpy(a.sun_path, sock_serve); - - if( connect(service_table[SRV_SERVE].conn, (struct sockaddr *)&a, sizeof(a.sun_path)) < 0) { - if( errno == ECONNREFUSED ) { - dprintf(("removing stale input socket %s\n", sock_serve)); - unlink(sock_serve); - } - } else { perror("another instance of lb-proxy is running"); return 1; } - - if ( bind(service_table[SRV_SERVE].conn, (struct sockaddr *) &a, sizeof(a)) < 0 ) { - char buf[100]; - - snprintf(buf, sizeof(buf), "bind(%s)", sock_serve); - perror(buf); - return 1; - } - - if ( listen(service_table[SRV_SERVE].conn, con_queue) ) { perror("listen()"); return 1; } - - service_table[SRV_STORE].conn = socket(PF_UNIX, SOCK_STREAM, 0); - if ( service_table[SRV_STORE].conn < 0 ) { perror("socket()"); return 1; } - memset(&a, 0, sizeof(a)); - a.sun_family = AF_UNIX; - sprintf(sock_store, "%s%s", socket_path_prefix, "store.sock"); - strcpy(a.sun_path, sock_store); - - if( connect(service_table[SRV_STORE].conn, (struct sockaddr *)&a, sizeof(a.sun_path)) < 0) { - if( errno == ECONNREFUSED ) { - dprintf(("removing stale input socket %s\n", sock_store)); - unlink(sock_store); - } - } else { perror("another instance of lb-proxy is running"); return 1; } - - if ( bind(service_table[SRV_STORE].conn, (struct sockaddr *) &a, sizeof(a))) { - char buf[100]; - - snprintf(buf, sizeof(buf), "bind(%s)", sock_store); - perror(buf); - return 1; - } - if ( listen(service_table[SRV_STORE].conn, con_queue) ) { perror("listen()"); return 1; } - - dprintf(("Listening at %s, %s ...\n", sock_store, sock_serve)); - - if (!dbstring) dbstring = getenv("LBPROXYDB"); - if (!dbstring) dbstring = DEFAULTCS; - - - /* Just check the database and let it be. The slaves do the job. */ - edg_wll_InitContext(&ctx); - /* XXX: obsolete - * edg_wll_InitContext(&ctx) used to cause segfault - if ( !(ctx = (edg_wll_Context) malloc(sizeof(*ctx))) ) { - perror("InitContext()"); - return -1; - } - memset(ctx, 0, sizeof(*ctx)); - */ - wait_for_open(ctx, dbstring); - if ((ctx->dbcaps = glite_lbu_DBQueryCaps(ctx->dbctx)) == -1) - { - char *et,*ed; - glite_lbu_DBError(ctx->dbctx,&et,&ed); - - fprintf(stderr,"%s: open database: %s (%s)\n",argv[0],et,ed); - free(et); free(ed); - return 1; - } - edg_wll_Close(ctx); - ctx->dbctx = NULL; - fprintf(stderr, "[%d]: DB '%s'\n", getpid(), dbstring); - - if ((ctx->dbcaps & GLITE_LBU_DB_CAP_INDEX) == 0) { - fprintf(stderr,"%s: missing index support in DB layer\n",argv[0]); - return 1; - } - if ((ctx->dbcaps & GLITE_LBU_DB_CAP_TRANSACTIONS) == 0) - fprintf(stderr, "[%d]: transactions aren't supported!\n", getpid()); - if (transactions >= 0) { - fprintf(stderr, "[%d]: transactions forced from %d to %d\n", getpid(), ctx->dbcaps & GLITE_LBU_DB_CAP_TRANSACTIONS ? 1 : 0, transactions); - ctx->dbcaps &= ~GLITE_LBU_DB_CAP_TRANSACTIONS; - ctx->dbcaps |= transactions ? GLITE_LBU_DB_CAP_TRANSACTIONS : 0; - } - use_dbcaps = ctx->dbcaps; - edg_wll_FreeContext(ctx); - - if ( !debug ) { - if ( daemon(1,0) == -1 ) { perror("deamon()"); exit(1); } - - fpid = fopen(pidfile,"w"); - if ( !fpid ) { perror(pidfile); return 1; } - fprintf(fpid, "%d", getpid()); - fclose(fpid); - openlog(name, LOG_PID, LOG_DAEMON); - } else { setpgid(0, getpid()); } - - if (silent) debug = 0; - - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, slaves); - glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_OVERLOAD, SLAVE_OVERLOAD); - glite_srvbones_set_param(GLITE_SBPARAM_SLAVE_CONNS_MAX, SLAVE_CONNS_MAX); - to = (struct timeval){REQUEST_TIMEOUT, 0}; - glite_srvbones_set_param(GLITE_SBPARAM_REQUEST_TIMEOUT, &to); - to = (struct timeval){IDLE_TIMEOUT, 0}; - glite_srvbones_set_param(GLITE_SBPARAM_IDLE_TIMEOUT, &to); - - glite_srvbones_run(clnt_data_init, service_table, sizofa(service_table), debug); - - semctl(semset, 0, IPC_RMID, 0); - unlink(pidfile); - for ( i = 0; i < sizofa(service_table); i++ ) - if ( service_table[i].conn >= 0 ) close(service_table[i].conn); - unlink(sock_serve); - unlink(sock_store); - if (port) free(port); - - return 0; -} - - -int clnt_data_init(void **data) -{ - edg_wll_Context ctx; - struct clnt_data_t *cdata; - - - if ( !(cdata = calloc(1, sizeof(*cdata))) ) - return -1; - - if ( !(ctx = (edg_wll_Context) malloc(sizeof(*ctx))) ) { free(cdata); return -1; } - memset(ctx, 0, sizeof(*ctx)); - - dprintf(("[%d] opening database ...\n", getpid())); - wait_for_open(ctx, dbstring); - cdata->dbctx = ctx->dbctx; - cdata->dbcaps = use_dbcaps; - edg_wll_FreeContext(ctx); - -#ifdef LB_PERF - glite_wll_perftest_init(NULL, NULL, NULL, NULL, 0); -#endif - - *data = cdata; - return 0; -} - - -int handle_conn(int conn, struct timeval *timeout, void *data) -{ - struct clnt_data_t *cdata = (struct clnt_data_t *)data; - edg_wll_Context ctx; - struct timeval conn_start, now; - - if ( edg_wll_InitContext(&ctx) ) { - dprintf(("Couldn't create context")); - return -1; - } - cdata->ctx = ctx; - - /* Shared structures (pointers) - */ - ctx->dbctx = cdata->dbctx; - ctx->dbcaps = cdata->dbcaps; - - /* set globals - */ - ctx->allowAnonymous = 1; - ctx->isProxy = 1; - ctx->noAuth = 1; - ctx->noIndex = 1; - ctx->semset = semset; - ctx->semaphores = semaphores; - - ctx->srvName = strdup(host); - ctx->srvPort = atoi(port); - - ctx->connProxy = (edg_wll_ConnProxy *) calloc(1, sizeof(edg_wll_ConnProxy)); - if ( !ctx->connProxy ) { - perror("calloc"); - edg_wll_FreeContext(ctx); - - return -1; - } - - gettimeofday(&conn_start, 0); - if ( edg_wll_plain_accept(conn, &ctx->connProxy->conn) ) { - perror("accept"); - edg_wll_FreeContext(ctx); - - return -1; - } - - gettimeofday(&now, 0); - if ( decrement_timeout(timeout, conn_start, now) ) { - if (debug) fprintf(stderr, "edg_wll_plain_accept() timeout"); - else syslog(LOG_ERR, "edg_wll_plain_accept(): timeout"); - - return -1; - } - - - return 0; -} - - -int accept_store(int conn, struct timeval *timeout, void *cdata) -{ - edg_wll_Context ctx = ((struct clnt_data_t *) cdata)->ctx; - struct timeval before, after; - char *errt, *errd; - int err; - - memcpy(&ctx->p_tmp_timeout, timeout, sizeof(ctx->p_tmp_timeout)); - gettimeofday(&before, NULL); - errt = errd = NULL; - if ( edg_wll_StoreProtoProxy(ctx) ) { - switch ( (err = edg_wll_Error(ctx, &errt, &errd)) ) { - case ETIMEDOUT: - case EPIPE: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if (!debug) syslog(LOG_ERR,"%s (%s)", errt, errd); - /* fallthrough - */ - case ENOTCONN: - free(errt); free(errd); - return err; - break; - - case ENOENT: - case EINVAL: - case EPERM: - case EEXIST: - case EDG_WLL_ERROR_NOINDEX: - case E2BIG: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if ( !debug ) syslog(LOG_ERR, "%s (%s)", errt, errd); - break; - - default: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if ( !debug ) syslog(LOG_CRIT, "%s (%s)", errt, errd); - return -1; - } - free(errt); free(errd); - } else if ( edg_wll_Error(ctx, &errt, &errd) ) { - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if ( !debug ) syslog(LOG_ERR, "%s (%s)", errt, errd); - free(errt); free(errd); - edg_wll_ResetError(ctx); - } - gettimeofday(&after, NULL); - if ( decrement_timeout(timeout, before, after) ) { - if (debug) fprintf(stderr, "Serving store connection timed out"); - else syslog(LOG_ERR, "Serving store connection timed out"); - return ETIMEDOUT; - } - - return 0; -} - -int accept_serve(int conn, struct timeval *timeout, void *cdata) -{ - edg_wll_Context ctx = ((struct clnt_data_t *) cdata)->ctx; - struct timeval before, after; - - - /* - * serve the request - */ - memcpy(&ctx->p_tmp_timeout, timeout, sizeof(ctx->p_tmp_timeout)); - gettimeofday(&before, NULL); - if ( edg_wll_ServerHTTP(ctx) ) { - char *errt, *errd; - int err; - - - errt = errd = NULL; - switch ( (err = edg_wll_Error(ctx, &errt, &errd)) ) { - case ETIMEDOUT: - case EPIPE: - case EIO: - case EDG_WLL_IL_PROTO: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if (!debug) syslog(LOG_ERR,"%s (%s)", errt, errd); - /* fallthrough - */ - case ENOTCONN: - free(errt); free(errd); - return err; - break; - - case ENOENT: - case EPERM: - case EEXIST: - case EDG_WLL_ERROR_NOINDEX: - case E2BIG: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - break; - case EINVAL: - case EDG_WLL_ERROR_PARSE_BROKEN_ULM: - case EDG_WLL_ERROR_PARSE_EVENT_UNDEF: - case EDG_WLL_ERROR_PARSE_MSG_INCOMPLETE: - case EDG_WLL_ERROR_PARSE_KEY_DUPLICITY: - case EDG_WLL_ERROR_PARSE_KEY_MISUSE: - case EDG_WLL_ERROR_PARSE_OK_WITH_EXTRA_FIELDS: - case EDG_WLL_ERROR_JOBID_FORMAT: - case EDG_WLL_ERROR_MD5_CLASH: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if ( !debug ) syslog(LOG_ERR,"%s (%s)", errt, errd); - /* - * no action for non-fatal errors - */ - break; - - case EDG_WLL_ERROR_DB_CALL: - case EDG_WLL_ERROR_SERVER_RESPONSE: - default: - dprintf(("[%d] %s (%s)\n", getpid(), errt, errd)); - if (!debug) syslog(LOG_CRIT,"%s (%s)",errt,errd); - /* - * unknown error - do rather return (<0) (slave will be killed) - */ - return -1; - } - free(errt); free(errd); - } - gettimeofday(&after, NULL); - if ( decrement_timeout(timeout, before, after) ) { - if (debug) fprintf(stderr, "Serving store connection timed out"); - else syslog(LOG_ERR, "Serving store connection timed out"); - return ETIMEDOUT; - } - - return 0; -} - - -int clnt_disconnect(int conn, struct timeval *timeout, void *cdata) -{ - edg_wll_Context ctx = ((struct clnt_data_t *) cdata)->ctx; - - /* XXX: handle the timeout - */ - if ( ctx->connProxy && ctx->connProxy->conn.sock >= 0 ) - edg_wll_plain_close(&ctx->connProxy->conn); - - edg_wll_FreeContext(ctx); - ctx = NULL; - - return 0; -} - -int clnt_reject(int conn) -{ - return 0; -} - -static void wait_for_open(edg_wll_Context ctx, const char *dbstring) -{ - char *dbfail_string1, *dbfail_string2; - - dbfail_string1 = dbfail_string2 = NULL; - - while (edg_wll_Open(ctx, (char *) dbstring)) { - char *errt,*errd; - - if (dbfail_string1) free(dbfail_string1); - glite_lbu_DBError(ctx->dbctx,&errt,&errd); - asprintf(&dbfail_string1,"%s (%s)\n",errt,errd); - if (dbfail_string1 != NULL) { - if (dbfail_string2 == NULL || strcmp(dbfail_string1,dbfail_string2)) { - if (dbfail_string2) free(dbfail_string2); - dbfail_string2 = dbfail_string1; - dbfail_string1 = NULL; - dprintf(("[%d]: %s\nStill trying ...\n",getpid(),dbfail_string2)); - if (!debug) syslog(LOG_ERR,dbfail_string2); - } - } - sleep(5); - } - - if (dbfail_string1) free(dbfail_string1); - if (dbfail_string2 != NULL) { - free(dbfail_string2); - dprintf(("[%d]: DB connection established\n",getpid())); - if (!debug) syslog(LOG_INFO,"DB connection established\n"); - } -} - -static int decrement_timeout(struct timeval *timeout, struct timeval before, struct timeval after) -{ - (*timeout).tv_sec = (*timeout).tv_sec - (after.tv_sec - before.tv_sec); - (*timeout).tv_usec = (*timeout).tv_usec - (after.tv_usec - before.tv_usec); - while ( (*timeout).tv_usec < 0) { - (*timeout).tv_sec--; - (*timeout).tv_usec += 1000000; - } - if ( ((*timeout).tv_sec < 0) || (((*timeout).tv_sec == 0) && ((*timeout).tv_usec == 0)) ) return(1); - else return(0); -} - diff --git a/org.glite.lb.proxy/src/perftest_proxy.sh b/org.glite.lb.proxy/src/perftest_proxy.sh deleted file mode 100755 index 96d5094..0000000 --- a/org.glite.lb.proxy/src/perftest_proxy.sh +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/bash - -numjobs=10 - -# XXX - there must be better way to find stage -STAGEDIR=/home/michal/shared/egee/jra1-head/stage -. $STAGEDIR/sbin/perftest_common.sh - -LOGEVENT=${LOGEVENT:-$STAGEDIR/bin/glite-lb-logevent} - -DEBUG=${DEBUG:-0} - -SILENT=0 -while getopts "t:n:s" OPTION -do - case "$OPTION" in - "t") TEST_VARIANT=$OPTARG - ;; - - "n") numjobs=$OPTARG - ;; - - "s") SILENT=1 - ;; - - esac -done - -# CONSUMER_ARGS= -# PERFTEST_COMPONENT= -# COMPONENT_ARGS= -#LOGJOBS_ARGS="" - -check_test_files || exit 1 -check_file_executable $LOGEVENT || exit 1 - -SEQCODE="UI=999990:NS=9999999990:WM=999990:BH=9999999990:JSS=999990:LM=999990:LRMS=999990:APP=999990" - -purge_proxy () -{ - for jobid in $@ - do - $LOGEVENT -x -S /tmp/proxy.perfstore.sock -c $SEQCODE -j $jobid -s UserInterface -e Abort --reason Purge > /dev/null 2>&1 - done -} - -group_a () { -echo "----------------------------------" -echo "LB Proxy test" -echo "----------------------------------" -echo "Events are consumed:" -echo "1) before parsing" -echo "2) after parsing, before storing into database" -echo "3) after storing into db, before computing state" -echo "4) after computing state, before sending to IL" -echo "5) by IL" -echo "" -LOGJOBS_ARGS="-s /tmp/proxy.perf" -} - -echo -e "\tavg_job \t big_job \t avg_dag \t big_dag" - - -group_a_test_n () -{ - PERFTEST_CONSUMER=$STAGEDIR/bin/glite-lb-proxy - i=$1 - CONSUMER_ARGS="-d --perf-sink $i -p /tmp/proxy.perf" - export PERFTEST_NAME="proxy_test_$i" - echo -n "${i})" - run_test proxy $numjobs - print_result - # purge jobs from database - # we have to start proxy again - $PERFTEST_CONSUMER -d -p /tmp/proxy.perf -s 1 >/dev/null 2>&1 & - PID=$! - purge_proxy `$LOGJOBS -n $numjobs` - sleep 2 - shutdown $PID -} - -group_a_test_5 () -{ - PERFTEST_COMPONENT="$STAGEDIR/bin/glite-lb-proxy" - COMPONENT_ARGS="-d -p /tmp/proxy.perf --proxy-il-sock /tmp/interlogger.perf --proxy-il-fprefix /tmp/perftest.log" - - PERFTEST_CONSUMER="$STAGEDIR/bin/glite-lb-interlogd-perf-empty" - CONSUMER_ARGS="-d -s /tmp/interlogger.perf --file-prefix=/tmp/perftest.log" - export PERFTEST_NAME="proxy_test_5" - echo -n "5)" - run_test proxy $numjobs - print_result - $PERFTEST_COMPONENT -d -p /tmp/proxy.perf -s 1 >/dev/null 2>&1 & - PID=$! - purge_proxy `$LOGJOBS -n $numjobs` - sleep 2 - shutdown $PID - rm -f /tmp/perftest.log.* -} - -group="a" - -group_$group - -if [[ $SILENT -eq 0 ]] -then - while [[ -z $TEST_VARIANT ]] - do - echo -n "Your choice: " - read -e TEST_VARIANT - done - echo -e "\tavg_job \t big_job \t avg_dag \t big_dag" -fi - -if [[ "x$TEST_VARIANT" = "x*" ]] -then - TEST_VARIANT="1 2 3 4 5" -fi - -for variant in $TEST_VARIANT -do - if [[ "$variant" = "5" ]] - then - group_${group}_test_${variant} - else - group_${group}_test_n $variant - fi -done diff --git a/org.glite.lb.server-bones/.cvsignore b/org.glite.lb.server-bones/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.lb.server-bones/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.lb.server-bones/Makefile b/org.glite.lb.server-bones/Makefile deleted file mode 100644 index b1c1731..0000000 --- a/org.glite.lb.server-bones/Makefile +++ /dev/null @@ -1,81 +0,0 @@ -# defaults -top_srcdir=. -stagedir=. -globalprefix=glite -lbprefix=lb -package=glite-lb-server-bones -version=0.0.1 -PREFIX=/opt/glite - -CC=gcc - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -VPATH=${top_srcdir}/src:${top_srcdir}/examples - -DEBUG:=-g -O0 -Wall -CFLAGS:= ${DEBUG} -I${top_srcdir}/interface -LDFLAGS:= - -ifdef LB_PROF - CFLAGS:= ${CFLAGS} -pg -g - LDFLAGS:= ${LDFLAGS} -pg -endif - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -STATICLIB:=libglite_lbu_server_bones.a -LTLIB:=libglite_lbu_server_bones.la - -OBJS:=srvbones.o -LOBJS:=${OBJS:.o=.lo} - -HDRS:=srvbones.h - -default all: compile - -compile: ${STATICLIB} ${LTLIB} example - -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${LOBJS} - ${LINK} -o $@ ${LOBJS} - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -check: - -echo "No unit tests so far." - -example: srv_example cnt_example - -srv_example: srv_example.o - ${LINK} -o $@ ${LTLIB} srv_example.o - -cnt_example: cnt_example.o - ${LINK} -o $@ cnt_example.o - -doc: - -install: - mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix} - mkdir -p ${PREFIX}/lib - ${INSTALL} -m 644 ${LTLIB} ${PREFIX}/lib - if [ x${DOSTAGE} = xyes ]; then \ - ${INSTALL} -m 644 ${STATICLIB} ${PREFIX}/lib ; \ - cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbprefix} ; \ - fi - -clean: - rm -rvf *.o *.lo .libs lib* srv_example cnt_example - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ - -%.o: %.c - ${COMPILE} -c $< diff --git a/org.glite.lb.server-bones/build.xml b/org.glite.lb.server-bones/build.xml deleted file mode 100755 index 261ab6c..0000000 --- a/org.glite.lb.server-bones/build.xml +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb.server-bones/examples/cnt_example.c b/org.glite.lb.server-bones/examples/cnt_example.c deleted file mode 100644 index 80b6af3..0000000 --- a/org.glite.lb.server-bones/examples/cnt_example.c +++ /dev/null @@ -1,179 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; fflush(stdout); } -#endif - -#define DEF_MSG "Test message\n" -#define DEF_PORT 9999 - -static struct option opts[] = { - { "help", no_argument, NULL, 'h'}, - { "debug", no_argument, NULL, 'd'}, - { "msg", required_argument, NULL, 'm'}, - { "port", required_argument, NULL, 'p'}, - { "repeat", required_argument, NULL, 'r'}, -}; - -int debug = 0; -int port = DEF_PORT; -char *msg = NULL; - -static int writen(int fd, char *ptr, int nbytes); -static int readln(int fd, char *out); - -static void usage(char *me) -{ - fprintf(stderr, - "usage: %s [option]\n" - " -h, --help print this screen\n" - " -d, --debug prints debug messages\n" - " -m, --msg message to send\n" - " -p, --port service port\n", me); -} - - -int main(int argc, char **argv) -{ - struct sockaddr_in addr; - char buff[512], - *me; - int opt, - sock, - n; - int repeat = 1; - - me = strrchr(argv[0], '/'); - if ( me ) me++; else me = argv[0]; - while ( (opt = getopt_long(argc, argv,"p:m:hdr:", opts, NULL)) != EOF ) - { - switch ( opt ) - { - case 'm': - msg = strdup(optarg); - break; - case 'p': - port = atoi(optarg); - break; - case 'd': debug = 1; break; - case 'r': repeat = atoi(optarg); break; - case 'h': usage(me); return 0; - case '?': usage(me); return 1; - } - } - - bzero((char *) &addr, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - addr.sin_port = htons(port); - if ( (sock = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) - { - perror("socket"); - exit(1); - } - if ( connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0 ) - { - perror("connect"); - exit(1); - } - n = strlen(msg? msg: DEF_MSG); - for (;repeat; repeat--) { - if ( writen(sock, msg? msg: DEF_MSG, n) != n ) - { - dprintf(("error writing message\n")); - exit(1); - } - printf("reply: "); fflush(stdout); - n = readln(sock, buff); - if ( n < 0 ) - { - perror("read() reply error"); - return 1; - } - writen(0, buff, n); - } - close(sock); - - return 0; -} - -int writen(int fd, char *ptr, int nbytes) -{ - int nleft, nwritten; - - nleft = nbytes; - dprintf(("start writing %d bytes\n", nbytes)); - while ( nleft > 0 ) - { - nwritten = write(fd, ptr, nleft); - dprintf(("written %d bytes", nwritten)); - if ( nwritten <= 0 ) - return (nwritten); - - nleft -= nwritten; - ptr += nwritten; - dprintf((" (left %d bytes)\n", nleft)); - } - - dprintf(("written %d bytes (return: %d)\n", nwritten, nbytes - nleft)); - return (nbytes - nleft); -} - -#define BUFFER_SZ 512 - -int readln(int fd, char *out) -{ - static char buffer[BUFFER_SZ]; - static char *buffer_end = buffer; - int n; - - - dprintf(("reading line\n")); - while ( 1 ) { - if ( buffer_end - buffer ) { - /* buffer contains data - */ - char *endl; - - dprintf(("nonempty buffer\n")); - if ( (endl = memchr(buffer, '\n', buffer_end-buffer)) ) { - int linesz = endl-buffer+1; - - dprintf(("using buffer data\n")); - memcpy(out, buffer, linesz); - if ( endl+1 != buffer_end ) - memmove(buffer, endl+1, buffer_end-endl-1); - buffer_end -= linesz; - return linesz; - } - } - dprintf(("reading...\n")); - n = read(fd, buffer_end, BUFFER_SZ-(buffer_end-buffer)); - if ( n < 0 ) { - if ( errno == EAGAIN ) continue; - dprintf(("reading error\n")); - return n; - } - else if ( n == 0 ) { - int ret = buffer_end-buffer; - dprintf(("end of reading - returning %d bytes\n", ret)); - memcpy(out, buffer, ret); - buffer_end = buffer; - return ret; - } - - dprintf(("read %d bytes\n", n)); - buffer_end += n; - } - - return 0; -} diff --git a/org.glite.lb.server-bones/examples/srv_example.c b/org.glite.lb.server-bones/examples/srv_example.c deleted file mode 100644 index 0a19ab4..0000000 --- a/org.glite.lb.server-bones/examples/srv_example.c +++ /dev/null @@ -1,224 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "srvbones.h" - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; fflush(stdout); } -#endif - -#define sizofa(a) (sizeof(a)/sizeof((a)[0])) - -int debug = 1; - -static int writen(int fd, char *ptr, int nbytes); -static int readln(int fd, char *out, int nbytes); - -static int new_conn(int, struct timeval *, void *); -static int reject(int); -static int disconnect(int, struct timeval *, void *); - -static int echo(int, struct timeval *, void *); -static int upper_echo(int, struct timeval *, void *); - -#define ECHO_PORT 9999 -#define UPPER_ECHO_PORT 9998 - -#define SRV_ECHO 0 -#define SRV_UPPER_ECHO 1 - -static struct glite_srvbones_service service_table[] = { - { "Echo Service", -1, new_conn, echo, reject, disconnect }, - { "Upper Echo Service", -1, new_conn, upper_echo, reject, disconnect } -}; - -int main(void) -{ - struct sockaddr_in myaddr; - - - if ( ((service_table[SRV_ECHO].conn = socket(AF_INET, SOCK_STREAM, 0)) == -1) - || ((service_table[SRV_UPPER_ECHO].conn = socket(AF_INET, SOCK_STREAM, 0)) == -1) ) - { - perror("socket"); - exit(1); - } - - bzero((char *) &myaddr, sizeof(myaddr)); - myaddr.sin_family = AF_INET; - myaddr.sin_addr.s_addr = htonl(INADDR_ANY); - myaddr.sin_port = htons(ECHO_PORT); - if ( bind(service_table[SRV_ECHO].conn, (struct sockaddr *)&myaddr, sizeof(myaddr)) == -1 ) - { - perror("bind"); - exit(1); - } - bzero((char *) &myaddr, sizeof(myaddr)); - myaddr.sin_family = AF_INET; - myaddr.sin_addr.s_addr = htonl(INADDR_ANY); - myaddr.sin_port = htons(UPPER_ECHO_PORT); - if ( bind(service_table[SRV_UPPER_ECHO].conn, (struct sockaddr *)&myaddr, sizeof(myaddr)) == -1 ) - { - perror("bind"); - exit(1); - } - - if ( listen(service_table[SRV_ECHO].conn, 10) - || listen(service_table[SRV_UPPER_ECHO].conn, 10) ) - { - perror("listen()"); - exit(1); - } - - - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, 1); - glite_srvbones_run(NULL, service_table, sizofa(service_table), 1); - - - return 0; -} - -int upper_echo(int fd, struct timeval *to, void *data) -{ - int n, i; - char line[80]; - - n = readln(fd, line, 80); - if ( n < 0 ) - { - perror("read() message"); - return n; - } - else if ( n == 0 ) - return ENOTCONN; - - for ( i = 0; i < n; i++ ) - line[i] = toupper(line[i]); - - if ( writen(fd, line, n) != n ) - { - perror("write() message back"); - return -1; - } - - return 0; -} - -int echo(int fd, struct timeval *to, void *data) -{ - int n; - char line[80]; - - n = readln(fd, line, 80); - dprintf(("%d bytes read\n", n)); - if ( n < 0 ) - { - perror("read() message"); - return n; - } - else if ( n == 0 ) - return ENOTCONN; - - if ( writen(fd, line, n) != n ) - { - perror("write() message back"); - return -1; - } - - return 0; -} - -int new_conn(int conn, struct timeval *to, void *cdata) -{ - dprintf(("srv-bones example: new_conn handler\n")); - return 0; -} - -int reject(int conn) -{ - dprintf(("srv-bones example: reject handler\n")); - return 0; -} - -int disconnect(int conn, struct timeval *to, void *cdata) -{ - dprintf(("srv-bones example: disconnect handler\n")); - return 0; -} - -int writen(int fd, char *ptr, int nbytes) -{ - int nleft, nwritten; - - nleft = nbytes; - dprintf(("start writing %d bytes\n", nbytes)); - while ( nleft > 0 ) { - nwritten = write(fd, ptr, nleft); - dprintf(("written %d bytes", nwritten)); - if ( nwritten <= 0 ) - return (nwritten); - - nleft -= nwritten; - ptr += nwritten; - dprintf((" (left %d bytes)\n", nleft)); - } - - dprintf(("written %d bytes (return: %d)\n", nwritten, nbytes - nleft)); - return (nbytes - nleft); -} - -#define BUFFER_SZ 512 - -int readln(int fd, char *out, int nbytes) -{ - static char buffer[BUFFER_SZ]; - static char *buffer_end = buffer; - int n; - - - dprintf(("reading line\n")); - while ( 1 ) { - if ( buffer_end - buffer ) { - /* buffer contains data - */ - char *endl; - - dprintf(("nonempty buffer\n")); - if ( (endl = memchr(buffer, '\n', buffer_end-buffer)) ) { - int linesz = endl-buffer+1; - - memcpy(out, buffer, linesz); - if ( endl+1 != buffer_end ) memmove(buffer, endl+1, buffer_end-endl-1); - buffer_end -= linesz; - return linesz; - } - } - - dprintf(("reding...\n")); - n = read(fd, buffer_end, BUFFER_SZ-(buffer_end-buffer)); - if ( n < 0 ) { - if ( errno == EAGAIN ) n = 0; - else return n; - } - if ( n == 0 ) { - int ret = buffer_end-buffer; - dprintf(("end of reading - returning %d bytes\n", ret)); - memcpy(out, buffer, ret); - buffer_end = buffer; - return ret; - } - dprintf(("read %d bytes\n", n)); - - buffer_end += n; - } - - return 0; -} diff --git a/org.glite.lb.server-bones/interface/srvbones.h b/org.glite.lb.server-bones/interface/srvbones.h deleted file mode 100644 index f238705..0000000 --- a/org.glite.lb.server-bones/interface/srvbones.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef __ORG_GLITE_LB_SERVER_BONES_BONES_H__ -#define __ORG_GLITE_LB_SERVER_BONES_BONES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum _glite_srvbones_param_t { - GLITE_SBPARAM_SLAVES_COUNT, /**< number of slaves */ - GLITE_SBPARAM_SLAVE_OVERLOAD, /**< queue items per slave */ - GLITE_SBPARAM_SLAVE_CONNS_MAX, /**< commit suicide after that many connections */ - -/* NULL for timeouts means infinity */ - GLITE_SBPARAM_IDLE_TIMEOUT, /**< keep idle connection that long (timeval) */ - GLITE_SBPARAM_CONNECT_TIMEOUT, /**< timeout for establishing a connection (timeval) */ - GLITE_SBPARAM_REQUEST_TIMEOUT, /**< timeout for a single request (timeval)*/ -} glite_srvbones_param_t; - -typedef int (*slave_data_init_hnd)(void **); - -struct glite_srvbones_service { - char *id; /**< name of the service */ - int conn; /**< listening socket */ - -/** Handler called by slave on a newly established connection, - * i.e. after accept(2). - * \param[in] conn the accepted connection - * \param[inout] timeout don't consume more, update with the remaining time - * \param[inout] user_data arbitrary user data passed among the functions - */ - int (*on_new_conn_hnd)( - int conn, - struct timeval *timeout, - void *user_data - ); - - -/** Handler called by slave to serve each request. - * \param[in] conn connection to work with - * \param[inout] timeout don't consume more, update with the remaining time - * \param[inout] user_data arbitrary user data passed among the functions - * - * \retval 0 OK, connection remains open - * \retval ENOTCON terminated gracefully, bones will clean up - * \retval >0 other POSIX errno, non-fatal error - * \retval <0 fatal error, terminate slave - */ - int (*on_request_hnd)( - int conn, - struct timeval *timeout, - void *user_data - ); - -/** Handler called by master to reject connection on server overload. - * Should kick off the client quickly, not imposing aditional load - * on server or blocking long time. - */ - int (*on_reject_hnd)(int conn); - -/** Handler called by slave before closing the connection. - * Perform server-side cleanup, and terminate the connection gracefully - * if there is a way to do so (the disconnect is server-initiated). - * close(conn) is called by bones then. - * \param[in] conn connection to work with - * \param[inout] timeout don't consume more time - * \param[inout] user_data arbitrary user data passed among the functions - */ - int (*on_disconnect_hnd)( - int conn, - struct timeval *timeout, - void *user_data - ); -}; - -extern int glite_srvbones_set_param(glite_srvbones_param_t param, ...); - - -/** Main server function. - * - * \param[in] slave_data_init_hnd callback initializing user data on every slave - */ -extern int glite_srvbones_run( - slave_data_init_hnd slave_data_init, - struct glite_srvbones_service *service_table, - size_t table_sz, - int dbg); - -#ifdef __cplusplus -} -#endif - -#endif /* __ORG_GLITE_LB_SERVER_BONES_BONES_H__ */ diff --git a/org.glite.lb.server-bones/project/build.number b/org.glite.lb.server-bones/project/build.number deleted file mode 100644 index 034de6b..0000000 --- a/org.glite.lb.server-bones/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Fri Aug 18 12:29:52 CEST 2006 -module.build=0201 diff --git a/org.glite.lb.server-bones/project/build.properties b/org.glite.lb.server-bones/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.lb.server-bones/project/configure.properties.xml b/org.glite.lb.server-bones/project/configure.properties.xml deleted file mode 100644 index 335c3cf..0000000 --- a/org.glite.lb.server-bones/project/configure.properties.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -expat_prefix=${with.expat.prefix} -ares_prefix=${with.ares.prefix} -mysql_prefix=${with.mysql.prefix} - - - diff --git a/org.glite.lb.server-bones/project/properties.xml b/org.glite.lb.server-bones/project/properties.xml deleted file mode 100755 index fd20cb9..0000000 --- a/org.glite.lb.server-bones/project/properties.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.lb.server-bones/project/tar_exclude b/org.glite.lb.server-bones/project/tar_exclude deleted file mode 100644 index b3133e4..0000000 --- a/org.glite.lb.server-bones/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure-options.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.lb.server-bones/project/version.properties b/org.glite.lb.server-bones/project/version.properties deleted file mode 100644 index 8495a05..0000000 --- a/org.glite.lb.server-bones/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -#Fri Sep 02 14:17:59 CEST 2005 -module.version=2.2.5 -module.age=1 diff --git a/org.glite.lb.server-bones/src/srvbones.c b/org.glite.lb.server-bones/src/srvbones.c deleted file mode 100644 index 9cb1b65..0000000 --- a/org.glite.lb.server-bones/src/srvbones.c +++ /dev/null @@ -1,680 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "srvbones.h" - -/* defaults for GLITE_SBPARAM_* */ - -#define SLAVES_COUNT 5 /* default number of slaves */ -#define SLAVE_OVERLOAD 10 /* queue items per slave */ -#define SLAVE_REQS_MAX 500 /* commit suicide after that many connections */ -#define IDLE_TIMEOUT 30 /* keep idle connection that many seconds */ -#define CONNECT_TIMEOUT 5 /* timeout for establishing a connection */ -#define REQUEST_TIMEOUT 10 /* timeout for a single request */ -#define NEW_CLIENT_DURATION 10 /* how long a client is considered new, i.e. busy - connection is not closed to serve other clients */ - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; } -#endif - -#ifdef LB_PROF -extern void _start (void), etext (void); -#endif - -static int running = 0; -static int debug = 0; -static volatile int die = 0, - child_died = 0; -static unsigned long clnt_dispatched = 0, - clnt_accepted = 0; - -static struct glite_srvbones_service *services; -static int services_ct; - -static int set_slaves_ct = SLAVES_COUNT; -static int set_slave_overload = SLAVE_OVERLOAD; -static int set_slave_reqs_max = SLAVE_REQS_MAX; -static struct timeval set_idle_to = {IDLE_TIMEOUT, 0}; -static struct timeval set_connect_to = {CONNECT_TIMEOUT, 0}; -static struct timeval set_request_to = {REQUEST_TIMEOUT, 0}; - -static int dispatchit(int, int, int); -static int do_sendmsg(int, int, unsigned long, int); -static int do_recvmsg(int, int *, unsigned long *, int *); -static int check_timeout(struct timeval, struct timeval, struct timeval); -static void catchsig(int); -static void catch_chld(int sig); -static int slave(int (*)(void **), int); - -static void glite_srvbones_set_slaves_ct(int); -static void glite_srvbones_set_slave_overload(int); -static void glite_srvbones_set_slave_conns_max(int); -static void set_timeout(struct timeval *,struct timeval *); - -int glite_srvbones_set_param(glite_srvbones_param_t param, ...) -{ - va_list ap; - - if ( running ) { - dprintf(("Attempting to set srv-bones parameter on running server")); - return -1; - } - - va_start(ap, param); - switch ( param ) { - case GLITE_SBPARAM_SLAVES_COUNT: - glite_srvbones_set_slaves_ct(va_arg(ap,int)); break; - case GLITE_SBPARAM_SLAVE_OVERLOAD: - glite_srvbones_set_slave_overload(va_arg(ap,int)); break; - case GLITE_SBPARAM_SLAVE_CONNS_MAX: - glite_srvbones_set_slave_conns_max(va_arg(ap,int)); break; - case GLITE_SBPARAM_IDLE_TIMEOUT: - set_timeout(&set_idle_to,va_arg(ap,struct timeval *)); break; - case GLITE_SBPARAM_CONNECT_TIMEOUT: - set_timeout(&set_connect_to,va_arg(ap,struct timeval *)); break; - case GLITE_SBPARAM_REQUEST_TIMEOUT: - set_timeout(&set_request_to,va_arg(ap,struct timeval *)); break; - } - va_end(ap); - - return 0; -} - -int glite_srvbones_run( - slave_data_init_hnd slave_data_init, - struct glite_srvbones_service *service_table, - size_t table_sz, - int dbg) -{ - struct sigaction sa; - sigset_t sset; - int sock_slave[2], i; - int pstat; - - - assert(service_table); - assert(table_sz > 0); - - services = service_table; - services_ct = table_sz; - debug = dbg; - - setlinebuf(stdout); - setlinebuf(stderr); - dprintf(("Master pid %d\n", getpid())); - - if ( socketpair(AF_UNIX, SOCK_STREAM, 0, sock_slave) ) - { - perror("socketpair()"); - return 1; - } - - memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL); - sa.sa_handler = catchsig; - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - - sa.sa_handler = catch_chld; - sigaction(SIGCHLD, &sa, NULL); - - sa.sa_handler = SIG_IGN; - sigaction(SIGUSR1, &sa, NULL); - - sigemptyset(&sset); - sigaddset(&sset, SIGCHLD); - sigaddset(&sset, SIGTERM); - sigaddset(&sset, SIGINT); - sigprocmask(SIG_BLOCK, &sset, NULL); - - for ( i = 0; i < set_slaves_ct; i++ ) - slave(slave_data_init, sock_slave[1]); - - while ( !die ) - { - fd_set fds; - int ret, mx; - - - FD_ZERO(&fds); - FD_SET(sock_slave[0], &fds); - for ( i = 0, mx = sock_slave[0]; i < services_ct; i++ ) - { - FD_SET(services[i].conn, &fds); - if ( mx < services[i].conn ) mx = services[i].conn; - } - - sigprocmask(SIG_UNBLOCK, &sset, NULL); - ret = select(mx+1, &fds, NULL, NULL, NULL); - sigprocmask(SIG_BLOCK, &sset, NULL); - - if ( ret == -1 && errno != EINTR ) - { - if ( debug ) perror("select()"); - else syslog(LOG_CRIT,"select(): %m"); - - return 1; - } - - if ( child_died ) - { - int pid; - - while ( (pid = waitpid(-1, &pstat, WNOHANG)) > 0 ) - { - if (WIFEXITED(pstat)) { - dprintf(("[master] Slave %d exited with return code %d.\n", pid, WEXITSTATUS(pstat))); - if (WEXITSTATUS(pstat)) { - syslog(LOG_ERR, "Slave %d exited with return code %d.\n", pid, WEXITSTATUS(pstat)); - } - } - if (WIFSIGNALED(pstat)) { - dprintf(("[master] Slave %d terminated with signal %d.\n", pid, WTERMSIG(pstat))); - switch (WTERMSIG(pstat)) { - case SIGINT: - case SIGTERM: - case SIGUSR1: if (die) break; - default: - syslog(LOG_ERR, "Slave %d terminated with signal %d.\n", pid, WTERMSIG(pstat)); - break; - } - } - if ( !die ) - { - int newpid = slave(slave_data_init, sock_slave[1]); - dprintf(("[master] Servus mortuus [%d] miraculo resurrexit [%d]\n", pid, newpid)); - } - } - child_died = 0; - continue; - } - - if ( die ) continue; - - - if (FD_ISSET(sock_slave[0],&fds)) { - /* slave accepted a request - */ - unsigned long a; - - if ( (recv(sock_slave[0], &a, sizeof(a), MSG_WAITALL) == sizeof(a)) - && (a <= clnt_dispatched) - && (a > clnt_accepted || clnt_accepted > clnt_dispatched) ) - clnt_accepted = a; - } - - for ( i = 0; i < services_ct; i++ ) - if ( FD_ISSET(services[i].conn, &fds) - && dispatchit(sock_slave[0], services[i].conn ,i) ) - /* Be carefull!!! - * This must break this for cykle but start the - * while (!die) master cykle from the top also - */ - break; - } - - dprintf(("[master] Terminating on signal %d\n", die)); - if (!debug) syslog(LOG_INFO, "Terminating on signal %d\n", die); - kill(0, die); - - return 0; -} - -static int dispatchit(int sock_slave, int sock, int sidx) -{ - struct sockaddr_in a; - unsigned char *pom; - int conn, - alen, ret; - - - alen = sizeof(a); - if ( (conn = accept(sock, (struct sockaddr *)&a, &alen)) < 0 ) - { - if (debug) - { - perror("accept()"); - return 1; - } - else - { - syslog(LOG_ERR, "accept(): %m"); - sleep(5); - return -1; - } - } - - getpeername(conn, (struct sockaddr *)&a, &alen); - pom = (char *) &a.sin_addr.s_addr; - dprintf(("[master] %s connection from %d.%d.%d.%d:%d\n", - services[sidx].id? services[sidx].id: "", - (int)pom[0], (int)pom[1], (int)pom[2], (int)pom[3], - ntohs(a.sin_port))); - - ret = 0; - if ( ( clnt_dispatched < clnt_accepted /* wraparound */ - || clnt_dispatched - clnt_accepted < set_slaves_ct * set_slave_overload) - && !(ret = do_sendmsg(sock_slave, conn, clnt_dispatched++, sidx)) ) - { - /* all done - */ - dprintf(("[master] Dispatched %lu, last known served %lu\n", - clnt_dispatched-1, clnt_accepted)); - } - else - { - services[sidx].on_reject_hnd(conn); - dprintf(("[master] Rejected new connection due to overload\n")); - if ( !debug ) syslog(LOG_ERR, "Rejected new connection due to overload\n"); - } - - close(conn); - if (ret) - { - perror("sendmsg()"); - if ( !debug ) syslog(LOG_ERR, "sendmsg(): %m"); - } - - - return 0; -} - - -static int slave(slave_data_init_hnd data_init_hnd, int sock) -{ - sigset_t sset; - struct sigaction sa; - struct timeval client_done, - client_start, - new_client_duration = { NEW_CLIENT_DURATION, 0 }; - - void *clnt_data = NULL; - int conn = -1, - srv = -1, - req_cnt = 0, - sockflags, - h_errno, - pid, i, - first_request = 0; /* 1 -> first request from connected client expected */ - - - - if ( (pid = fork()) ) return pid; - -#ifdef LB_PROF - monstartup((u_long)&_start, (u_long)&etext); -#endif - - srandom(getpid()+time(NULL)); - - for ( i = 0; i < services_ct; i++ ) - close(services[i].conn); - - sigemptyset(&sset); - sigaddset(&sset, SIGTERM); - sigaddset(&sset, SIGINT); - sigaddset(&sset, SIGUSR1); - - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = catchsig; - sigaction(SIGUSR1, &sa, NULL); - - if ( (sockflags = fcntl(sock, F_GETFL, 0)) < 0 - || fcntl(sock, F_SETFL, sockflags | O_NONBLOCK) < 0 ) - { - dprintf(("[%d] fcntl(master_sock): %s\n", getpid(), strerror(errno))); - if ( !debug ) syslog(LOG_CRIT, "fcntl(master_sock): %m"); - exit(1); - } - - if ( data_init_hnd && data_init_hnd(&clnt_data) ) - /* - * XXX: what if the error remains and master will start new slave - * again and again? - * - * Then we are in a deep shit. - */ - exit(1); - - while ( !die && (req_cnt < set_slave_reqs_max || (conn >= 0 && first_request))) - { - fd_set fds; - int max = sock, - connflags, - newconn = -1, - newsrv = -1; - - enum { KICK_DONT = 0, KICK_IDLE, KICK_LOAD, KICK_HANDLER, KICK_COUNT } - kick_client = KICK_DONT; - - static char * kicks[] = { - "don't kick", - "idle client", - "high load", - "no request handler", - "request count limit reached", - }; - unsigned long seq; - struct timeval now,to; - - - FD_ZERO(&fds); - if ( conn < 0 || !first_request) FD_SET(sock, &fds); - if ( conn >= 0 ) FD_SET(conn, &fds); - if ( conn > sock ) max = conn; - - to = set_idle_to; - sigprocmask(SIG_UNBLOCK, &sset, NULL); - switch (select(max+1, &fds, NULL, NULL, to.tv_sec >= 0 ? &to : NULL)) - { - case -1: - if ( errno != EINTR ) - { - dprintf(("[%d] select(): %s\n", getpid(), strerror(errno))); - if ( !debug ) syslog(LOG_CRIT, "select(): %m"); - exit(1); - } - continue; - - case 0: - if ( conn < 0 ) continue; - - default: - break; - } - sigprocmask(SIG_BLOCK, &sset, NULL); - - gettimeofday(&now,NULL); - - if ( conn >= 0 && FD_ISSET(conn, &fds) ) - { - /* - * serve the request - */ - int rv; - - dprintf(("[%d] incoming request\n", getpid())); - - if ( !services[srv].on_request_hnd ) - { - kick_client = KICK_HANDLER; - } else { - req_cnt++; - first_request = 0; - to = set_request_to; - if ((rv = services[srv].on_request_hnd(conn,to.tv_sec>=0 ? &to : NULL,clnt_data)) == ENOTCONN) { - if (services[srv].on_disconnect_hnd - && (rv = services[srv].on_disconnect_hnd(conn,NULL,clnt_data))) - { - dprintf(("[%d] disconnect handler: %s, terminating\n",getpid(),strerror(rv))); - exit(1); - } - close(conn); - conn = -1; - srv = -1; - dprintf(("[%d] Connection closed\n", getpid())); - } - else if (rv > 0) { - /* non-fatal error -> close connection and contiue - * XXX: likely to leak resources but can we call on_disconnect_hnd() on error? - */ - close(conn); - conn = -1; - srv = -1; - dprintf(("[%d] %s, connection closed\n",getpid(),strerror(rv))); - continue; - } - else if ( rv < 0 ) { - /* unknown error -> clasified as FATAL -> kill slave - */ - dprintf(("[%d] %s, terminating\n",getpid(),strerror(-rv))); - exit(1); - } - else { - dprintf(("[%d] request done\n", getpid())); - gettimeofday(&client_done, NULL); - } - - if (!check_timeout(new_client_duration,client_start,now)) continue; - - } - } else { - if (conn >= 0 && check_timeout(set_idle_to, client_done, now)) - kick_client = KICK_IDLE; - } - - if ( (conn < 0 || !first_request) && FD_ISSET(sock, &fds) && req_cnt < set_slave_reqs_max ) - { - /* Prefer slaves with no connection, then kick idle clients, - * active ones last. Wait less if we have serviced a request in the meantime. - * Tuned for HZ=100 timer. */ - if ( conn >= 0 ) usleep( kick_client || FD_ISSET(conn, &fds) ? 11000 : 21000); - if ( do_recvmsg(sock, &newconn, &seq, &newsrv) ) switch ( errno ) - { - case EINTR: /* XXX: signals are blocked */ - case EAGAIN: - continue; - default: dprintf(("[%d] recvmsg(): %s\n", getpid(), strerror(errno))); - if (!debug) syslog(LOG_CRIT,"recvmsg(): %m\n"); - exit(1); - } - kick_client = KICK_LOAD; - } - - if (req_cnt >= set_slave_reqs_max && !first_request) kick_client = KICK_COUNT; - - if ( kick_client && conn >= 0 ) - { - if ( services[srv].on_disconnect_hnd ) - services[srv].on_disconnect_hnd(conn, NULL, clnt_data); - close(conn); - conn = -1; - srv = -1; - dprintf(("[%d] Connection closed, %s\n", getpid(), kicks[kick_client])); - } - - if ( newconn >= 0 ) - { - int ret; - - conn = newconn; - srv = newsrv; - gettimeofday(&client_start, NULL); - - switch ( send(sock, &seq, sizeof(seq), 0) ) - { - case -1: - if (debug) perror("send()"); - else syslog(LOG_CRIT, "send(): %m\n"); - exit(1); - - case sizeof(seq): - break; - - default: dprintf(("[%d] send(): incomplete message\n", getpid())); - exit(1); - } - - req_cnt++; - dprintf(("[%d] serving %s connection %lu\n", getpid(), - services[srv].id? services[srv].id: "", seq)); - - connflags = fcntl(conn, F_GETFL, 0); - if ( fcntl(conn, F_SETFL, connflags | O_NONBLOCK) < 0 ) - { - dprintf(("[%d] can't set O_NONBLOCK mode (%s), closing.\n", getpid(), strerror(errno))); - if ( !debug ) syslog(LOG_ERR, "can't set O_NONBLOCK mode (%s), closing.\n", strerror(errno)); - close(conn); - conn = srv = -1; - continue; - } - - to = set_connect_to; - if ( services[srv].on_new_conn_hnd - && (ret = services[srv].on_new_conn_hnd(conn, to.tv_sec >= 0 ? &to : NULL, clnt_data)) ) - { - dprintf(("[%d] Connection not established, err = %d.\n", getpid(),ret)); - if ( !debug ) syslog(LOG_ERR, "Connection not established, err = %d.\n",ret); - close(conn); - conn = srv = -1; - if (ret < 0) exit(1); - continue; - } - gettimeofday(&client_done, NULL); - first_request = 1; - } - } - - if ( die ) - { - dprintf(("[%d] Terminating on signal %d\n", getpid(), die)); - if ( !debug ) syslog(LOG_INFO, "Terminating on signal %d", die); - } - - if (conn >= 0 && services[srv].on_disconnect_hnd ) - services[srv].on_disconnect_hnd(conn, NULL, clnt_data); - - dprintf(("[%d] Terminating after %d requests\n", getpid(), req_cnt)); - if ( !debug ) syslog(LOG_INFO, "Terminating after %d requests", req_cnt); - - - exit(0); -} - -static void catchsig(int sig) -{ - die = sig; -} - -static void catch_chld(int sig) -{ - child_died = 1; -} - -static int check_timeout(struct timeval timeout, struct timeval before, struct timeval after) -{ - return (timeout.tv_usec <= after.tv_usec - before.tv_usec) ? - (timeout.tv_sec <= after.tv_sec - before.tv_sec) : - (timeout.tv_sec < after.tv_sec - before.tv_sec); -} - -#define MSG_BUFSIZ 30 - -/* - * send socket sock through socket to_sock - */ -static int do_sendmsg(int to_sock, int sock, unsigned long clnt_dispatched, int srv) -{ - struct msghdr msg = {0}; - struct cmsghdr *cmsg; - struct iovec sendiov; - int myfds, /* file descriptors to pass. */ - *fdptr; - char buf[CMSG_SPACE(sizeof myfds)]; /* ancillary data buffer */ - char sendbuf[MSG_BUFSIZ]; /* to store unsigned int + \0 */ - - - memset(sendbuf, 0, sizeof(sendbuf)); - snprintf(sendbuf, sizeof(sendbuf), "%u %lu", srv, clnt_dispatched); - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &sendiov; - msg.msg_iovlen = 1; - sendiov.iov_base = sendbuf; - sendiov.iov_len = sizeof(sendbuf); - - msg.msg_control = buf; - msg.msg_controllen = sizeof buf; - - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - fdptr = (int *)CMSG_DATA(cmsg); - *fdptr = sock; - - msg.msg_controllen = cmsg->cmsg_len; - /* send fd to server-slave to do rest of communication */ - if (sendmsg(to_sock, &msg, 0) < 0) - return 1; - - return 0; -} - - -/* receive socket sock through socket from_sock */ -static int do_recvmsg(int from_sock, int *sock, unsigned long *clnt_accepted,int *srv) -{ - struct msghdr msg = {0}; - struct cmsghdr *cmsg; - struct iovec recviov; - int myfds; /* file descriptors to pass. */ - char buf[CMSG_SPACE(sizeof(myfds))]; /* ancillary data buffer */ - char recvbuf[MSG_BUFSIZ]; - - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &recviov; - msg.msg_iovlen = 1; - recviov.iov_base = recvbuf; - recviov.iov_len = sizeof(recvbuf); - - msg.msg_control = buf; - msg.msg_controllen = sizeof buf; - - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - msg.msg_controllen = cmsg->cmsg_len; - - if (recvmsg(from_sock, &msg, 0) < 0) - return 1; - - *sock = *((int *)CMSG_DATA(cmsg)); - sscanf(recvbuf, "%u %lu", srv, clnt_accepted); - - return 0; -} - -static void glite_srvbones_set_slaves_ct(int n) -{ - set_slaves_ct = (n == -1)? SLAVES_COUNT: n; -} - -static void glite_srvbones_set_slave_overload(int n) -{ - set_slave_overload = (n == -1)? SLAVE_OVERLOAD: n; -} - -static void glite_srvbones_set_slave_conns_max(int n) -{ - set_slave_reqs_max = (n == -1)? SLAVE_REQS_MAX: n; -} - -static void set_timeout(struct timeval *to, struct timeval *val) -{ - if (val) { - /* XXX: why not, negative timeouts don't make any sense, IMHO */ - assert(val->tv_sec >= 0); - *to = *val; - } - else to->tv_sec = -1; -} diff --git a/org.glite.lbjp-utils.db/.cvsignore b/org.glite.lbjp-utils.db/.cvsignore deleted file mode 100644 index b7d6c92..0000000 --- a/org.glite.lbjp-utils.db/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -build -doc -reports diff --git a/org.glite.lbjp-utils.db/LICENSE b/org.glite.lbjp-utils.db/LICENSE deleted file mode 100644 index 01b973b..0000000 --- a/org.glite.lbjp-utils.db/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lbjp-utils.db/Makefile b/org.glite.lbjp-utils.db/Makefile deleted file mode 100644 index 447dd4c..0000000 --- a/org.glite.lbjp-utils.db/Makefile +++ /dev/null @@ -1,137 +0,0 @@ -# defaults -top_srcdir=. -builddir=build -stagedir=. -distdir=. -globalprefix=glite -lbutilsprefix=lb-utils -package=glite-lb-utils-db -version=0.2.0 -PREFIX=/opt/glite -flavour=gcc32thr - -glite_location=/opt/glite -mysql_prefix=/opt/mysql -mysql_version=4.1.11 -cppunit_prefix=/opt/cppunit -thrflavour=gcc32pthr -nothrflavour=gcc32 - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -CC=gcc - -VPATH=${top_srcdir}/interface:${top_srcdir}/src:${top_srcdir}/examples - -DEBUG:=-g -O0 -Wall - -CFLAGS:= \ - ${DEBUG} \ - -DVERSION=\"${version}\" \ - -I${stagedir}/include -I${top_srcdir}/src -I. \ - -I${top_srcdir}/interface \ - ${COVERAGE_FLAGS} \ - -I${mysql_prefix}/include -I${mysql_prefix}/include/mysql \ - -D_GNU_SOURCE - -ifdef LBS_DB_PROFILE - CFLAGS:=${CFLAGS} -DLBS_DB_PROFILE -endif - -TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit -TEST_INC:=-I${cppunit_prefix}/include - -LDFLAGS:=-L${stagedir}/lib ${COVERAGE_FLAGS} - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -archlib:=lib -host_cpu:=${shell uname -m} -ifeq (${host_cpu},x86_64) - archlib:=lib64 -endif - -ifneq (${mysql_prefix},/usr) - ifeq ($(shell echo ${mysql_version} | cut -d. -f1,2),4.1) - mysqlib := -L${mysql_prefix}/${archlib}/mysql - else - mysqlib := -L${mysql_prefix}/${archlib} - endif -endif - -EXT_LIBS:=${mysqlib} -lmysqlclient -lz -lglite_lbu_trio -OBJS:=db.o -TESTOBJS:=dbtest.o -HDRS:=db.h -LOBJS:=${OBJS:.o=.lo} -LTESTOBJS:=${TESTOBJS:.o=.lo} - -libglite_lbu_db.la: ${LOBJS} - ${LINK} -o $@ $< ${EXT_LIBS} - -libglite_lbu_dbtest.la: ${LTESTOBJS} - ${LINK} -o $@ $< ${EXT_LIBS} - -dbtest.lo dbtest.o: db.c db.h - ${COMPILE} -DGLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH=10 -c $< -o $@ - -db_test: db_test.lo libglite_lbu_dbtest.la - ${LINK} -o $@ $+ ${EXT_LIBS} - -db_expire: db_expire.lo libglite_lbu_dbtest.la - ${LINK} -o $@ $+ ${EXT_LIBS} - -default all: compile - -compile: libglite_lbu_db.la - -check: - -echo No checks here yet. - -test_coverage: - -mkdir coverage - cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check - cd coverage && for i in `echo ${OBJS} | tr ' ' '\012' | sort -u`; do gcov $$i ; done - -examples: db_test db_expire - -doc: - doxygen C.dox - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - -mkdir -p ${PREFIX}/lib - -mkdir -p ${PREFIX}/include/${globalprefix}/${lbutilsprefix} -# ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 755 "libglite_lbu_db.la" "${PREFIX}/lib/libglite_lbu_db.la"; \ - ${INSTALL} -m 644 ${top_srcdir}/interface/${HDRS} ${PREFIX}/include/${globalprefix}/${lbutilsprefix} - -clean: - -%.o %.lo: %.c - ${COMPILE} -c $< - -db.lo: db.c db.h -db_test.lo: libglite_lbu_dbtest.la db.h db_test.c - -.PHONY: default all compile check examples doc stage dist distsrc distbin install clean test_coverage diff --git a/org.glite.lbjp-utils.db/examples/db_expire.c b/org.glite.lbjp-utils.db/examples/db_expire.c deleted file mode 100644 index 012a91b..0000000 --- a/org.glite.lbjp-utils.db/examples/db_expire.c +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Example (and quick test) of prepared statements expirations. - * Use 'SET GLOBAL wait_timeout=...' for experimenting. - * - * Requires existing database with appropriate access and example table: - * - * mysqladmin -u root -p create test - * mysql -u root -p -e 'GRANT ALL on test.* to testuser@localhost' - * ./db_test - * - * Use CS environment variable when using different user/pwd@machine:dbname. - */ - -#include -#include -#include - -#include "db.h" - -#define CS "testuser/@localhost:test" -#define SELECT_CMD "SELECT id, user, info FROM data WHERE user = ?" - -#define dprintf(ARGS) { printf("%s: ", name); printf ARGS; } - - -static void print_blob(unsigned long len, char *blob) { - int i; - for (i = 0; i < len; i++) printf("%02X ", blob[i]); - printf("(='"); - for (i = 0; i < len; i++) printf("%c", blob[i]); - printf("')"); -} - - -static void print_free_result(const char *name, unsigned long *lens, char **res) { - dprintf((" id='%s'=%d\n", res[0], atoi(res[0]))); - - dprintf((" user='%s'\n", res[1])); - - dprintf((" blob=")); - if (res[2] && lens) print_blob(lens[2], res[2]); - else printf("null"); - printf("\n"); - - free(res[0]); - free(res[1]); - free(res[2]); -} - - -int main(int argn, char *argv[]) { - char *name, *user; - const char *cs; - glite_lbu_DBContext ctx; - glite_lbu_Statement stmt; - int caps, i, nr, c; - unsigned long lens[3]; - char *res[3]; - - if ((name = strrchr(argv[0], '/')) != NULL) name++; - else name = argv[0]; - if ((cs = getenv("CS")) == NULL) cs = CS; - - // init - dprintf(("connecting to %s...\n", cs)); - if (glite_lbu_InitDBContext(&ctx) != 0) goto fail; - if (glite_lbu_DBConnect(ctx, cs) != 0) goto failctx; - if ((caps = glite_lbu_DBQueryCaps(ctx)) == -1) goto failcon; - if ((caps & GLITE_LBU_DB_CAP_PREPARED) == 0) { - dprintf(("can't do prepared commands, exiting.")); - goto failcon; - } - // caps - glite_lbu_DBSetCaps(ctx, caps); - dprintf(("capabilities: %d\n", caps)); - - user = NULL; - dprintf(("preparing '%s'...\n", user)); - if ((glite_lbu_PrepareStmt(ctx, SELECT_CMD, &stmt)) != 0) goto failcon; - - do { - user = "cicomexocitl.civ"; - dprintf(("executing '%s'...\n", user)); - if (glite_lbu_ExecStmt(stmt, 1, GLITE_LBU_DB_TYPE_VARCHAR, user) == -1) goto failstmt; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) { - dprintf(("fetch '%s' failed\n", user)); - break; - } - dprintf(("\n")); - - c = fgetc(stdin); - } while (c != -1 && (c == '\r' || c == '\n')); - - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); - glite_lbu_FreeDBContext(ctx); - return 0; - -failstmt: - printf("closing stmt...\n"); - glite_lbu_FreeStmt(&stmt); -failcon: - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); -failctx: - glite_lbu_FreeDBContext(ctx); -fail: - dprintf(("failed\n")); - return 1; -} diff --git a/org.glite.lbjp-utils.db/examples/db_test.c b/org.glite.lbjp-utils.db/examples/db_test.c deleted file mode 100644 index 02be92a..0000000 --- a/org.glite.lbjp-utils.db/examples/db_test.c +++ /dev/null @@ -1,196 +0,0 @@ -/* - * Example (and quick test) of this DB module. - * - * Requires existing database with appropriate access: - * - * mysqladmin -u root -p create test - * mysql -u root -p -e 'GRANT ALL on test.* to testuser@localhost' - * - * Use CS environment variable when using different user/pwd@machine:dbname. - */ - -#include -#include -#include - -#include "db.h" - -#define CS "testuser/@localhost:test" -#define CREATE_CMD "CREATE TABLE data (\n\ - id INT NOT NULL,\n\ - user VARCHAR(32) NOT NULL,\n\ - info BLOB,\n\ - PRIMARY KEY (id),\n\ - INDEX(user)\n\ -) engine=innodb" -#define DROP_CMD "DROP TABLE data" -#define INSERT_TRIO_CMD "INSERT INTO data (id, user, info) VALUES (%d, %s, %s)" -#define SELECT_TRIO_CMD "SELECT id, user, info FROM data WHERE user = '%s'" -#define INSERT_CMD "INSERT INTO data (id, user, info) VALUES (?, ?, ?)" -#define SELECT_CMD "SELECT id, user, info FROM data WHERE user = ?" - -#define dprintf(ARGS) { printf("%s: ", name); printf ARGS; } - - -static void print_blob(unsigned long len, char *blob) { - int i; - for (i = 0; i < len; i++) printf("%02X ", blob[i]); - printf("(='"); - for (i = 0; i < len; i++) printf("%c", blob[i]); - printf("')"); -} - - -static void print_free_result(const char *name, unsigned long *lens, char **res) { - dprintf((" id='%s'=%d\n", res[0], atoi(res[0]))); - - dprintf((" user='%s'\n", res[1])); - - dprintf((" blob=")); - if (res[2] && lens) print_blob(lens[2], res[2]); - else printf("null"); - printf("\n"); - - free(res[0]); - free(res[1]); - free(res[2]); -} - - -int main(int argn, char *argv[]) { - char *name, *cmd; - const char *cs; - glite_lbu_DBContext ctx; - glite_lbu_Statement stmt; - int caps; - - char blob1[] = "Guess: blob or \000string?"; - char blob2[] = {0, 1, 2, 3, 4, 5}; - - int nr; - char *res[3]; - unsigned long lens[3]; - - if ((name = strrchr(argv[0], '/')) != NULL) name++; - else name = argv[0]; - if ((cs = getenv("CS")) == NULL) cs = CS; - cmd = NULL; - - // init - dprintf(("connecting to %s...\n", cs)); - if (glite_lbu_InitDBContext(&ctx) != 0) goto fail; - if (glite_lbu_DBConnect(ctx, cs) != 0) goto failctx; - if ((caps = glite_lbu_DBQueryCaps(ctx)) == -1) goto failcon; - if ((caps & GLITE_LBU_DB_CAP_PREPARED) == 0) { - dprintf(("can't do prepared commands, exiting.")); - goto failcon; - } - // caps - glite_lbu_DBSetCaps(ctx, caps || GLITE_LBU_DB_CAP_ERRORS); - dprintf(("capabilities: %d\n", caps)); - // create all needed tables and data - dprintf(("creating tables...\n")); - glite_lbu_ExecSQL(ctx, DROP_CMD, NULL); - if (glite_lbu_ExecSQL(ctx, CREATE_CMD, NULL) == -1) goto failcon; - // trio-insert - dprintf(("trio-insert...\n")); - asprintf(&cmd, INSERT_TRIO_CMD, 1, "'hyperochus'", "NULL"); - if (glite_lbu_ExecSQL(ctx, cmd, NULL) != 1) goto failcon; - free(cmd); cmd = NULL; - // prepared-insert - dprintf(("prepare-insert...\n")); - if (glite_lbu_PrepareStmt(ctx, INSERT_CMD, &stmt) != 0) goto failcon; - dprintf(("execute 1. insert...\n")); - if (glite_lbu_ExecStmt(stmt, 3, - GLITE_LBU_DB_TYPE_INT, 2, - GLITE_LBU_DB_TYPE_VARCHAR, "cicomexocitl.civ", - GLITE_LBU_DB_TYPE_BLOB, blob1, sizeof(blob1) - 1) != 1) goto failstmt; - dprintf(("execute 2. insert...\n")); - if (glite_lbu_ExecStmt(stmt, 3, - GLITE_LBU_DB_TYPE_INT, 3, - GLITE_LBU_DB_TYPE_VARCHAR, "tartarus", - GLITE_LBU_DB_TYPE_NULL) != 1) goto failstmt; - dprintf(("execute 3. insert...\n")); - if (glite_lbu_ExecStmt(stmt, 3, - GLITE_LBU_DB_TYPE_INT, 4, - GLITE_LBU_DB_TYPE_VARCHAR, "harpia", - GLITE_LBU_DB_TYPE_BLOB, blob2, sizeof(blob2)) != 1) goto failstmt; - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); - - // trio-query -{ - const char *user; - - user = "harpia"; - dprintf(("selecting '%s'...\n", user)); - asprintf(&cmd, SELECT_TRIO_CMD, user); - if (glite_lbu_ExecSQL(ctx, cmd, &stmt) == -1) goto failcon; - free(cmd); cmd = NULL; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) dprintf(("fetch '%s' failed\n", user)); - dprintf(("closing stmt...\n")); - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); - - user = "nobody"; - dprintf(("selecting '%s'...\n", user)); - asprintf(&cmd, SELECT_TRIO_CMD, user); - if (glite_lbu_ExecSQL(ctx, cmd, &stmt) == -1) goto failcon; - free(cmd); cmd = NULL; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) dprintf(("fetch '%s' failed\n", user)); - dprintf(("closing stmt...\n")); - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); -} - - // "param" queries -{ - const char *user = NULL; - - dprintf(("preparing '%s'...\n", user)); - if ((glite_lbu_PrepareStmt(ctx, SELECT_CMD, &stmt)) != 0) goto failcon; - - user = "cicomexocitl.civ"; - dprintf(("executing '%s'...\n", user)); - if (glite_lbu_ExecStmt(stmt, 1, GLITE_LBU_DB_TYPE_VARCHAR, user) == -1) goto failstmt; - dprintf(("fetching '%s'...\n", user)); - while ((nr = glite_lbu_FetchRow(stmt, 3, lens, res)) > 0) { - dprintf(("Result: n=%d, res=%p\n", nr, res)); - print_free_result(name, lens, res); - } - if (nr < 0) dprintf(("fetch '%s' failed\n", user)); - dprintf(("\n")); - - dprintf(("closing stmt...\n")); - glite_lbu_FreeStmt(&stmt); - dprintf(("\n")); -} - - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); - glite_lbu_FreeDBContext(ctx); - return 0; - -failstmt: - printf("closing stmt...\n"); - glite_lbu_FreeStmt(&stmt); -failcon: - dprintf(("closing...\n")); - glite_lbu_DBClose(ctx); -failctx: - glite_lbu_FreeDBContext(ctx); -fail: - free(cmd); - dprintf(("failed\n")); - return 1; -} diff --git a/org.glite.lbjp-utils.db/interface/db.h b/org.glite.lbjp-utils.db/interface/db.h deleted file mode 100644 index 2818a4e..0000000 --- a/org.glite.lbjp-utils.db/interface/db.h +++ /dev/null @@ -1,344 +0,0 @@ -#ifndef GLITE_LBU_DB_H -#define GLITE_LBU_DB_H - -#ident "$Header$" - - -#include - - -#ifdef __cplusplus -extern "C" { -#endif - - -/** - * \file db.h - * \defgroup database Database module - * - * Database modul module API (LB & JP Utils). - * - * There are two ways to access DB here: - * - simple: - * - * SQL commands as single string. All values are incorporated in the SQL command strings. Proper escaping is required. - * - enhanced: - * - * Prepared SQL commands with separated parameters, functions PrepareStmt() and ExecStmt(). All values are delivered in separated buffers. Its faster for multiple using and more secure. - * @{ - */ - - -/** - * Enable transaction support if available. - * - * With disabled transaction can be used transaction functions, they are just ignored. - */ -#define GLITE_LBU_DB_CAP_TRANSACTIONS 1 - -/** - * Check prepared parameters support. - */ -#define GLITE_LBU_DB_CAP_PREPARED 2 - -/** - * Check for getting indexes support. - * - * Needed for QueryIndices call. - */ -#define GLITE_LBU_DB_CAP_INDEX 4 - - -/** - * Print all errors. - * - * Not returned from detection of capabilities. - */ -#define GLITE_LBU_DB_CAP_ERRORS 8 - - -/** - * Database connection context. - */ -typedef struct glite_lbu_DBContext_s *glite_lbu_DBContext; - - -/** - * Prepared statement, used for SQL statement with parameters. - */ -typedef struct glite_lbu_Statement_s *glite_lbu_Statement; - - -/** - * Structure holds date for multi-rows insert. - */ -typedef struct glite_lbu_bufInsert_s *glite_lbu_bufInsert; - - - -/** - * All types of parameteres, they match to the SQL types. - */ -typedef enum { - GLITE_LBU_DB_TYPE_NULL = 0, - GLITE_LBU_DB_TYPE_TINYINT = 1, - GLITE_LBU_DB_TYPE_INT = 2, - GLITE_LBU_DB_TYPE_TINYBLOB = 3, - GLITE_LBU_DB_TYPE_TINYTEXT = 4, - GLITE_LBU_DB_TYPE_BLOB = 5, - GLITE_LBU_DB_TYPE_TEXT = 6, - GLITE_LBU_DB_TYPE_MEDIUMBLOB = 7, - GLITE_LBU_DB_TYPE_MEDIUMTEXT = 8, - GLITE_LBU_DB_TYPE_LONGBLOB = 9, - GLITE_LBU_DB_TYPE_LONGTEXT = 10, - GLITE_LBU_DB_TYPE_VARCHAR = 11, - GLITE_LBU_DB_TYPE_CHAR = 12, - GLITE_LBU_DB_TYPE_DATE = 13, - GLITE_LBU_DB_TYPE_TIME = 14, - GLITE_LBU_DB_TYPE_DATETIME = 15, - GLITE_LBU_DB_TYPE_TIMESTAMP = 16, - GLITE_LBU_DB_TYPE_LAST = 17 -} glite_lbu_DBType; - - - -/** - * Get error state from DB context. - * - * \param[in] ctx context to work with - * \param[out] text error name - * \param[out] desc error description - */ -int glite_lbu_DBError(glite_lbu_DBContext ctx, char **text, char **desc); - - -/** - * Initialize the database context. - * - * \param[out] ctx result context - */ -int glite_lbu_InitDBContext(glite_lbu_DBContext *ctx); - - -/** - * Free database context. - */ -void glite_lbu_FreeDBContext(glite_lbu_DBContext ctx); - - -/** - * Connect to the given database. - * - * \param[out] ctx context to work with - * \param[in] cs connect string user/password\@host:database - * - * \return error code, 0 = OK - */ -int glite_lbu_DBConnect(glite_lbu_DBContext ctx, const char *cs); - - -/** - * Close the connection. - * - * \param[in,out] ctx context to work with - */ -void glite_lbu_DBClose(glite_lbu_DBContext ctx); - - -/** - * Check database version and capabilities. - * - * \param[in,out] ctx context to work with - * - * \return capabilities - * \retval -1 error occured - */ -int glite_lbu_DBQueryCaps(glite_lbu_DBContext ctx); - - -/** - * Set the database capabilities on already initialized context. - * - * It should be find out by DBQueryCaps() first. - * - * \param[in,out] ctx context to work with - * \param[in] caps capabilities to use, should be found out by QueryCaps() - */ -void glite_lbu_DBSetCaps(glite_lbu_DBContext ctx, int caps); - - -/** - * Start transaction. - */ -int glite_lbu_Transaction(glite_lbu_DBContext ctx); - - -/** - * Commit (end) transaction. - */ -int glite_lbu_Commit(glite_lbu_DBContext ctx); - - -/** - * Cancel transaction. - */ -int glite_lbu_Rollback(glite_lbu_DBContext ctx); - - -/** - * \param[in,out] stmt executed SQL statement - * \param[in] n number of items for sure there is enough space in lengths and results - * \param[out] lengths array with lengths (good for data blobs), may be NULL - * \param[out] results array with results, all items are allocated - * - * \retval >0 number of fields of the retrieved row - * \retval 0 no more rows - * \retval -1 error - */ -int glite_lbu_FetchRow(glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results); - - -/** - * Free the statement structure and destroy its parameters. - * - * Statement will be set to NULL and multiple calls are allowed. - * - * \param[in,out] stmt statement - */ -void glite_lbu_FreeStmt(glite_lbu_Statement *stmt); - - -/** - * Parse and execute one simple SQL statement. - * All values are incorporated int the SQL command string. - * - * \param[in,out] ctx context to work with - * \param[in] cmd SQL command - * \param[out] stmt statement handle with results (makes sense for selects only) - * - * \return number of rows selected, created or affected by update, -1 on error - */ -int glite_lbu_ExecSQL(glite_lbu_DBContext ctx, const char *cmd, glite_lbu_Statement *stmt); - - -/** - * Query for column names of the statement. - * - * It work only for simple API, so only after ExecSQL(). - * - * \param[in,out] stmt the statement handle - * \param[out] cols result array of names - * - * \return error code - */ -int glite_lbu_QueryColumns(glite_lbu_Statement stmt, char **cols); - - -/** - * Retrieve column names of a query simple SQL statement. - * - * \param[in,out] ctx context to work with - * \param[in] table table name - * \param[out] key_names one-dimensional index names array - * \param[out] column_names two-dimensional column names array - * - * \return 0 if OK, nonzero on error - */ -int glite_lbu_QueryIndices(glite_lbu_DBContext ctx, const char *table, char ***key_names, char ****column_names); - - -/** - * Convert time_t into database-specific time string. - * - * The result string can be used directly in SQL commands. - * - * \param[in] t the converted time - * \param[out] str result allocated string - */ -void glite_lbu_TimeToDB(time_t t, char **str); - - -/** - * Convert database-specific time string to time_t. - * - * String is expected in database for (ISO format). - * - * \param[in] str the converted string - * \return result time - */ -time_t glite_lbu_DBToTime(const char *str); - - -/** - * Init data structure for buffered insert - * - * takes table_name and columns string for future multirow insert - * when insert string oversize size_limit or number of rows to be inserted - * overcome record_limit, the real insert is triggered - */ -int glite_lbu_bufferedInsertInit(glite_lbu_DBContext ctx, glite_lbu_bufInsert *bi, void *mysql, const char *table_name, long size_limit, long record_limit, const char * columns); - - -/** - * adds row of n values into n columns into an insert buffer - * if num. of rows or size of data oversteps the limits, real - * multi-row insert is done - */ -int glite_lbu_bufferedInsert(glite_lbu_bufInsert bi, const char *row); - - -/** - * Flush buffered data and free bi structure. - */ -int glite_lbu_bufferedInsertClose(glite_lbu_bufInsert bi); - - -/** - * Prepare the SQL statement. Use glite_lbu_FreeStmt() to free it. - * - * \param[in,out] ctx context to work with - * \param[in] sql SQL command - * \param[out] stmt returned SQL statement - * - * \return error code - */ -int glite_lbu_PrepareStmt(glite_lbu_DBContext ctx, const char *sql, glite_lbu_Statement *stmt); - - -/** - * Execute prepared SQL statement. - * - * \param[in,out] stmt SQL statement - * \param[in] n number of items - * - * Variable parameters (n-times): - * - * always: - * - * \param type DB item type - * - * then one of them: - * - * \param GLITE_LBU_DB_TYPE_TINYINT int c - * \param GLITE_LBU_DB_TYPE_INT long int i - * \param GLITE_LBU_DB_TYPE_...BLOB/TEXT void *b, unsigned long len - * \param GLITE_LBU_DB_TYPE_[VAR]CHAR char *str - * \param GLITE_LBU_DB_TYPE_DATE/TIME/DATETIME time_t t - * \param GLITE_LBU_DB_TYPE_TIMESTAMP time_t t - * \param GLITE_LBU_DB_TYPE_NULL - - * - * \return number of affected rows, -1 on error - */ -int glite_lbu_ExecStmt(glite_lbu_Statement stmt, int n, ...); - - -/** - * @} database group - */ - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.lbjp-utils.db/src/db.c b/org.glite.lbjp-utils.db/src/db.c deleted file mode 100644 index bce48b8..0000000 --- a/org.glite.lbjp-utils.db/src/db.c +++ /dev/null @@ -1,1039 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "glite/lbu/trio.h" -#include "db.h" - - -#define GLITE_LBU_MYSQL_INDEX_VERSION 40001 -#define GLITE_LBU_MYSQL_PREPARED_VERSION 40102 -#define BUF_INSERT_ROW_ALLOC_BLOCK 1000 -#ifndef GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH -#define GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH 256 -#endif - - -#define CLR_ERR(CTX) lbu_clrerr((CTX)) -#define ERR(CTX, CODE, DESC) lbu_err((CTX), (CODE), (DESC), __FUNCTION__, __LINE__) -#define STATUS(CTX) ((CTX)->err.code) -#define MY_ERR(CTX) myerr((CTX), __FUNCTION__, __LINE__) -#define MY_ERRSTMT(STMT) myerrstmt((STMT), __FUNCTION__, __LINE__) -#define MY_ISOKSTMT(STMT, RETRY) myisokstmt((STMT), __FUNCTION__, __LINE__, (RETRY)) - -#define USE_TRANS(CTX) ((CTX->caps & GLITE_LBU_DB_CAP_TRANSACTIONS) != 0) - -#define dprintf(CTX, FMT...) if (CTX->caps & GLITE_LBU_DB_CAP_ERRORS) fprintf(stderr, ##FMT) - - -struct glite_lbu_DBContext_s { - MYSQL *mysql; - const char *cs; - int have_caps; - int caps; - struct { - int code; - char *desc; - } err; -}; - - -struct glite_lbu_Statement_s { - glite_lbu_DBContext ctx; - - /* for simple commands */ - MYSQL_RES *result; - - /* for prepared commands */ - MYSQL_STMT *stmt; - unsigned long nrfields; -}; - - -struct glite_lbu_bufInsert_s { - glite_lbu_DBContext ctx; - char *table_name; - char *columns; /* names of columns to be inserted into - * (values separated with commas) */ - char **rows; /* each row hold string of one row to be inserted - * (values separated with commas) */ - long rec_num, /* actual number of rows in structure */ - rec_size; /* approx. size of a real insert string */ - long size_limit, /* size and # of records limit which trigger */ - record_limit; /* real insert; zero means unlimitted */ -}; - - -/* - * mapping glite DB types to mysql types - */ -int glite_type_to_mysql[] = { - MYSQL_TYPE_NULL, - MYSQL_TYPE_TINY, - MYSQL_TYPE_LONG, - MYSQL_TYPE_TINY_BLOB, - MYSQL_TYPE_TINY_BLOB, - MYSQL_TYPE_BLOB, - MYSQL_TYPE_BLOB, - MYSQL_TYPE_MEDIUM_BLOB, - MYSQL_TYPE_MEDIUM_BLOB, - MYSQL_TYPE_LONG_BLOB, - MYSQL_TYPE_LONG_BLOB, - MYSQL_TYPE_VAR_STRING, - MYSQL_TYPE_STRING, - MYSQL_TYPE_DATE, - MYSQL_TYPE_TIME, - MYSQL_TYPE_DATETIME, - MYSQL_TYPE_TIMESTAMP, -}; - - - -static int lbu_clrerr(glite_lbu_DBContext ctx); -static int lbu_err(glite_lbu_DBContext ctx, int code, const char *desc, const char *func, int line); -static int myerr(glite_lbu_DBContext ctx, const char *source, int line); -static int myerrstmt(glite_lbu_Statement stmt, const char *source, int line); -static int myisokstmt(glite_lbu_Statement stmt, const char *source, int line, int *retry); -static int db_connect(glite_lbu_DBContext ctx, const char *cs, MYSQL **mysql); -static void db_close(MYSQL *mysql); -static int transaction_test(glite_lbu_DBContext ctx, MYSQL *m2, int *have_transactions); -static int FetchRowSimple(glite_lbu_DBContext ctx, MYSQL_RES *result, unsigned long *lengths, char **results); -static int FetchRowPrepared(glite_lbu_DBContext ctx, glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results); -void set_time(MYSQL_TIME *mtime, const time_t time); -time_t get_time(const MYSQL_TIME *mtime); - - -/* ---- common ---- */ - - -int glite_lbu_DBError(glite_lbu_DBContext ctx, char **text, char **desc) { - if (text) *text = strdup(strerror(ctx->err.code)); - if (desc) { - if (ctx->err.desc) *desc = strdup(ctx->err.desc); - else *desc = NULL; - } - - return ctx->err.code; -} - - -int glite_lbu_InitDBContext(glite_lbu_DBContext *ctx) { - *ctx = calloc(1, sizeof **ctx); - return *ctx == NULL ? ENOMEM : 0; -} - - -void glite_lbu_FreeDBContext(glite_lbu_DBContext ctx) { - if (ctx) { - assert(ctx->mysql == NULL); - free(ctx->err.desc); - free(ctx); - } -} - - -int glite_lbu_DBConnect(glite_lbu_DBContext ctx, const char *cs) { - if (db_connect(ctx, cs, &ctx->mysql) != 0) return STATUS(ctx); - return 0; -} - - -void glite_lbu_DBClose(glite_lbu_DBContext ctx) { - db_close(ctx->mysql); - ctx->mysql = NULL; -} - - -int glite_lbu_DBQueryCaps(glite_lbu_DBContext ctx) { - MYSQL *m = ctx->mysql; - MYSQL *m2; - int major,minor,sub,version,caps,have_transactions=0; - const char *ver_s; - - if (ctx->have_caps) return ctx->caps; - - caps = 0; - - ver_s = mysql_get_server_info(m); - if (!ver_s || 3 != sscanf(ver_s,"%d.%d.%d",&major,&minor,&sub)) - return ERR(ctx, EINVAL, "problem retreiving MySQL version"); - version = 10000*major + 100*minor + sub; - - if (version >= GLITE_LBU_MYSQL_INDEX_VERSION) caps |= GLITE_LBU_DB_CAP_INDEX; - if (version >= GLITE_LBU_MYSQL_PREPARED_VERSION) caps |= GLITE_LBU_DB_CAP_PREPARED; - - CLR_ERR(ctx); - - if (db_connect(ctx, ctx->cs, &m2) == 0) { - transaction_test(ctx, m2, &have_transactions); - db_close(m2); - } - if (have_transactions) caps |= GLITE_LBU_DB_CAP_TRANSACTIONS; - - if (STATUS(ctx) == 0) { - ctx->have_caps = 1; - return caps; - } else return -1; -} - - -void glite_lbu_DBSetCaps(glite_lbu_DBContext ctx, int caps) { - ctx->caps = caps; -} - - -int glite_lbu_Transaction(glite_lbu_DBContext ctx) { - if (USE_TRANS(ctx)) { - if (glite_lbu_ExecSQL(ctx, "SET AUTOCOMMIT=0", NULL) < 0) goto err; - if (glite_lbu_ExecSQL(ctx, "BEGIN", NULL) < 0) goto err; - } -err: - return STATUS(ctx); -} - - -int glite_lbu_Commit(glite_lbu_DBContext ctx) { - if (USE_TRANS(ctx)) { - if (glite_lbu_ExecSQL(ctx, "COMMIT", NULL) < 0) goto err; - if (glite_lbu_ExecSQL(ctx, "SET AUTOCOMMIT=1", NULL) < 0) goto err; - } -err: - return STATUS(ctx); -} - - -int glite_lbu_Rollback(glite_lbu_DBContext ctx) { - if (USE_TRANS(ctx)) { - if (glite_lbu_ExecSQL(ctx, "ROLLBACK", NULL) < 0) goto err; - if (glite_lbu_ExecSQL(ctx, "SET AUTOCOMMIT=1", NULL) < 0) goto err; - } -err: - return STATUS(ctx); -} - - -int glite_lbu_FetchRow(glite_lbu_Statement stmt, unsigned int n, unsigned long *lengths, char **results) { - memset(results, 0, n * sizeof(*results)); - if (stmt->result) return FetchRowSimple(stmt->ctx, stmt->result, lengths, results); - else return FetchRowPrepared(stmt->ctx, stmt, n, lengths, results); -} - - -void glite_lbu_FreeStmt(glite_lbu_Statement *stmt) { - if (*stmt) { - if ((*stmt)->result) mysql_free_result((*stmt)->result); - if ((*stmt)->stmt) mysql_stmt_close((*stmt)->stmt); - free(*stmt); - *stmt = NULL; - } -} - - -int glite_lbu_QueryIndices(glite_lbu_DBContext ctx, const char *table, char ***key_names, char ****column_names) { - glite_lbu_Statement stmt = NULL; - - int i,j,ret; - -/* XXX: "show index from" columns. Matches at least MySQL 4.0.11 */ - char *showcol[12]; - int Key_name,Seq_in_index,Column_name,Sub_part; - - char **keys = NULL; - int *cols = NULL; - char **col_names = NULL; - - int nkeys = 0; - - char ***idx = NULL; - - Key_name = Seq_in_index = Column_name = Sub_part = -1; - - if (glite_lbu_ExecSQL(ctx,"show index from states",&stmt)<0) - return STATUS(ctx); - - while ((ret = glite_lbu_FetchRow(stmt,sizeof(showcol)/sizeof(showcol[0]),NULL,showcol)) > 0) { - assert(ret <= sizeof showcol/sizeof showcol[0]); - - if (!col_names) { - col_names = malloc(ret * sizeof col_names[0]); - glite_lbu_QueryColumns(stmt,col_names); - for (i=0; i= 0 && Seq_in_index >= 0 && - Column_name >= 0 && Sub_part >= 0); - - } - - for (i=0; imysql, cmd)) { - /* error occured */ - switch (merr = mysql_errno(ctx->mysql)) { - case 0: - break; - case ER_DUP_ENTRY: - ERR(ctx, EEXIST, mysql_error(ctx->mysql)); - return -1; - break; - case CR_SERVER_LOST: - if (retry_nr <= 0) - do_reconnect = 1; - break; - default: - MY_ERR(ctx); - return -1; - break; - } - } - retry_nr++; - } - - if (stmt) { - *stmt = calloc(1, sizeof(**stmt)); - if (!*stmt) { - ERR(ctx, ENOMEM, NULL); - return -1; - } - (**stmt).ctx = ctx; - (**stmt).result = mysql_store_result(ctx->mysql); - if (!(**stmt).result) { - if (mysql_errno(ctx->mysql)) { - MY_ERR(ctx); - *stmt = NULL; - return -1; - } - } - } else { - MYSQL_RES *r = mysql_store_result(ctx->mysql); - mysql_free_result(r); - } -#ifdef LBS_DB_PROFILE - pid = getpid(); - gettimeofday(&end,NULL); - end.tv_usec -= start.tv_usec; - end.tv_sec -= start.tv_sec; - if (end.tv_usec < 0) { end.tv_sec--; end.tv_usec += 1000000; } - - sum.tv_usec += end.tv_usec; - sum.tv_sec += end.tv_sec + sum.tv_usec / 1000000; - sum.tv_usec -= 1000000 * (sum.tv_usec / 1000000); - fprintf(stderr,"[%d] %s\n[%d] %3ld.%06ld (sum: %3ld.%06ld)\n",pid,txt,pid,end.tv_sec,end.tv_usec,sum.tv_sec,sum.tv_usec); -#endif - - return mysql_affected_rows(ctx->mysql); -} - - -int glite_lbu_QueryColumns(glite_lbu_Statement stmt, char **cols) -{ - int i = 0; - MYSQL_FIELD *f; - - if (!stmt->result) return ERR(stmt->ctx, EINVAL, "QueryColumns implemented only for simple API"); - while ((f = mysql_fetch_field(stmt->result))) cols[i++] = f->name; - return i == 0; -} - - -void glite_lbu_TimeToDB(time_t t, char **str) { - struct tm *tm = gmtime(&t); - - asprintf(str,"'%4d-%02d-%02d %02d:%02d:%02d'",tm->tm_year+1900,tm->tm_mon+1, - tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); -} - - -time_t glite_lbu_DBToTime(const char *str) { - struct tm tm; - - memset(&tm,0,sizeof(tm)); - setenv("TZ","UTC",1); tzset(); - sscanf(str,"%4d-%02d-%02d %02d:%02d:%02d", - &tm.tm_year,&tm.tm_mon,&tm.tm_mday, - &tm.tm_hour,&tm.tm_min,&tm.tm_sec); - tm.tm_year -= 1900; - tm.tm_mon--; - - return mktime(&tm); -} - -/* ---- prepared --- */ - -int glite_lbu_PrepareStmt(glite_lbu_DBContext ctx, const char *sql, glite_lbu_Statement *stmt) { - int ret, retry; - MYSQL_RES *meta; - - // init - *stmt = calloc(1, sizeof(**stmt)); - (*stmt)->ctx = ctx; - - // create the SQL command - if (((*stmt)->stmt = mysql_stmt_init(ctx->mysql)) == NULL) - return MY_ERRSTMT(*stmt); - - // prepare the SQL command - retry = 1; - do { - mysql_stmt_prepare((*stmt)->stmt, sql, strlen(sql)); - ret = MY_ISOKSTMT(*stmt, &retry); - } while (ret == 0); - if (ret == -1) goto failed; - - // number of fields (0 for no results) - if ((meta = mysql_stmt_result_metadata((*stmt)->stmt)) != NULL) { - (*stmt)->nrfields = mysql_num_fields(meta); - mysql_free_result(meta); - } else - (*stmt)->nrfields = 0; - - return CLR_ERR(ctx); - -failed: - glite_lbu_FreeStmt(stmt); - return STATUS(ctx); -} - - -int glite_lbu_ExecStmt(glite_lbu_Statement stmt, int n, ...) { - int i; - va_list ap; - glite_lbu_DBType type; - char *pchar; - long int *plint; - MYSQL_TIME *ptime; - glite_lbu_DBContext ctx; - int ret, retry; - MYSQL_BIND *binds = NULL; - void **data = NULL; - unsigned long *lens; - - // gather parameters - if (n) { - binds = calloc(n, sizeof(MYSQL_BIND)); - data = calloc(n, sizeof(void *)); - lens = calloc(n, sizeof(unsigned long *)); - } - va_start(ap, n); - for (i = 0; i < n; i++) { - type = va_arg(ap, glite_lbu_DBType); - switch (type) { - case GLITE_LBU_DB_TYPE_TINYINT: - pchar = binds[i].buffer = data[i] = malloc(sizeof(char)); - *pchar = va_arg(ap, int); - break; - - case GLITE_LBU_DB_TYPE_INT: - plint = binds[i].buffer = data[i] = malloc(sizeof(long int)); - *plint = va_arg(ap, long int); - break; - - case GLITE_LBU_DB_TYPE_TINYBLOB: - case GLITE_LBU_DB_TYPE_TINYTEXT: - case GLITE_LBU_DB_TYPE_BLOB: - case GLITE_LBU_DB_TYPE_TEXT: - case GLITE_LBU_DB_TYPE_MEDIUMBLOB: - case GLITE_LBU_DB_TYPE_MEDIUMTEXT: - case GLITE_LBU_DB_TYPE_LONGBLOB: - case GLITE_LBU_DB_TYPE_LONGTEXT: - binds[i].buffer = va_arg(ap, void *); - binds[i].length = &lens[i]; - lens[i] = va_arg(ap, unsigned long); - break; - - case GLITE_LBU_DB_TYPE_VARCHAR: - case GLITE_LBU_DB_TYPE_CHAR: - binds[i].buffer = va_arg(ap, char *); - binds[i].length = &lens[i]; - lens[i] = binds[i].buffer ? strlen((char *)binds[i].buffer) : 0; - break; - - case GLITE_LBU_DB_TYPE_DATE: - case GLITE_LBU_DB_TYPE_TIME: - case GLITE_LBU_DB_TYPE_DATETIME: - case GLITE_LBU_DB_TYPE_TIMESTAMP: - ptime = binds[i].buffer = data[i] = malloc(sizeof(MYSQL_TIME)); - set_time(ptime, va_arg(ap, time_t)); - break; - - case GLITE_LBU_DB_TYPE_NULL: - break; - - default: - assert("unimplemented parameter assign" == NULL); - break; - } - binds[i].buffer_type = glite_type_to_mysql[type]; - } - va_end(ap); - - // bind parameters - if (mysql_stmt_bind_param(stmt->stmt, binds) != 0) { - MY_ERRSTMT(stmt); - goto failed; - } - - // run - ctx = stmt->ctx; - retry = 1; - do { - mysql_stmt_execute(stmt->stmt); - ret = MY_ISOKSTMT(stmt, &retry); - } while (ret == 0); - if (ret == -1) goto failed; - - // result - retry = 1; - do { - mysql_stmt_store_result(stmt->stmt); - ret = MY_ISOKSTMT(stmt, &retry); - } while (ret == 0); - if (ret == -1) goto failed; - - // free params - for (i = 0; i < n; i++) free(data[i]); - free(data); - free(binds); - free(lens); - CLR_ERR(ctx); - return mysql_stmt_affected_rows(stmt->stmt); - -failed: - for (i = 0; i < n; i++) free(data[i]); - free(data); - free(binds); - free(lens); - return -1; -} - - -int glite_lbu_bufferedInsertInit(glite_lbu_DBContext ctx, glite_lbu_bufInsert *bi, void *mysql, const char *table_name, long size_limit, long record_limit, const char *columns) -{ - *bi = calloc(1, sizeof(*bi)); - (*bi)->ctx = ctx; - (*bi)->table_name = strdup(table_name); - (*bi)->columns = strdup(columns); - (*bi)->rec_num = 0; - (*bi)->rec_size = 0; - (*bi)->rows = calloc(record_limit, sizeof(*((*bi)->rows)) ); - (*bi)->size_limit = size_limit; - (*bi)->record_limit = record_limit; - - return CLR_ERR(ctx); -} - - -static int flush_bufferd_insert(glite_lbu_bufInsert bi) -{ - char *stmt, *vals, *temp; - long i; - - - if (!bi->rec_num) - return STATUS(bi->ctx); - - asprintf(&vals,"(%s)", bi->rows[0]); - for (i=1; i < bi->rec_num; i++) { - // XXX: use string add (preallocated memory) - asprintf(&temp,"%s,(%s)", vals, bi->rows[i]); - free(vals); vals = temp; temp = NULL; - free(bi->rows[i]); - bi->rows[i] = NULL; - } - - trio_asprintf(&stmt, "insert into %|Ss(%|Ss) values %s;", - bi->table_name, bi->columns, vals); - - if (glite_lbu_ExecSQL(bi->ctx,stmt,NULL) < 0) { - if (STATUS(bi->ctx) == EEXIST) - CLR_ERR(bi->ctx); - } - - /* reset bi counters */ - bi->rec_size = 0; - bi->rec_num = 0; - - free(vals); - free(stmt); - - return STATUS(bi->ctx); -} - - -int glite_lbu_bufferedInsert(glite_lbu_bufInsert bi, const char *row) -{ - bi->rows[bi->rec_num++] = strdup(row); - bi->rec_size += strlen(row); - - if ((bi->size_limit && bi->rec_size >= bi->size_limit) || - (bi->record_limit && bi->rec_num >= bi->record_limit)) - { - if (flush_bufferd_insert(bi)) - return STATUS(bi->ctx); - } - - return CLR_ERR(bi->ctx); -} - - -static void free_buffered_insert(glite_lbu_bufInsert bi) { - long i; - - free(bi->table_name); - free(bi->columns); - for (i=0; i < bi->rec_num; i++) { - free(bi->rows[i]); - } - free(bi->rows); -} - - -int glite_lbu_bufferedInsertClose(glite_lbu_bufInsert bi) -{ - if (flush_bufferd_insert(bi)) - return STATUS(bi->ctx); - free_buffered_insert(bi); - - return CLR_ERR(bi->ctx); -} - - -/* - * helping compatibility function: clear error from the context - */ -static int lbu_clrerr(glite_lbu_DBContext ctx) { - ctx->err.code = 0; - if (ctx->err.desc) { - free(ctx->err.desc); - ctx->err.desc = NULL; - } - return 0; -} - - -/* - * helping compatibility function: sets error on the context - */ -static int lbu_err(glite_lbu_DBContext ctx, int code, const char *desc, const char *func, int line) { - if (code) { - ctx->err.code = code; - free(ctx->err.desc); - ctx->err.desc = desc ? strdup(desc) : NULL; - dprintf(ctx, "[db %d] %s:%d %s\n", getpid(), func, line, desc); - return code; - } else - return ctx->err.code; -} - - -/* - * helping function: find oud mysql error and sets on the context - */ -static int myerr(glite_lbu_DBContext ctx, const char *source, int line) { - return lbu_err(ctx, EIO, mysql_error(ctx->mysql), source, line); -} - - -/* - * helping function: find oud mysql stmt error and sets on the context - */ -static int myerrstmt(glite_lbu_Statement stmt, const char *source, int line) { - return lbu_err(stmt->ctx, EIO, mysql_stmt_error(stmt->stmt), source, line); -} - - -/* - * Ehelping function: error handle - * - * \return -1 failed - * \return 0 retry - * \return 1 OK - */ -static int myisokstmt(glite_lbu_Statement stmt, const char *source, int line, int *retry) { - switch (mysql_stmt_errno(stmt->stmt)) { - case 0: - return 1; - break; - case ER_DUP_ENTRY: - lbu_err(stmt->ctx, EEXIST, mysql_stmt_error(stmt->stmt), source, line); - return -1; - break; - case CR_SERVER_LOST: - if (*retry > 0) { - (*retry)--; - return 0; - } else - return -1; - break; - default: - myerrstmt(stmt, source, line); - return -1; - break; - } -} - - -/* - * mysql connect - */ -static int db_connect(glite_lbu_DBContext ctx, const char *cs, MYSQL **mysql) { - char *buf = NULL; - char *host,*user,*pw,*db; - char *slash,*at,*colon; - int ret; - - // needed for SQL result parameters - assert(sizeof(int) >= sizeof(my_bool)); - - if (!cs) return ERR(ctx, EINVAL, "connect string not specified"); - - if (!(*mysql = mysql_init(NULL))) return ERR(ctx, ENOMEM, NULL); - - mysql_options(*mysql, MYSQL_READ_DEFAULT_FILE, "my"); - - host = user = pw = db = NULL; - - buf = strdup(cs); - slash = strchr(buf,'/'); - at = strrchr(buf,'@'); - colon = strrchr(buf,':'); - - if (!slash || !at || !colon) { - free(buf); - db_close(*mysql); - *mysql = NULL; - return ERR(ctx, EINVAL, "Invalid DB connect string"); - } - - *slash = *at = *colon = 0; - host = at+1; - user = buf; - pw = slash+1; - db = colon+1; - - /* ljocha: CLIENT_FOUND_ROWS added to make authorization check - * working in update_notif(). - * Hope it does not break anything else */ - if (!mysql_real_connect(*mysql,host,user,pw,db,0,NULL,CLIENT_FOUND_ROWS)) { - free(buf); - ret = MY_ERR(ctx); - glite_lbu_DBClose(ctx); - return ret; - } - free(buf); - - ctx->cs = cs; - return 0; -} - - -/* - * mysql close - */ -static void db_close(MYSQL *mysql) { - if (mysql) mysql_close(mysql); -} - - -/* - * test transactions capability: - * - * 1) with connection 1 create testing table test - * 2) with connection 1 insert a value - * 3) with connection 2 look for a value, transactions are for no error and - * no items found - * 4) with connection 1 commit and drop the table - */ -static int transaction_test(glite_lbu_DBContext ctx, MYSQL *m2, int *have_transactions) { - MYSQL *m1; - char *desc, *cmd_create, *cmd_insert, *cmd_select, *cmd_drop; - int retval; - int err; - pid_t pid; - - ctx->caps |= GLITE_LBU_DB_CAP_TRANSACTIONS; - pid = getpid(); - *have_transactions = 0; - - asprintf(&cmd_create, "CREATE TABLE test%d (item INT) ENGINE='innodb'", pid); - asprintf(&cmd_insert, "INSERT INTO test%d (item) VALUES (1)", pid); - asprintf(&cmd_select, "SELECT item FROM test%d", pid); - asprintf(&cmd_drop, "DROP TABLE test%d", pid); - - m1 = ctx->mysql; - //glite_lbu_ExecSQL(ctx, cmd_drop, NULL); - if (glite_lbu_ExecSQL(ctx, cmd_create, NULL) != 0) goto err1; - if (glite_lbu_Transaction(ctx) != 0) goto err2; - if (glite_lbu_ExecSQL(ctx, cmd_insert, NULL) != 1) goto err2; - - ctx->mysql = m2; - if ((retval = glite_lbu_ExecSQL(ctx, cmd_select, NULL)) == -1) goto err2; - - ctx->mysql = m1; - if (glite_lbu_Commit(ctx) != 0) goto err2; - if (glite_lbu_ExecSQL(ctx, cmd_drop, NULL) != 0) goto err1; - -#ifdef LBS_DB_PROFILE - fprintf(stderr, "[%d] use_transactions = %d\n", getpid(), USE_TRANS(ctx)); -#endif - - *have_transactions = retval == 0; - goto ok; -err2: - err = ctx->err.code; - desc = ctx->err.desc; - glite_lbu_ExecSQL(ctx, cmd_drop, NULL); - ctx->err.code = err; - ctx->err.desc = desc; -err1: -ok: - free(cmd_create); - free(cmd_insert); - free(cmd_select); - free(cmd_drop); - return STATUS(ctx); -} - - -/* - * simple version of the fetch - */ -static int FetchRowSimple(glite_lbu_DBContext ctx, MYSQL_RES *result, unsigned long *lengths, char **results) { - MYSQL_ROW row; - int nr, i; - unsigned long *len; - - CLR_ERR(ctx); - - if (!(row = mysql_fetch_row(result))) { - if (mysql_errno((MYSQL *) ctx->mysql)) { - MY_ERR(ctx); - return -1; - } else return 0; - } - - nr = mysql_num_fields(result); - len = mysql_fetch_lengths(result); - for (i=0; inrfields) { - ERR(ctx, EINVAL, "bad number of result fields"); - return -1; - } - - // space for results - if (n) binds = calloc(n, sizeof(MYSQL_BIND)); - if (!lengths) { - lens = calloc(n, sizeof(unsigned long)); - lengths = lens; - } - for (i = 0; i < n; i++) { - binds[i].buffer_type = MYSQL_TYPE_VAR_STRING; - binds[i].buffer_length = GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH - 1; - binds[i].length = &lengths[i]; - binds[i].buffer = results[i] = calloc(1, GLITE_LBU_DEFAULT_RESULT_BUFFER_LENGTH); - } - if (mysql_stmt_bind_result(stmt->stmt, binds) != 0) goto failedstmt; - - // fetch data, all can be truncated - retry = 1; - do { - switch(mysql_stmt_fetch(stmt->stmt)) { -#ifdef MYSQL_DATA_TRUNCATED - case MYSQL_DATA_TRUNCATED: -#endif - case 0: - ret = 1; break; - case 1: ret = MY_ISOKSTMT(stmt, &retry); break; - case MYSQL_NO_DATA: ret = 0; goto quit; /* it's OK */ - default: ERR(ctx, EIO, "other fetch error"); goto failed; - } - } while (ret == 0); - if (ret == -1) goto failed; - - // check if all fileds had enough buffer space - for (i = 0; i < n; i++) { - // fetch the rest if needed - if (lengths[i] > binds[i].buffer_length) { - unsigned int fetched; - - fetched = binds[i].buffer_length; - if ((results[i] = realloc(results[i], lengths[i] + 1)) == NULL) { - ERR(ctx, ENOMEM, "insufficient memory for field data"); - goto failed; - } - results[i][lengths[i]] = '\000'; - binds[i].buffer = results[i] + fetched; - binds[i].buffer_length = lengths[i] - fetched; - - retry = 1; - do { - switch (mysql_stmt_fetch_column(stmt->stmt, binds + i, i, fetched)) { - case 0: ret = 1; break; - case 1: ret = MY_ISOKSTMT(stmt, &retry); break; - case MYSQL_NO_DATA: ret = 0; goto quit; /* it's OK */ - default: ERR(ctx, EIO, "other fetch error"); goto failed; - } - } while (ret == 0); - if (ret == -1) goto failed; - } - } - - CLR_ERR(ctx); - free(binds); - free(lens); - return n; - -failedstmt: - MY_ERRSTMT(stmt); -failed: - ret = -1; -quit: - free(binds); - free(lens); - for (i = 0; i < n; i++) { - free(results[i]); - results[i] = NULL; - } - return ret; -} - - -void set_time(MYSQL_TIME *mtime, const time_t time) { - struct tm tm; - - gmtime_r(&time, &tm); - memset(mtime, 0, sizeof *mtime); - mtime->year = tm.tm_year + 1900; - mtime->month = tm.tm_mon + 1; - mtime->day = tm.tm_mday; - mtime->hour = tm.tm_hour; - mtime->minute = tm.tm_min; - mtime->second = tm.tm_sec; -} - - -time_t get_time(const MYSQL_TIME *mtime) { - struct tm tm; - - memset(&tm, 0, sizeof(tm)); - setenv("TZ","UTC",1); tzset(); - tm.tm_year = mtime->year - 1900; - tm.tm_mon = mtime->month - 1; - tm.tm_mday = mtime->day; - tm.tm_hour = mtime->hour; - tm.tm_min = mtime->minute; - tm.tm_sec = mtime->second; - - return mktime(&tm); -} diff --git a/org.glite.lbjp-utils.jobid/.cvsignore b/org.glite.lbjp-utils.jobid/.cvsignore deleted file mode 100644 index 1df717b..0000000 --- a/org.glite.lbjp-utils.jobid/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.lbjp-utils.jobid/LICENSE b/org.glite.lbjp-utils.jobid/LICENSE deleted file mode 100644 index 01b973b..0000000 --- a/org.glite.lbjp-utils.jobid/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lbjp-utils.jobid/Makefile b/org.glite.lbjp-utils.jobid/Makefile deleted file mode 100644 index 986b5e0..0000000 --- a/org.glite.lbjp-utils.jobid/Makefile +++ /dev/null @@ -1,98 +0,0 @@ -# Default values -top_srcdir=. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -package=glite-lb-utils-jobid -version=0.0.0 -PREFIX=/opt/glite -lbuprefix=lbu - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -VPATH=${top_srcdir}/src:${top_srcdir}/test::${top_srcdir}/doc - -CC=gcc - -DEBUG:=-g -O0 -Wall - -CFLAGS:=${DEBUG} -I${top_srcdir}/src -I${top_srcdir}/interface -I. -D_GNU_SOURCE - -COMPILE:=libtool --mode=compile ${CC} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -OBJS:=cjobid.o strmd5.o -LOBJS:=${OBJS:.o=.lo} - -HDRS:=cjobid.h strmd5.h Exception.h JobId.h JobIdExceptions.h - -STATICLIB:=libglite_lbu_jobid.a -LTLIB:=libglite_lbu_jobid.la - -default: all - -all compile: ${STATICLIB} ${LTLIB} - -# to use libtool versioning correcty, we should have: -# -# current = major + minor + offset -# revision = patch -# age = minor -# -# where offset is a sum of maximal released minor's of all previous major's -# -# version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :` - -# counted minors: n/a -offset=0 - -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${OBJS} - ${LINK} ${version_info} -o $@ ${LOBJS} - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -check: - @true - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - mkdir -p ${PREFIX}/lib - mkdir -p ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${LTLIB} ${PREFIX}/lib - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - if [ x${DOSTAGE} = xyes ]; then \ - mkdir -p ${PREFIX}/include/${globalprefix}/${lbuprefix} ; \ - (cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbuprefix}) ; \ - install -m 644 ${STATICLIB} ${PREFIX}/lib; \ - fi - -clean: - -%.o: %.c - ${COMPILE} ${CFLAGS} -c $< diff --git a/org.glite.lbjp-utils.jobid/interface/Exception.h b/org.glite.lbjp-utils.jobid/interface/Exception.h deleted file mode 100644 index 21a9064..0000000 --- a/org.glite.lbjp-utils.jobid/interface/Exception.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H -#define GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H - -/* - * Exception.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - * Contributors are mentioned in the code where appropriate. - */ - -#include -#include -//#include -#include // For logging exceptions to log file -#include // list the exception codes -#include -#include -#include // base ancestor stl::exception - - -namespace glite { - namespace lb_utils { - namespace exception { - -extern pthread_mutex_t METHOD_MUTEX; // used in order to store info into a file (rather then syslog) -#define GLITE_STACK_TRY(method_name) std::string METHOD = method_name ; int LINE = __LINE__ ; try { -#define GLITE_STACK_CATCH() } catch (glite::lb_utils::exception::Exception &exc){ exc.push_back ( __FILE__ , LINE, METHOD ); throw exc ; } catch (std::exception &ex){ glite::lb_utils::exception::Exception exc( __FILE__ , LINE, METHOD, 0, "Standard exception: " + std::string(ex.what()) ); throw exc; } - -/** - * The Exception base classe contains attributes into which are placed exception information and provides - * constructor that beyond the error code take parameters specifying the source file and line number - * (e.g. through __FILE__ and __LINE__) where the error has been generated and string messages, - * allowing an easy way of storing the origin of the exception. - * Moreover it provides methods for getting all the exception information and for logging them either - * in a log file or to the syslog daemon. - * Each of the derived types may contain its private attributes describing the actual error instance in detail. - * Moreover each exception has an attribute representing the exception identifier that is set by the - * class constructor and allows the identification of the original exception. - * - * @version 0.1 - * @date 22 July 2004 - * @author Alessandro Maraschini -*/ - -class Exception : public std::exception{ - public: - /** - * Constructor Update all mandatory fields - * @param method the name of the method that raised the exception - * @param source The source that raised the exception (could be the file path, the class Name, etc etc) - * @param exc the previous exception as in the stack trace */ - Exception ( const std::string& source, const std::string& method, Exception *exc); - /** - * Constructor Update all mandatory fields - * @param code the code representing the thrown exception - * @param exception the name of the thrown exception - * @param method the name of the method that raised the exception - * @param source The source that raised the exception (could be the file path, the class Name, etc etc) */ - Exception ( const std::string& source, const std::string& method, int code, const std::string& exception); - - /** - * Constructor Update all mandatory fields - * @param source the path of the file that raised the exception - * @param line_number the number of the line in the file that raised the exception - * @param method the name of the method that raised the exception - * @param code the code representing the thrown exception - * @param exception the name of the thrown exception */ - Exception (const std::string& source, int line_number, const std::string& method, int code, const std::string& exception); - /** - * Default Destructor - */ - virtual ~Exception() throw (); - /** - * Return a string debug message containing information about Exception thrown - * Debug message contains all the attributes stored in an exception instance such as the method, the file and the line - * that threw the exception. - *@return the debug message string representation - */ - virtual std::string dbgMessage(); - /** - * Return the error code - * @return The integer representing the code of the error that generated the exception - */ - virtual int getCode(); - - /** - * return the Error Message associated to the Exception - * @return The Exception string message representation - */ - virtual const char* what() const throw (); - - /** - * Print Exception error information into a log file - * @param logfile the file where to log exception information - */ - virtual void log(const std::string& logfile = ""); - /** - * Retrieve the Exception name - * @return the name of the Exception thrown - */ - virtual std::string getExceptionName(); - - /** - * Retrieve the Stack of the exception as a list of previous generated exceptions - *@return the string representation of the stack trace: each line correspond to an exception message - */ - virtual std::string printStackTrace() ; - /** - * Return the list of methods that caused the Exception - */ - virtual std::vector getStackTrace() ; - /** - * Update stack information - */ - virtual void push_back ( const std::string& source, int line_number, const std::string& method ) ; - protected: - /** Empty constructor*/ - Exception(); - /** integer error code representing the cause of the error */ - int error_code; - /** string exception message representation*/ - std::string error_message ; - /** line number where the exception was raised */ - int line; - /** The name of the file where the exception was raised */ - std::string source_file; - /** the name of the exception */ - std::string exception_name; - /** the name of the method where the expceiton was raised */ - std::string method_name ; - /** a string representation of the stacktrace */ - std::string stack; - /** the actual internal stacktrace representation */ - std::vector< std::string> stack_strings ; - /** the name of the ancestor exception */ - std::string ancestor ; -}; //End Exception Class -}}} // Closing namespace -#endif diff --git a/org.glite.lbjp-utils.jobid/interface/JobId.h b/org.glite.lbjp-utils.jobid/interface/JobId.h deleted file mode 100644 index b99992d..0000000 --- a/org.glite.lbjp-utils.jobid/interface/JobId.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_JOBID_H -#define GLITE_WMSUTILS_JOBID_JOBID_H - -/* - * JobId.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - * - */ - -#include -#include - -#include "glite/lb-utils/cjobid.h" - -typedef struct _glite_lbu_jobid_s* glite_lbu_jobid_t; - -namespace glite { -namespace lb_utils { -namespace jobid { - -/** - * Managing Identification, checking, retreiving info from a job - * File name: JobId.h - * The JobId class provides a representation of the Datagrid job identifier - * (dg_jobId) and the methods for manipulating it. - * We remind that the format of the dg_jobId is as follows: - * :/ - * - * @ingroup common - * @version 0.1 - * @date 15 April 2002 - * @author Alessandro Maraschini */ - -class JobId { -public: - /**@name Constructors/Destructor */ - //@{ - /** Instantiates an empty JobId object */ - JobId() ; - /** - * Instantiates a JobId object from the passed dg_jobId in string format. - * @param job_id_string a string representig a classAd expression - * @throws WrongIdException When a string is passed in a wrong format - */ - JobId(const std::string& job_id_string); - JobId(const JobId&); - JobId(const glite_lbu_JobId&); - /** - * Destructor - * Destroy the Job Id instance - */ - ~JobId() ; - //@} - - /**@name Miscellaneous */ - //@{ - /** Unsets the JobId instance. Clear all it's memebers */ - void clear() ; - /** - * Check wheater the jobId has been already created (true) or not (false) - *@return true (jobId created) or false (jobId not yet created) - */ - bool isSet() { return ( m_JobId != 0 ) ; } - /** - * Set the JobId instance according to the LB and RB server addresses and the unique string passed as input parameters. - * @param lb_server Loggin and Bookkeeping server address - * @param port Loggin and Bookkeeping port ( dafault value is 9000 ) - * @param unique A Unique identification ( automatically generatad by md5 protocol ) - * @throws WrongIdException When one parameter has been passed in a wrong format */ - void setJobId(const std::string& lb_server, int port = 0, const std::string& unique = ""); - //@} - /**@name Get Methods */ - //@{ - /** @return the LB address into its string format - * @throws EmptyIdException If the jobId has not been initialised yet */ - std::string getServer() const; - /** @return the Unique string into its string format - * @throws EmptyIdException If the jobId has not been initialised yet */ - std::string getUnique() const; - //@} - /** This method sets the JobId instance from the JobId in string format given - * as input. - * @param dg_JobId the string representing the job - * @throws WrongIdException When a string is passed in a wrong format */ - void fromString ( const std::string& dg_JobId ); - /** Converts the jobId into a string - @return the string representation of a JobId*/ - std::string toString() const; - /** casting operator */ - operator const glite_lbu_JobId() const { return m_JobId; } - /** Operator "=" create a deep copy of the JobId instance*/ - JobId & operator=(JobId const &); - /** Operator "=" create a deep copy of the JobId instance*/ - JobId & operator=(const glite_lbu_JobId &); - /** Retrieve the internal id reference - *@return the JobId internal reference used by some LB methods */ - glite_lbu_JobId getId() const ; -private: - // This Variable stores the Job unique identification String - glite_lbu_JobId m_JobId; - mutable char* m_pStr; - mutable char* m_pBkserver; - mutable char* m_pUnique; - /** Operator "<"*/ - friend bool operator<(JobId const& lhs, JobId const& rhs); - /** Operator "=="*/ - friend bool operator==(JobId const& lhs, JobId const& rhs); -}; - -inline bool operator<(JobId const& lhs, JobId const& rhs) -{ - return strcmp ( lhs.m_pStr , rhs.m_pStr ) <0 ; -} - -inline bool operator==(JobId const& lhs, JobId const& rhs) -{ -return strcmp ( lhs.m_pStr , rhs.m_pStr ) ==0 ; -} - -std::ostream& operator<<(std::ostream& os, JobId const& id); - -} // namespace jobid -} // namespace lb_utils -} // namespace glite - -#endif // GLITE_WMSUTILS_JOBID_JOBID_H diff --git a/org.glite.lbjp-utils.jobid/interface/JobIdExceptions.h b/org.glite.lbjp-utils.jobid/interface/JobIdExceptions.h deleted file mode 100644 index d154adf..0000000 --- a/org.glite.lbjp-utils.jobid/interface/JobIdExceptions.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_EXCEPTIONS_H -#define GLITE_WMSUTILS_JOBID_EXCEPTIONS_H - -/* - * JobIdExceptions.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - */ - -#include "glite/lb-utils/Exception.h" - -namespace glite { -namespace lb_utils { -namespace jobid { - -/** - * JobIdException - Exception thrown by JobId Class - * @ingroup Common - * @version 0.1 - * @date 15 April 2002 - * @author Alessandro Maraschini -*/ - -class JobIdException : public glite::lb_utils::exception::Exception { -public: - /** - * Update all mandatory Exception Information - */ - JobIdException (const std::string& file, - int line, - const std::string& method, - int code, - const std::string& exception_name) ; -};//End CLass JobIdException - -/** -* WrongIdFieldException -* This Exception is thrown when a Job Id syntax error is found -* A valid Job Identification string should be made as follows: -* :/ */ -class WrongIdException : public JobIdException { -public: - /** - * Constructor - * @param file - The source file which has generated the Exception - * @param line - The line number in the source file where the Exception has been thrown - * @param method - The Name of the method which has thrown the Exception - * @param code - The Code of the Error raised - * @param field - The wrong expression catched */ - WrongIdException(const std::string& file, - int line, - const std::string& method, - int code ); -}; //End CLass WrongIdException -/** -* EmptyIdException -* This Exception is thrown when the user tries to get information from a JobId -* which has not been initialized yet, i.e tries to use the get Methods -*/ -class EmptyIdException : public JobIdException { -public: - /** - * Constructor - * @param file - The source file which has generated the Exception - * @param line - The line number in the source file where the Exception has been thrown - * @param method - The Name of the method which has thrown the Exception - * @param code - The Code of the Error raised - * @param field - The Empty filed requested for */ - EmptyIdException::EmptyIdException(const std::string& file, - int line, - const std::string& method, - int code , - const std::string& field ); -}; //End CLass EmptyIdException - -} // namespace jobid -} // namespace lb_utils -} // namespace glite - -#endif // GLITE_WMSUTILS_JOBID_EXCEPTIONS_H - diff --git a/org.glite.lbjp-utils.jobid/interface/cjobid.h b/org.glite.lbjp-utils.jobid/interface/cjobid.h deleted file mode 100644 index f802ce7..0000000 --- a/org.glite.lbjp-utils.jobid/interface/cjobid.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _GLITE_JOBID_H -#define _GLITE_JOBID_H - -/*! - * \file cjobid.h - * \brief L&B consumer API - */ - -#ident "$Header$" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _glite_lbu_JobId *glite_lbu_JobId; - -#define GLITE_WMSC_JOBID_DEFAULT_PORT 9000 /**< Default port where bookkeeping server listens */ -#define GLITE_WMSC_JOBID_PROTO_PREFIX "https://" /**< JobId protocol prefix */ - - -/* All the pointer functions return malloc'ed objects (or NULL on error) */ - -/** - * Create a Job ID. - * See the lb_draft document for details on its construction and components - * \param bkserver book keeping server hostname - * \param port port for the bk service - * \param jobid new created job id - * \ret al 0 success - * \retval EINVAL invalid bkserver - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdCreate(const char * bkserver, int port, glite_lbu_JobId * jobid); - -/** - * Recreate a Job ID - * \param bkserver bookkeeping server hostname - * \param port port for the bk service - * \param unique string which represent created jobid (if NULL then new - * one is created) - * \param jobid new created job id - * \retval 0 success - * \retval EINVAL invalid bkserver - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdRecreate(const char *bkserver, int port, const char * unique, glite_lbu_JobId * jobid); - -/** - * Create copy of Job ID - * \param in jobid for duplication - * \param jobid duplicated jobid - * \retval 0 for success - * \retval EINVAL invalid jobid - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdDup(const glite_lbu_JobId in, glite_lbu_JobId * jobid); - -/* - * Free jobid structure - * \param jobid for dealocation - */ -void glite_lbu_JobIdFree(glite_lbu_JobId jobid); - -/** - * Parse Job ID string and creates jobid structure - * \param jobidstr string representation of jobid - * \param jobid parsed job id - * \retval 0 for success - * \retval EINVAL jobidstr can't be parsed - * \retval ENOMEM if memory allocation fails - */ -int glite_lbu_JobIdParse(const char* jobidstr, glite_lbu_JobId * jobid); - -/** - * Unparse Job ID (produce the string form of JobId). - * \param jobid to be converted to string - * \return allocated string which represents jobid - */ -char* glite_lbu_JobIdUnparse(const glite_lbu_JobId jobid); - -/** - * Extract bookkeeping server address (address:port) - * \param jobid from which the bkserver address should be extracted - * \retval pointer to allocated string with bkserver address - * \retval NULL if jobid is 0 or memory allocation fails - */ -char* glite_lbu_JobIdGetServer(const glite_lbu_JobId jobid); - -/** - * Extract bookkeeping server address and port - * \param jobid from which the bkserver address should be extracted - * \param srvName pointer where to return server name - * \param srvPort pointer where to return server port - * */ -void glite_lbu_JobIdGetServerParts(const glite_lbu_JobId jobid, char **srvName, unsigned int *srvPort); - -/** - * Extract unique string - * \param jobid - * \retval pointer to allocated unique string representing jobid - * \retval NULL if jobid is 0 or memory allocation fails - */ -char* glite_lbu_JobIdGetUnique(const glite_lbu_JobId jobid); - -#ifdef __cplusplus -} -#endif - -#endif /* _GLITE_JOBID_H */ diff --git a/org.glite.lbjp-utils.jobid/interface/strmd5.h b/org.glite.lbjp-utils.jobid/interface/strmd5.h deleted file mode 100644 index 27d8544..0000000 --- a/org.glite.lbjp-utils.jobid/interface/strmd5.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef _GLITE_STRMD5_H -#define _GLITE_STRMD5_H - -#ident "$Header$" - -/* Compute MD5 sum of the first argument. - * The sum is returned in the 16-byte array pointed to by 2nd argument - * (if not NULL) - * - * Return value: ASCII string of the sum, i.e. 32 characters [0-9a-f] - * (pointer to static area, changed by subsequent calls) - */ - -#ifdef USE_MBUF -char *strmd5(const char *src, unsigned char *dst); -#endif - -/** - * Returns: allocated 32bytes long ASCII string with md5 sum - * of the first argument - */ -char *str2md5(const char *src); - -/** - * Returns: allocated 22bytes long ASCII string with md5 sum in base64 - * format of the source argument - */ -char *str2md5base64(const char *src); - -#endif /* _GLITE_STRMD5_H */ diff --git a/org.glite.lbjp-utils.jobid/src/cjobid.c b/org.glite.lbjp-utils.jobid/src/cjobid.c deleted file mode 100644 index 6d6a73f..0000000 --- a/org.glite.lbjp-utils.jobid/src/cjobid.c +++ /dev/null @@ -1,260 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include "cjobid.h" -#include "strmd5.h" - -struct _glite_lbu_JobId { - char *id; /* unique job identification */ - /* additional information */ - char *BShost;/* bookkeeping server hostname */ - unsigned int BSport; /* bookkeeping server port */ - char *info; /* additional information (after ? in URI) */ -}; - -int glite_lbu_JobIdCreate(const char *bkserver, int port, glite_lbu_JobId *jobId) -{ - return glite_lbu_JobIdRecreate(bkserver, port, NULL, jobId); -} - - -int glite_lbu_JobIdRecreate(const char* bkserver, int port, const char *unique, glite_lbu_JobId *jobId) -{ - glite_lbu_JobId out; - char hostname[200]; /* used to hold string for encrypt */ - struct timeval tv; - int skip; - char* portbeg; - - struct hostent* he; - - if (!bkserver) - return EINVAL; - - if (unique == NULL) { - gethostname(hostname, 100); - he = gethostbyname(hostname); - assert(he->h_length > 0); - gettimeofday(&tv, NULL); - srandom(tv.tv_usec); - - skip = strlen(hostname); - skip += sprintf(hostname + skip, "-IP:0x%x-pid:%d-rnd:%d-time:%d:%d", - *((int*)he->h_addr_list[0]), getpid(), (int)random(), - (int)tv.tv_sec, (int)tv.tv_usec); - } - - *jobId = NULL; - out = (glite_lbu_JobId) malloc (sizeof(*out)); - if (!out) - return ENOMEM; - - memset(out, 0, sizeof(*out)); - - /* check if it begins with prefix */ - /* unsupported */ - if (strncmp(bkserver, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX)-1) == 0) - return EINVAL; - - out->BShost = strdup(bkserver); - portbeg = strchr(out->BShost, ':'); - if (portbeg) { - *portbeg = 0; - /* try to get port number */ - if (port == 0) - port = atoi(portbeg + 1); - } - - if (port == 0) - port = GLITE_WMSC_JOBID_DEFAULT_PORT; - - out->BSport = port; - - out->id = (unique) ? strdup(unique) : str2md5base64(hostname); - //printf("Encrypt: %s\nBASE64 %s\n", hostname, out->id); - - if (!out->id || !out->BShost) { - glite_lbu_JobIdFree(out); - return ENOMEM; - } - - *jobId = out; - return 0; -} - - -int glite_lbu_JobIdDup(const glite_lbu_JobId in, glite_lbu_JobId *out) -{ - glite_lbu_JobId jid; - *out = NULL; - if (in == NULL) - return 0; - - jid = malloc(sizeof(*jid)); - if (!jid) - return ENOMEM; - - memset(jid, 0,sizeof(*jid)); - jid->BShost = strdup(in->BShost); - jid->id = strdup(in->id); - if (in->info) - jid->info = strdup(in->info); - - if (jid->BShost == NULL || jid->id == NULL) { - glite_lbu_JobIdFree(jid); - return ENOMEM; - } - - jid->BSport = in->BSport; - *out = jid; - return 0; -} - - -// XXX -// use recreate -// parse name, port, unique -int glite_lbu_JobIdParse(const char *idString, glite_lbu_JobId *jobId) -{ - char *pom, *pom1, *pom2; - glite_lbu_JobId out; - - *jobId = NULL; - - out = (glite_lbu_JobId) malloc (sizeof(*out)); - if (out == NULL ) - return ENOMEM; - - memset(out,0,sizeof(*out)); - - if (strncmp(idString, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1)) { - out->BShost = (char *) NULL; - out->BSport = 0; - - free(out); - return EINVAL; - } - - pom = strdup(idString + sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1); - pom1 = strchr(pom, '/'); - pom2 = strchr(pom, ':'); - - if (!pom1) { free(pom); free(out); return EINVAL; } - - if ( pom2 && (pom1 > pom2)) { - pom[pom2-pom] = '\0'; - out->BShost = strdup(pom); - pom[pom1-pom] = '\0'; - out->BSport = (unsigned int) strtoul(pom2 + 1,NULL,10); - } else { - pom[pom1-pom] = '\0'; - out->BShost = strdup(pom); - out->BSport = GLITE_WMSC_JOBID_DEFAULT_PORT; - } - - /* XXX: localhost not supported in jobid - if (!strncmp(out->BShost,"localhost",9) { - free(pom); - free(out->BShost); - free(out); - return EINVAL; - } - */ - - /* additional info from URI */ - pom2 = strchr(pom1+1,'?'); - if (pom2) { - *pom2 = 0; - out->info = strdup(pom2+1); - } - - /* extract the unique part */ - out->id = strdup(pom1+1); - - for (pom1 = out->BShost; *pom1; pom1++) - if (isspace(*pom1)) break; - - for (pom2 = out->id; *pom2; pom2++) - if (isspace(*pom2)) break; - - if (*pom1 || *pom2) { - free(pom); - glite_lbu_JobIdFree(out); - return EINVAL; - } - - free(pom); - *jobId = out; - return 0; -} - - -void glite_lbu_JobIdFree(glite_lbu_JobId job) -{ - if (job) { - free(job->id); - free(job->BShost); - free(job->info); - free(job); - } -} - - -char* glite_lbu_JobIdUnparse(const glite_lbu_JobId jobid) -{ - char *out, port[40]; - - if (!jobid) - return NULL; - - if (jobid->BSport) - sprintf(port,":%d",jobid->BSport); - else - *port = 0; - - asprintf(&out, GLITE_WMSC_JOBID_PROTO_PREFIX"%s%s/%s%s%s", - jobid->BShost,port, - jobid->id, - (jobid->info ? "?" : ""), - (jobid->info ? jobid->info : "")); - - return out; -} - - -char* glite_lbu_JobIdGetServer(const glite_lbu_JobId jobid) -{ - char *bs = NULL; - - if (jobid) - asprintf(&bs, "%s:%u", jobid->BShost, - jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT); - - return bs; -} - - -void glite_lbu_JobIdGetServerParts(const glite_lbu_JobId jobid, char **srvName, unsigned int *srvPort) -{ - if (jobid) { - *srvName = strdup(jobid->BShost); - *srvPort = jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT; - } -} - - -char* glite_lbu_JobIdGetUnique(const glite_lbu_JobId jobid) -{ - return jobid ? strdup(jobid->id) : NULL; -} diff --git a/org.glite.lbjp-utils.jobid/src/strmd5.c b/org.glite.lbjp-utils.jobid/src/strmd5.c deleted file mode 100644 index 775aee8..0000000 --- a/org.glite.lbjp-utils.jobid/src/strmd5.c +++ /dev/null @@ -1,122 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include - -#include "strmd5.h" - -#if USE_MBUF /* let's try without it */ -#warning Thread unsafe! -static char mbuf[33]; -#endif - -static int base64_encode(const void *enc, int enc_size, char *out, int out_max_size) -{ - static const char* b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; - - unsigned char* enc_buf = (unsigned char*)enc; - int out_size = 0; - unsigned int bits = 0; - unsigned int shift = 0; - - while ( out_size < out_max_size ) { - if ( enc_size>0 ) { - // Shift in byte - bits <<= 8; - bits |= *enc_buf; - shift += 8; - // Next byte - enc_buf++; - enc_size--; - } else if ( shift>0 ) { - // Pad last bits to 6 bits - will end next loop - bits <<= 6 - shift; - shift = 6; - } else { - // Terminate with Mime style '=' - *out = '='; - out_size++; - - return out_size; - } - - // Encode 6 bit segments - while ( shift>=6 ) { - shift -= 6; - *out = b64[ (bits >> shift) & 0x3F ]; - out++; - out_size++; - } - } - - // Output overflow - return -1; -} - -#ifdef USE_MBUF -char *strmd5(const char *s, unsigned char *digest) -{ - MD5_CTX md5; - unsigned char d[16]; - int i; - - MD5_Init(&md5); - MD5_Update(&md5,s,strlen(s)); - MD5_Final(d,&md5); - - if (digest) memcpy(digest,d,sizeof(d)); - - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - mbuf[32] = 0; - return (char *) mbuf; -} -#endif - -char *str2md5(const char *s) -{ - MD5_CTX md5; - unsigned char d[16]; - char* ret = malloc(33); - int i; - - if (!ret) - return NULL; - - MD5_Init(&md5); - MD5_Update(&md5, s, strlen(s)); - MD5_Final(d, &md5); - - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - ret[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - ret[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - ret[32] = 0; - return ret; -} - -char *str2md5base64(const char *s) -{ - MD5_CTX md5; - unsigned char d[16]; - char buf[50]; - int l; - - MD5_Init(&md5); - MD5_Update(&md5, s, strlen(s)); - MD5_Final(d, &md5); - - l = base64_encode(d, 16, buf, sizeof(buf) - 1); - if (l < 1) - return NULL; - buf[l - 1] = 0; - return strdup(buf); -} diff --git a/org.glite.lbjp-utils.server-bones/.cvsignore b/org.glite.lbjp-utils.server-bones/.cvsignore deleted file mode 100644 index 378eac2..0000000 --- a/org.glite.lbjp-utils.server-bones/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build diff --git a/org.glite.lbjp-utils.server-bones/Makefile b/org.glite.lbjp-utils.server-bones/Makefile deleted file mode 100644 index 100ef16..0000000 --- a/org.glite.lbjp-utils.server-bones/Makefile +++ /dev/null @@ -1,95 +0,0 @@ -# defaults -top_srcdir=. -stagedir=. -distdir=. -globalprefix=glite -lbprefix=lb -package=glite-lb-server-bones -version=0.0.1 -PREFIX=/opt/glite - -glite_location=/opt/glite - -CC=gcc - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -VPATH=${top_srcdir}/src:${top_srcdir}/examples - -DEBUG:=-g -O0 -Wall -CFLAGS:= ${DEBUG} -I${top_srcdir}/interface -LDFLAGS:= - -ifdef LB_PROF - CFLAGS:= ${CFLAGS} -pg -g - LDFLAGS:= ${LDFLAGS} -pg -endif - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -STATICLIB:=libglite_lb_server_bones.a -LTLIB:=libglite_lb_server_bones.la - -OBJS:=srvbones.o -LOBJS:=${OBJS:.o=.lo} - -HDRS:=srvbones.h - -default all: compile - -compile: ${STATICLIB} ${LTLIB} example - -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${LOBJS} - ${LINK} -o $@ ${LOBJS} - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -check: - -echo "No unit tests so far." - -example: srv_example cnt_example - -srv_example: srv_example.o - ${LINK} -o $@ ${LTLIB} srv_example.o - -cnt_example: cnt_example.o - ${LINK} -o $@ cnt_example.o - -doc: - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - mkdir -p ${PREFIX}/include/${globalprefix}/${lbprefix} - mkdir -p ${PREFIX}/lib - ${INSTALL} -m 644 ${LTLIB} ${PREFIX}/lib - if [ x${DOSTAGE} = xyes ]; then \ - ${INSTALL} -m 644 ${STATICLIB} ${PREFIX}/lib ; \ - cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbprefix} ; \ - fi - -clean: - -%.o: %.c - ${COMPILE} -c $< diff --git a/org.glite.lbjp-utils.server-bones/examples/cnt_example.c b/org.glite.lbjp-utils.server-bones/examples/cnt_example.c deleted file mode 100644 index 80b6af3..0000000 --- a/org.glite.lbjp-utils.server-bones/examples/cnt_example.c +++ /dev/null @@ -1,179 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; fflush(stdout); } -#endif - -#define DEF_MSG "Test message\n" -#define DEF_PORT 9999 - -static struct option opts[] = { - { "help", no_argument, NULL, 'h'}, - { "debug", no_argument, NULL, 'd'}, - { "msg", required_argument, NULL, 'm'}, - { "port", required_argument, NULL, 'p'}, - { "repeat", required_argument, NULL, 'r'}, -}; - -int debug = 0; -int port = DEF_PORT; -char *msg = NULL; - -static int writen(int fd, char *ptr, int nbytes); -static int readln(int fd, char *out); - -static void usage(char *me) -{ - fprintf(stderr, - "usage: %s [option]\n" - " -h, --help print this screen\n" - " -d, --debug prints debug messages\n" - " -m, --msg message to send\n" - " -p, --port service port\n", me); -} - - -int main(int argc, char **argv) -{ - struct sockaddr_in addr; - char buff[512], - *me; - int opt, - sock, - n; - int repeat = 1; - - me = strrchr(argv[0], '/'); - if ( me ) me++; else me = argv[0]; - while ( (opt = getopt_long(argc, argv,"p:m:hdr:", opts, NULL)) != EOF ) - { - switch ( opt ) - { - case 'm': - msg = strdup(optarg); - break; - case 'p': - port = atoi(optarg); - break; - case 'd': debug = 1; break; - case 'r': repeat = atoi(optarg); break; - case 'h': usage(me); return 0; - case '?': usage(me); return 1; - } - } - - bzero((char *) &addr, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = inet_addr("127.0.0.1"); - addr.sin_port = htons(port); - if ( (sock = socket(AF_INET, SOCK_STREAM, 0)) < 0 ) - { - perror("socket"); - exit(1); - } - if ( connect(sock, (struct sockaddr *) &addr, sizeof(addr)) < 0 ) - { - perror("connect"); - exit(1); - } - n = strlen(msg? msg: DEF_MSG); - for (;repeat; repeat--) { - if ( writen(sock, msg? msg: DEF_MSG, n) != n ) - { - dprintf(("error writing message\n")); - exit(1); - } - printf("reply: "); fflush(stdout); - n = readln(sock, buff); - if ( n < 0 ) - { - perror("read() reply error"); - return 1; - } - writen(0, buff, n); - } - close(sock); - - return 0; -} - -int writen(int fd, char *ptr, int nbytes) -{ - int nleft, nwritten; - - nleft = nbytes; - dprintf(("start writing %d bytes\n", nbytes)); - while ( nleft > 0 ) - { - nwritten = write(fd, ptr, nleft); - dprintf(("written %d bytes", nwritten)); - if ( nwritten <= 0 ) - return (nwritten); - - nleft -= nwritten; - ptr += nwritten; - dprintf((" (left %d bytes)\n", nleft)); - } - - dprintf(("written %d bytes (return: %d)\n", nwritten, nbytes - nleft)); - return (nbytes - nleft); -} - -#define BUFFER_SZ 512 - -int readln(int fd, char *out) -{ - static char buffer[BUFFER_SZ]; - static char *buffer_end = buffer; - int n; - - - dprintf(("reading line\n")); - while ( 1 ) { - if ( buffer_end - buffer ) { - /* buffer contains data - */ - char *endl; - - dprintf(("nonempty buffer\n")); - if ( (endl = memchr(buffer, '\n', buffer_end-buffer)) ) { - int linesz = endl-buffer+1; - - dprintf(("using buffer data\n")); - memcpy(out, buffer, linesz); - if ( endl+1 != buffer_end ) - memmove(buffer, endl+1, buffer_end-endl-1); - buffer_end -= linesz; - return linesz; - } - } - dprintf(("reading...\n")); - n = read(fd, buffer_end, BUFFER_SZ-(buffer_end-buffer)); - if ( n < 0 ) { - if ( errno == EAGAIN ) continue; - dprintf(("reading error\n")); - return n; - } - else if ( n == 0 ) { - int ret = buffer_end-buffer; - dprintf(("end of reading - returning %d bytes\n", ret)); - memcpy(out, buffer, ret); - buffer_end = buffer; - return ret; - } - - dprintf(("read %d bytes\n", n)); - buffer_end += n; - } - - return 0; -} diff --git a/org.glite.lbjp-utils.server-bones/examples/srv_example.c b/org.glite.lbjp-utils.server-bones/examples/srv_example.c deleted file mode 100644 index 0a19ab4..0000000 --- a/org.glite.lbjp-utils.server-bones/examples/srv_example.c +++ /dev/null @@ -1,224 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "srvbones.h" - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; fflush(stdout); } -#endif - -#define sizofa(a) (sizeof(a)/sizeof((a)[0])) - -int debug = 1; - -static int writen(int fd, char *ptr, int nbytes); -static int readln(int fd, char *out, int nbytes); - -static int new_conn(int, struct timeval *, void *); -static int reject(int); -static int disconnect(int, struct timeval *, void *); - -static int echo(int, struct timeval *, void *); -static int upper_echo(int, struct timeval *, void *); - -#define ECHO_PORT 9999 -#define UPPER_ECHO_PORT 9998 - -#define SRV_ECHO 0 -#define SRV_UPPER_ECHO 1 - -static struct glite_srvbones_service service_table[] = { - { "Echo Service", -1, new_conn, echo, reject, disconnect }, - { "Upper Echo Service", -1, new_conn, upper_echo, reject, disconnect } -}; - -int main(void) -{ - struct sockaddr_in myaddr; - - - if ( ((service_table[SRV_ECHO].conn = socket(AF_INET, SOCK_STREAM, 0)) == -1) - || ((service_table[SRV_UPPER_ECHO].conn = socket(AF_INET, SOCK_STREAM, 0)) == -1) ) - { - perror("socket"); - exit(1); - } - - bzero((char *) &myaddr, sizeof(myaddr)); - myaddr.sin_family = AF_INET; - myaddr.sin_addr.s_addr = htonl(INADDR_ANY); - myaddr.sin_port = htons(ECHO_PORT); - if ( bind(service_table[SRV_ECHO].conn, (struct sockaddr *)&myaddr, sizeof(myaddr)) == -1 ) - { - perror("bind"); - exit(1); - } - bzero((char *) &myaddr, sizeof(myaddr)); - myaddr.sin_family = AF_INET; - myaddr.sin_addr.s_addr = htonl(INADDR_ANY); - myaddr.sin_port = htons(UPPER_ECHO_PORT); - if ( bind(service_table[SRV_UPPER_ECHO].conn, (struct sockaddr *)&myaddr, sizeof(myaddr)) == -1 ) - { - perror("bind"); - exit(1); - } - - if ( listen(service_table[SRV_ECHO].conn, 10) - || listen(service_table[SRV_UPPER_ECHO].conn, 10) ) - { - perror("listen()"); - exit(1); - } - - - glite_srvbones_set_param(GLITE_SBPARAM_SLAVES_COUNT, 1); - glite_srvbones_run(NULL, service_table, sizofa(service_table), 1); - - - return 0; -} - -int upper_echo(int fd, struct timeval *to, void *data) -{ - int n, i; - char line[80]; - - n = readln(fd, line, 80); - if ( n < 0 ) - { - perror("read() message"); - return n; - } - else if ( n == 0 ) - return ENOTCONN; - - for ( i = 0; i < n; i++ ) - line[i] = toupper(line[i]); - - if ( writen(fd, line, n) != n ) - { - perror("write() message back"); - return -1; - } - - return 0; -} - -int echo(int fd, struct timeval *to, void *data) -{ - int n; - char line[80]; - - n = readln(fd, line, 80); - dprintf(("%d bytes read\n", n)); - if ( n < 0 ) - { - perror("read() message"); - return n; - } - else if ( n == 0 ) - return ENOTCONN; - - if ( writen(fd, line, n) != n ) - { - perror("write() message back"); - return -1; - } - - return 0; -} - -int new_conn(int conn, struct timeval *to, void *cdata) -{ - dprintf(("srv-bones example: new_conn handler\n")); - return 0; -} - -int reject(int conn) -{ - dprintf(("srv-bones example: reject handler\n")); - return 0; -} - -int disconnect(int conn, struct timeval *to, void *cdata) -{ - dprintf(("srv-bones example: disconnect handler\n")); - return 0; -} - -int writen(int fd, char *ptr, int nbytes) -{ - int nleft, nwritten; - - nleft = nbytes; - dprintf(("start writing %d bytes\n", nbytes)); - while ( nleft > 0 ) { - nwritten = write(fd, ptr, nleft); - dprintf(("written %d bytes", nwritten)); - if ( nwritten <= 0 ) - return (nwritten); - - nleft -= nwritten; - ptr += nwritten; - dprintf((" (left %d bytes)\n", nleft)); - } - - dprintf(("written %d bytes (return: %d)\n", nwritten, nbytes - nleft)); - return (nbytes - nleft); -} - -#define BUFFER_SZ 512 - -int readln(int fd, char *out, int nbytes) -{ - static char buffer[BUFFER_SZ]; - static char *buffer_end = buffer; - int n; - - - dprintf(("reading line\n")); - while ( 1 ) { - if ( buffer_end - buffer ) { - /* buffer contains data - */ - char *endl; - - dprintf(("nonempty buffer\n")); - if ( (endl = memchr(buffer, '\n', buffer_end-buffer)) ) { - int linesz = endl-buffer+1; - - memcpy(out, buffer, linesz); - if ( endl+1 != buffer_end ) memmove(buffer, endl+1, buffer_end-endl-1); - buffer_end -= linesz; - return linesz; - } - } - - dprintf(("reding...\n")); - n = read(fd, buffer_end, BUFFER_SZ-(buffer_end-buffer)); - if ( n < 0 ) { - if ( errno == EAGAIN ) n = 0; - else return n; - } - if ( n == 0 ) { - int ret = buffer_end-buffer; - dprintf(("end of reading - returning %d bytes\n", ret)); - memcpy(out, buffer, ret); - buffer_end = buffer; - return ret; - } - dprintf(("read %d bytes\n", n)); - - buffer_end += n; - } - - return 0; -} diff --git a/org.glite.lbjp-utils.server-bones/interface/srvbones.h b/org.glite.lbjp-utils.server-bones/interface/srvbones.h deleted file mode 100644 index f238705..0000000 --- a/org.glite.lbjp-utils.server-bones/interface/srvbones.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef __ORG_GLITE_LB_SERVER_BONES_BONES_H__ -#define __ORG_GLITE_LB_SERVER_BONES_BONES_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum _glite_srvbones_param_t { - GLITE_SBPARAM_SLAVES_COUNT, /**< number of slaves */ - GLITE_SBPARAM_SLAVE_OVERLOAD, /**< queue items per slave */ - GLITE_SBPARAM_SLAVE_CONNS_MAX, /**< commit suicide after that many connections */ - -/* NULL for timeouts means infinity */ - GLITE_SBPARAM_IDLE_TIMEOUT, /**< keep idle connection that long (timeval) */ - GLITE_SBPARAM_CONNECT_TIMEOUT, /**< timeout for establishing a connection (timeval) */ - GLITE_SBPARAM_REQUEST_TIMEOUT, /**< timeout for a single request (timeval)*/ -} glite_srvbones_param_t; - -typedef int (*slave_data_init_hnd)(void **); - -struct glite_srvbones_service { - char *id; /**< name of the service */ - int conn; /**< listening socket */ - -/** Handler called by slave on a newly established connection, - * i.e. after accept(2). - * \param[in] conn the accepted connection - * \param[inout] timeout don't consume more, update with the remaining time - * \param[inout] user_data arbitrary user data passed among the functions - */ - int (*on_new_conn_hnd)( - int conn, - struct timeval *timeout, - void *user_data - ); - - -/** Handler called by slave to serve each request. - * \param[in] conn connection to work with - * \param[inout] timeout don't consume more, update with the remaining time - * \param[inout] user_data arbitrary user data passed among the functions - * - * \retval 0 OK, connection remains open - * \retval ENOTCON terminated gracefully, bones will clean up - * \retval >0 other POSIX errno, non-fatal error - * \retval <0 fatal error, terminate slave - */ - int (*on_request_hnd)( - int conn, - struct timeval *timeout, - void *user_data - ); - -/** Handler called by master to reject connection on server overload. - * Should kick off the client quickly, not imposing aditional load - * on server or blocking long time. - */ - int (*on_reject_hnd)(int conn); - -/** Handler called by slave before closing the connection. - * Perform server-side cleanup, and terminate the connection gracefully - * if there is a way to do so (the disconnect is server-initiated). - * close(conn) is called by bones then. - * \param[in] conn connection to work with - * \param[inout] timeout don't consume more time - * \param[inout] user_data arbitrary user data passed among the functions - */ - int (*on_disconnect_hnd)( - int conn, - struct timeval *timeout, - void *user_data - ); -}; - -extern int glite_srvbones_set_param(glite_srvbones_param_t param, ...); - - -/** Main server function. - * - * \param[in] slave_data_init_hnd callback initializing user data on every slave - */ -extern int glite_srvbones_run( - slave_data_init_hnd slave_data_init, - struct glite_srvbones_service *service_table, - size_t table_sz, - int dbg); - -#ifdef __cplusplus -} -#endif - -#endif /* __ORG_GLITE_LB_SERVER_BONES_BONES_H__ */ diff --git a/org.glite.lbjp-utils.server-bones/src/srvbones.c b/org.glite.lbjp-utils.server-bones/src/srvbones.c deleted file mode 100644 index 1d42a3f..0000000 --- a/org.glite.lbjp-utils.server-bones/src/srvbones.c +++ /dev/null @@ -1,661 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "srvbones.h" - -/* defaults for GLITE_SBPARAM_* */ - -#define SLAVES_COUNT 5 /* default number of slaves */ -#define SLAVE_OVERLOAD 10 /* queue items per slave */ -#define SLAVE_REQS_MAX 500 /* commit suicide after that many connections */ -#define IDLE_TIMEOUT 30 /* keep idle connection that many seconds */ -#define CONNECT_TIMEOUT 5 /* timeout for establishing a connection */ -#define REQUEST_TIMEOUT 10 /* timeout for a single request */ -#define NEW_CLIENT_DURATION 10 /* how long a client is considered new, i.e. busy - connection is not closed to serve other clients */ - -#ifndef dprintf -#define dprintf(x) { if (debug) printf x; } -#endif - -#ifdef LB_PROF -extern void _start (void), etext (void); -#endif - -static int running = 0; -static int debug = 0; -static volatile int die = 0, - child_died = 0; -static unsigned long clnt_dispatched = 0, - clnt_accepted = 0; - -static struct glite_srvbones_service *services; -static int services_ct; - -static int set_slaves_ct = SLAVES_COUNT; -static int set_slave_overload = SLAVE_OVERLOAD; -static int set_slave_reqs_max = SLAVE_REQS_MAX; -static struct timeval set_idle_to = {IDLE_TIMEOUT, 0}; -static struct timeval set_connect_to = {CONNECT_TIMEOUT, 0}; -static struct timeval set_request_to = {REQUEST_TIMEOUT, 0}; - -static int dispatchit(int, int, int); -static int do_sendmsg(int, int, unsigned long, int); -static int do_recvmsg(int, int *, unsigned long *, int *); -static int check_timeout(struct timeval, struct timeval, struct timeval); -static void catchsig(int); -static void catch_chld(int sig); -static int slave(int (*)(void **), int); - -static void glite_srvbones_set_slaves_ct(int); -static void glite_srvbones_set_slave_overload(int); -static void glite_srvbones_set_slave_conns_max(int); -static void set_timeout(struct timeval *,struct timeval *); - -int glite_srvbones_set_param(glite_srvbones_param_t param, ...) -{ - va_list ap; - - if ( running ) { - dprintf(("Attempting to set srv-bones parameter on running server")); - return -1; - } - - va_start(ap, param); - switch ( param ) { - case GLITE_SBPARAM_SLAVES_COUNT: - glite_srvbones_set_slaves_ct(va_arg(ap,int)); break; - case GLITE_SBPARAM_SLAVE_OVERLOAD: - glite_srvbones_set_slave_overload(va_arg(ap,int)); break; - case GLITE_SBPARAM_SLAVE_CONNS_MAX: - glite_srvbones_set_slave_conns_max(va_arg(ap,int)); break; - case GLITE_SBPARAM_IDLE_TIMEOUT: - set_timeout(&set_idle_to,va_arg(ap,struct timeval *)); break; - case GLITE_SBPARAM_CONNECT_TIMEOUT: - set_timeout(&set_connect_to,va_arg(ap,struct timeval *)); break; - case GLITE_SBPARAM_REQUEST_TIMEOUT: - set_timeout(&set_request_to,va_arg(ap,struct timeval *)); break; - } - va_end(ap); - - return 0; -} - -int glite_srvbones_run( - slave_data_init_hnd slave_data_init, - struct glite_srvbones_service *service_table, - size_t table_sz, - int dbg) -{ - struct sigaction sa; - sigset_t sset; - int sock_slave[2], i; - - - assert(service_table); - assert(table_sz > 0); - - services = service_table; - services_ct = table_sz; - debug = dbg; - - setlinebuf(stdout); - setlinebuf(stderr); - dprintf(("Master pid %d\n", getpid())); - - if ( socketpair(AF_UNIX, SOCK_STREAM, 0, sock_slave) ) - { - perror("socketpair()"); - return 1; - } - - memset(&sa, 0, sizeof(sa)); assert(sa.sa_handler == NULL); - sa.sa_handler = catchsig; - sigaction(SIGINT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); - - sa.sa_handler = catch_chld; - sigaction(SIGCHLD, &sa, NULL); - - sa.sa_handler = SIG_IGN; - sigaction(SIGUSR1, &sa, NULL); - - sigemptyset(&sset); - sigaddset(&sset, SIGCHLD); - sigaddset(&sset, SIGTERM); - sigaddset(&sset, SIGINT); - sigprocmask(SIG_BLOCK, &sset, NULL); - - for ( i = 0; i < set_slaves_ct; i++ ) - slave(slave_data_init, sock_slave[1]); - - while ( !die ) - { - fd_set fds; - int ret, mx; - - - FD_ZERO(&fds); - FD_SET(sock_slave[0], &fds); - for ( i = 0, mx = sock_slave[0]; i < services_ct; i++ ) - { - FD_SET(services[i].conn, &fds); - if ( mx < services[i].conn ) mx = services[i].conn; - } - - sigprocmask(SIG_UNBLOCK, &sset, NULL); - ret = select(mx+1, &fds, NULL, NULL, NULL); - sigprocmask(SIG_BLOCK, &sset, NULL); - - if ( ret == -1 && errno != EINTR ) - { - if ( debug ) perror("select()"); - else syslog(LOG_CRIT,"select(): %m"); - - return 1; - } - - if ( child_died ) - { - int pid; - - while ( (pid = waitpid(-1, NULL, WNOHANG)) > 0 ) - { - if ( !die ) - { - int newpid = slave(slave_data_init, sock_slave[1]); - dprintf(("[master] Servus mortuus [%d] miraculo resurrexit [%d]\n", pid, newpid)); - } - } - child_died = 0; - continue; - } - - if ( die ) continue; - - - if (FD_ISSET(sock_slave[0],&fds)) { - /* slave accepted a request - */ - unsigned long a; - - if ( (recv(sock_slave[0], &a, sizeof(a), MSG_WAITALL) == sizeof(a)) - && (a <= clnt_dispatched) - && (a > clnt_accepted || clnt_accepted > clnt_dispatched) ) - clnt_accepted = a; - } - - for ( i = 0; i < services_ct; i++ ) - if ( FD_ISSET(services[i].conn, &fds) - && dispatchit(sock_slave[0], services[i].conn ,i) ) - /* Be carefull!!! - * This must break this for cykle but start the - * while (!die) master cykle from the top also - */ - break; - } - - dprintf(("[master] Terminating on signal %d\n", die)); - if (!debug) syslog(LOG_INFO, "Terminating on signal %d\n", die); - kill(0, die); - - return 0; -} - -static int dispatchit(int sock_slave, int sock, int sidx) -{ - struct sockaddr_in a; - unsigned char *pom; - int conn, - alen, ret; - - - alen = sizeof(a); - if ( (conn = accept(sock, (struct sockaddr *)&a, &alen)) < 0 ) - { - if (debug) - { - perror("accept()"); - return 1; - } - else - { - syslog(LOG_ERR, "accept(): %m"); - sleep(5); - return -1; - } - } - - getpeername(conn, (struct sockaddr *)&a, &alen); - pom = (char *) &a.sin_addr.s_addr; - dprintf(("[master] %s connection from %d.%d.%d.%d:%d\n", - services[sidx].id? services[sidx].id: "", - (int)pom[0], (int)pom[1], (int)pom[2], (int)pom[3], - ntohs(a.sin_port))); - - ret = 0; - if ( ( clnt_dispatched < clnt_accepted /* wraparound */ - || clnt_dispatched - clnt_accepted < set_slaves_ct * set_slave_overload) - && !(ret = do_sendmsg(sock_slave, conn, clnt_dispatched++, sidx)) ) - { - /* all done - */ - dprintf(("[master] Dispatched %lu, last known served %lu\n", - clnt_dispatched-1, clnt_accepted)); - } - else - { - services[sidx].on_reject_hnd(conn); - dprintf(("[master] Rejected new connection due to overload\n")); - if ( !debug ) syslog(LOG_ERR, "Rejected new connection due to overload\n"); - } - - close(conn); - if (ret) - { - perror("sendmsg()"); - if ( !debug ) syslog(LOG_ERR, "sendmsg(): %m"); - } - - - return 0; -} - - -static int slave(slave_data_init_hnd data_init_hnd, int sock) -{ - sigset_t sset; - struct sigaction sa; - struct timeval client_done, - client_start, - new_client_duration = { NEW_CLIENT_DURATION, 0 }; - - void *clnt_data = NULL; - int conn = -1, - srv = -1, - req_cnt = 0, - sockflags, - h_errno, - pid, i, - first_request = 0; /* 1 -> first request from connected client expected */ - - - - if ( (pid = fork()) ) return pid; - -#ifdef LB_PROF - monstartup((u_long)&_start, (u_long)&etext); -#endif - - srandom(getpid()+time(NULL)); - - for ( i = 0; i < services_ct; i++ ) - close(services[i].conn); - - sigemptyset(&sset); - sigaddset(&sset, SIGTERM); - sigaddset(&sset, SIGINT); - sigaddset(&sset, SIGUSR1); - - memset(&sa, 0, sizeof(sa)); - sa.sa_handler = catchsig; - sigaction(SIGUSR1, &sa, NULL); - - if ( (sockflags = fcntl(sock, F_GETFL, 0)) < 0 - || fcntl(sock, F_SETFL, sockflags | O_NONBLOCK) < 0 ) - { - dprintf(("[%d] fcntl(master_sock): %s\n", getpid(), strerror(errno))); - if ( !debug ) syslog(LOG_CRIT, "fcntl(master_sock): %m"); - exit(1); - } - - if ( data_init_hnd && data_init_hnd(&clnt_data) ) - /* - * XXX: what if the error remains and master will start new slave - * again and again? - * - * Then we are in a deep shit. - */ - exit(1); - - while ( !die && (req_cnt < set_slave_reqs_max || (conn >= 0 && first_request))) - { - fd_set fds; - int max = sock, - connflags, - newconn = -1, - newsrv = -1; - - enum { KICK_DONT = 0, KICK_IDLE, KICK_LOAD, KICK_HANDLER, KICK_COUNT } - kick_client = KICK_DONT; - - static char * kicks[] = { - "don't kick", - "idle client", - "high load", - "no request handler", - "request count limit reached", - }; - unsigned long seq; - struct timeval now,to; - - - FD_ZERO(&fds); - FD_SET(sock, &fds); - if ( conn >= 0 ) FD_SET(conn, &fds); - if ( conn > sock ) max = conn; - - to = set_idle_to; - sigprocmask(SIG_UNBLOCK, &sset, NULL); - switch (select(max+1, &fds, NULL, NULL, to.tv_sec >= 0 ? &to : NULL)) - { - case -1: - if ( errno != EINTR ) - { - dprintf(("[%d] select(): %s\n", getpid(), strerror(errno))); - if ( !debug ) syslog(LOG_CRIT, "select(): %m"); - exit(1); - } - continue; - - case 0: - if ( conn < 0 ) continue; - - default: - break; - } - sigprocmask(SIG_BLOCK, &sset, NULL); - - gettimeofday(&now,NULL); - - if ( conn >= 0 && FD_ISSET(conn, &fds) ) - { - /* - * serve the request - */ - int rv; - - dprintf(("[%d] incoming request\n", getpid())); - - if ( !services[srv].on_request_hnd ) - { - kick_client = KICK_HANDLER; - } else { - first_request = 0; - to = set_request_to; - if ((rv = services[srv].on_request_hnd(conn,to.tv_sec>=0 ? &to : NULL,clnt_data)) == ENOTCONN) { - if (services[srv].on_disconnect_hnd - && (rv = services[srv].on_disconnect_hnd(conn,NULL,clnt_data))) - { - dprintf(("[%d] disconnect handler: %s, terminating\n",getpid(),strerror(rv))); - exit(1); - } - close(conn); - conn = -1; - srv = -1; - dprintf(("[%d] Connection closed\n", getpid())); - } - else if (rv > 0) { - /* non-fatal error -> close connection and contiue - * XXX: likely to leak resources but can we call on_disconnect_hnd() on error? - */ - close(conn); - conn = -1; - srv = -1; - dprintf(("[%d] %s, connection closed\n",getpid(),strerror(rv))); - continue; - } - else if ( rv < 0 ) { - /* unknown error -> clasified as FATAL -> kill slave - */ - dprintf(("[%d] %s, terminating\n",getpid(),strerror(-rv))); - exit(1); - } - else { - dprintf(("[%d] request done\n", getpid())); - gettimeofday(&client_done, NULL); - } - - if (!check_timeout(new_client_duration,client_start,now)) continue; - - } - } else { - if (conn >= 0 && check_timeout(set_idle_to, client_done, now)) - kick_client = KICK_IDLE; - } - - if ( (conn < 0 || !first_request) && FD_ISSET(sock, &fds) && req_cnt < set_slave_reqs_max ) - { - /* Prefer slaves with no connection, then kick idle clients, - * active ones last. Wait less if we have serviced a request in the meantime. - * Tuned for HZ=100 timer. */ - if ( conn >= 0 ) usleep( kick_client || FD_ISSET(conn, &fds) ? 11000 : 21000); - if ( do_recvmsg(sock, &newconn, &seq, &newsrv) ) switch ( errno ) - { - case EINTR: /* XXX: signals are blocked */ - case EAGAIN: - continue; - default: dprintf(("[%d] recvmsg(): %s\n", getpid(), strerror(errno))); - if (!debug) syslog(LOG_CRIT,"recvmsg(): %m\n"); - exit(1); - } - kick_client = KICK_LOAD; - } - - if (req_cnt >= set_slave_reqs_max && !first_request) kick_client = KICK_COUNT; - - if ( kick_client && conn >= 0 ) - { - if ( services[srv].on_disconnect_hnd ) - services[srv].on_disconnect_hnd(conn, NULL, clnt_data); - close(conn); - conn = -1; - srv = -1; - dprintf(("[%d] Connection closed, %s\n", getpid(), kicks[kick_client])); - } - - if ( newconn >= 0 ) - { - int ret; - - conn = newconn; - srv = newsrv; - gettimeofday(&client_start, NULL); - - switch ( send(sock, &seq, sizeof(seq), 0) ) - { - case -1: - if (debug) perror("send()"); - else syslog(LOG_CRIT, "send(): %m\n"); - exit(1); - - case sizeof(seq): - break; - - default: dprintf(("[%d] send(): incomplete message\n", getpid())); - exit(1); - } - - req_cnt++; - dprintf(("[%d] serving %s connection %lu\n", getpid(), - services[srv].id? services[srv].id: "", seq)); - - connflags = fcntl(conn, F_GETFL, 0); - if ( fcntl(conn, F_SETFL, connflags | O_NONBLOCK) < 0 ) - { - dprintf(("[%d] can't set O_NONBLOCK mode (%s), closing.\n", getpid(), strerror(errno))); - if ( !debug ) syslog(LOG_ERR, "can't set O_NONBLOCK mode (%s), closing.\n", strerror(errno)); - close(conn); - conn = srv = -1; - continue; - } - - to = set_connect_to; - if ( services[srv].on_new_conn_hnd - && (ret = services[srv].on_new_conn_hnd(conn, to.tv_sec >= 0 ? &to : NULL, clnt_data)) ) - { - dprintf(("[%d] Connection not estabilished, err = %d.\n", getpid(),ret)); - if ( !debug ) syslog(LOG_ERR, "Connection not estabilished, err = %d.\n",ret); - close(conn); - conn = srv = -1; - if (ret < 0) exit(1); - continue; - } - gettimeofday(&client_done, NULL); - first_request = 1; - } - } - - if ( die ) - { - dprintf(("[%d] Terminating on signal %d\n", getpid(), die)); - if ( !debug ) syslog(LOG_INFO, "Terminating on signal %d", die); - } - - if (conn >= 0 && services[srv].on_disconnect_hnd ) - services[srv].on_disconnect_hnd(conn, NULL, clnt_data); - - dprintf(("[%d] Terminating after %d requests\n", getpid(), req_cnt)); - if ( !debug ) syslog(LOG_INFO, "Terminating after %d requests", req_cnt); - - - exit(0); -} - -static void catchsig(int sig) -{ - die = sig; -} - -static void catch_chld(int sig) -{ - child_died = 1; -} - -static int check_timeout(struct timeval timeout, struct timeval before, struct timeval after) -{ - return (timeout.tv_usec <= after.tv_usec - before.tv_usec) ? - (timeout.tv_sec <= after.tv_sec - before.tv_sec) : - (timeout.tv_sec < after.tv_sec - before.tv_sec); -} - -#define MSG_BUFSIZ 30 - -/* - * send socket sock through socket to_sock - */ -static int do_sendmsg(int to_sock, int sock, unsigned long clnt_dispatched, int srv) -{ - struct msghdr msg = {0}; - struct cmsghdr *cmsg; - struct iovec sendiov; - int myfds, /* file descriptors to pass. */ - *fdptr; - char buf[CMSG_SPACE(sizeof myfds)]; /* ancillary data buffer */ - char sendbuf[MSG_BUFSIZ]; /* to store unsigned int + \0 */ - - - memset(sendbuf, 0, sizeof(sendbuf)); - snprintf(sendbuf, sizeof(sendbuf), "%u %lu", srv, clnt_dispatched); - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &sendiov; - msg.msg_iovlen = 1; - sendiov.iov_base = sendbuf; - sendiov.iov_len = sizeof(sendbuf); - - msg.msg_control = buf; - msg.msg_controllen = sizeof buf; - - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - fdptr = (int *)CMSG_DATA(cmsg); - *fdptr = sock; - - msg.msg_controllen = cmsg->cmsg_len; - /* send fd to server-slave to do rest of communication */ - if (sendmsg(to_sock, &msg, 0) < 0) - return 1; - - return 0; -} - - -/* receive socket sock through socket from_sock */ -static int do_recvmsg(int from_sock, int *sock, unsigned long *clnt_accepted,int *srv) -{ - struct msghdr msg = {0}; - struct cmsghdr *cmsg; - struct iovec recviov; - int myfds; /* file descriptors to pass. */ - char buf[CMSG_SPACE(sizeof(myfds))]; /* ancillary data buffer */ - char recvbuf[MSG_BUFSIZ]; - - - msg.msg_name = NULL; - msg.msg_namelen = 0; - msg.msg_iov = &recviov; - msg.msg_iovlen = 1; - recviov.iov_base = recvbuf; - recviov.iov_len = sizeof(recvbuf); - - msg.msg_control = buf; - msg.msg_controllen = sizeof buf; - - cmsg = CMSG_FIRSTHDR(&msg); - cmsg->cmsg_level = SOL_SOCKET; - cmsg->cmsg_type = SCM_RIGHTS; - cmsg->cmsg_len = CMSG_LEN(sizeof(int)); - msg.msg_controllen = cmsg->cmsg_len; - - if (recvmsg(from_sock, &msg, 0) < 0) - return 1; - - *sock = *((int *)CMSG_DATA(cmsg)); - sscanf(recvbuf, "%u %lu", srv, clnt_accepted); - - return 0; -} - -static void glite_srvbones_set_slaves_ct(int n) -{ - set_slaves_ct = (n == -1)? SLAVES_COUNT: n; -} - -static void glite_srvbones_set_slave_overload(int n) -{ - set_slave_overload = (n == -1)? SLAVE_OVERLOAD: n; -} - -static void glite_srvbones_set_slave_conns_max(int n) -{ - set_slave_reqs_max = (n == -1)? SLAVE_REQS_MAX: n; -} - -static void set_timeout(struct timeval *to, struct timeval *val) -{ - if (val) { - /* XXX: why not, negative timeouts don't make any sense, IMHO */ - assert(val->tv_sec >= 0); - *to = *val; - } - else to->tv_sec = -1; -} diff --git a/org.glite.lbjp-utils.trio/.cvsignore b/org.glite.lbjp-utils.trio/.cvsignore deleted file mode 100644 index c795b05..0000000 --- a/org.glite.lbjp-utils.trio/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build \ No newline at end of file diff --git a/org.glite.lbjp-utils.trio/LICENSE b/org.glite.lbjp-utils.trio/LICENSE deleted file mode 100644 index 01b973b..0000000 --- a/org.glite.lbjp-utils.trio/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.lbjp-utils.trio/Makefile b/org.glite.lbjp-utils.trio/Makefile deleted file mode 100644 index 96a8386..0000000 --- a/org.glite.lbjp-utils.trio/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -# Default values -top_srcdir=. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -package=glite-lb-utils-trio -version=0.0.0 -PREFIX=/opt/glite -lbuprefix=lbu - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -VPATH=${top_srcdir}/src:${top_srcdir}/test::${top_srcdir}/doc - -CC=gcc - -DEBUG:=-g -O0 -Wall - -CFLAGS:=${DEBUG} -I${top_srcdir}/src -I${top_srcdir}/interface -I. -DDATAGRID_EXTENSION - -COMPILE:=libtool --mode=compile ${CC} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/lib ${LDFLAGS} -LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/lib ${LDFLAGS} -INSTALL:=libtool --mode=install install - -REPORTS:=${top_srcdir}/reports -TEST_LIBS:=-L${cppunit_prefix}/lib -lcppunit -ldl -TEST_INC:=-I${cppunit_prefix}/include - - -OBJS:=trio.o strio.o escape.o -LOBJS:=${OBJS:.o=.lo} - -HDRS:=trio.h escape.h - -STATICLIB:=libglite_lbu_trio.a -LTLIB:=libglite_lbu_trio.la - -default: all - -all compile: ${STATICLIB} ${LTLIB} - -# to use libtool versioning correcty, we should have: -# -# current = major + minor + offset -# revision = patch -# age = minor -# -# where offset is a sum of maximal released minor's of all previous major's -# -# version_info=-version-info `echo ${version} | cut -d. -f1,2 | tr . :` - -# counted minors: n/a -offset=0 - -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${OBJS} - ${LINK} ${version_info} -o $@ ${LOBJS} - -stage: compile - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -check: compile mkreports runtest - -mkreports: - -mkdir ${REPORTS} - -runtest: trio_test - ./trio_test ${REPORTS}/trio.xml - -trio_test: trio_test.cpp - ${CXX} -c ${CFLAGS} ${TEST_INC} $< - ${LINKXX} -o $@ trio_test.o ${LTLIB} ${TEST_LIBS} - - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir${stagedir} - save_dir=`pwd`; cd tmpbuilddir${stagedir} && tar -czf $$save_dir/${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz *; cd $$save_dir - rm -rf tmpbuilddir - -install: - mkdir -p ${PREFIX}/lib - mkdir -p ${PREFIX}/share/doc/${package}-${version} - ${INSTALL} -m 644 ${LTLIB} ${PREFIX}/lib - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - if [ x${DOSTAGE} = xyes ]; then \ - mkdir -p ${PREFIX}/include/${globalprefix}/${lbuprefix} ; \ - (cd ${top_srcdir}/interface && install -m 644 ${HDRS} ${PREFIX}/include/${globalprefix}/${lbuprefix}) ; \ - install -m 644 ${STATICLIB} ${PREFIX}/lib; \ - fi - -clean: - -%.o: %.c - ${COMPILE} ${CFLAGS} -c $< diff --git a/org.glite.lbjp-utils.trio/interface/escape.h b/org.glite.lbjp-utils.trio/interface/escape.h deleted file mode 100644 index 4795f68..0000000 --- a/org.glite.lbjp-utils.trio/interface/escape.h +++ /dev/null @@ -1,59 +0,0 @@ -#ifndef __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ -#define __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ -/*! - * \file escape.h - */ - -#ident "$Header$" - - -/*! - * \fn char *glite_lbu_EscapeULM(const char *str) - * \param str a string to escape - * \return new (allocated) escaped string - * \brief in given string (ULM) escape all ULM_QM, ULM_BS and ULM_LF by ULM_BS - */ - -char *glite_lbu_EscapeULM(const char *); - - -/*! - * \fn char *glite_lbu_UnescapeULM(const char *str) - * \param str a string to unescape - * \return new (allocated) unescaped string - * \brief in given string (ULM) unescape all escaped ULM_QM, ULM_BS and ULM_LF - */ - -char *glite_lbu_UnescapeULM(const char *); - - -/*! - * \fn char *glite_lbu_EscapeXML(const char *str); - * \param str a string to escape - * \return new (allocated) escaped string - * \brief in given string (XML) escape all unwanted characters - */ - -char *glite_lbu_EscapeXML(const char *); - - -/*! - * \fn char *glite_lbu_UnescapeXML(const char *str) - * \param str a string to unescape - * \return new (allocated) unescaped string - * \brief in given string (XML) unescape all escaped characters - */ - -char *glite_lbu_UnescapeXML(const char *); - - -/*! - * \fn char *glite_lbu_EscapeSQL(const char *str) - * \param str a string to escape - * \return new (allocated) escaped string - * \briefin given string (SQL) escape all unwanted characters - */ - -char *glite_lbu_EscapeSQL(const char *); - -#endif /* __EDG_WORKLOAD_LOGGING_COMMON_ESCAPE_H__ */ diff --git a/org.glite.lbjp-utils.trio/interface/trio.h b/org.glite.lbjp-utils.trio/interface/trio.h deleted file mode 100644 index 04f133c..0000000 --- a/org.glite.lbjp-utils.trio/interface/trio.h +++ /dev/null @@ -1,187 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************/ - -#ifndef TRIO_TRIO_H -#define TRIO_TRIO_H - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/* make utility and C++ compiler in Windows NT fails to find this symbol */ -#if defined(WIN32) && !defined(isascii) -# define isascii ((unsigned)(x) < 0x80) -#endif - -/* - * Error codes. - * - * Remember to add a textual description to trio_strerror. - */ -enum { - TRIO_EOF = 1, - TRIO_EINVAL = 2, - TRIO_ETOOMANY = 3, - TRIO_EDBLREF = 4, - TRIO_EGAP = 5, - TRIO_ENOMEM = 6, - TRIO_ERANGE = 7 -}; - -/* Error macros */ -#define TRIO_ERROR_CODE(x) ((-(x)) & 0x00FF) -#define TRIO_ERROR_POSITION(x) ((-(x)) >> 8) -#define TRIO_ERROR_NAME(x) trio_strerror(x) - -const char *trio_strerror(int); - -/************************************************************************* - * Print Functions - */ - -int trio_printf(const char *format, ...); -int trio_vprintf(const char *format, va_list args); -int trio_printfv(const char *format, void **args); - -int trio_fprintf(FILE *file, const char *format, ...); -int trio_vfprintf(FILE *file, const char *format, va_list args); -int trio_fprintfv(FILE *file, const char *format, void **args); - -int trio_dprintf(int fd, const char *format, ...); -int trio_vdprintf(int fd, const char *format, va_list args); -int trio_dprintfv(int fd, const char *format, void **args); - -/* trio_sprintf(target, format, ...) - * trio_snprintf(target, maxsize, format, ...) - * - * Build 'target' according to 'format' and succesive - * arguments. This is equal to the sprintf() and - * snprintf() functions. - */ -int trio_sprintf(char *buffer, const char *format, ...); -int trio_vsprintf(char *buffer, const char *format, va_list args); -int trio_sprintfv(char *buffer, const char *format, void **args); - -int trio_snprintf(char *buffer, size_t max, const char *format, ...); -int trio_vsnprintf(char *buffer, size_t bufferSize, const char *format, - va_list args); -int trio_snprintfv(char *buffer, size_t bufferSize, const char *format, - void **args); - -int trio_snprintfcat(char *buffer, size_t max, const char *format, ...); -int trio_vsnprintfcat(char *buffer, size_t bufferSize, const char *format, - va_list args); - -char *trio_aprintf(const char *format, ...); -char *trio_vaprintf(const char *format, va_list args); - -int trio_asprintf(char **ret, const char *format, ...); -int trio_vasprintf(char **ret, const char *format, va_list args); - -/************************************************************************* - * Scan Functions - */ -int trio_scanf(const char *format, ...); -int trio_vscanf(const char *format, va_list args); -int trio_scanfv(const char *format, void **args); - -int trio_fscanf(FILE *file, const char *format, ...); -int trio_vfscanf(FILE *file, const char *format, va_list args); -int trio_fscanfv(FILE *file, const char *format, void **args); - -int trio_dscanf(int fd, const char *format, ...); -int trio_vdscanf(int fd, const char *format, va_list args); -int trio_dscanfv(int fd, const char *format, void **args); - -int trio_sscanf(const char *buffer, const char *format, ...); -int trio_vsscanf(const char *buffer, const char *format, va_list args); -int trio_sscanfv(const char *buffer, const char *format, void **args); - -/************************************************************************* - * Renaming - */ -#ifdef TRIO_REPLACE_STDIO -/* Replace the functions */ -#ifndef HAVE_PRINTF -# define printf trio_printf -#endif -#ifndef HAVE_VPRINTF -# define vprintf trio_vprintf -#endif -#ifndef HAVE_FPRINTF -# define fprintf trio_fprintf -#endif -#ifndef HAVE_VFPRINTF -# define vfprintf trio_vfprintf -#endif -#ifndef HAVE_SPRINTF -# define sprintf trio_sprintf -#endif -#ifndef HAVE_VSPRINTF -# define vsprintf trio_vsprintf -#endif -#ifndef HAVE_SNPRINTF -# define snprintf trio_snprintf -#endif -#ifndef HAVE_VSNPRINTF -# define vsnprintf trio_vsnprintf -#endif -#ifndef HAVE_SCANF -# define scanf trio_scanf -#endif -#ifndef HAVE_VSCANF -# define vscanf trio_vscanf -#endif -#ifndef HAVE_FSCANF -# define fscanf trio_fscanf -#endif -#ifndef HAVE_VFSCANF -# define vfscanf trio_vfscanf -#endif -#ifndef HAVE_SSCANF -# define sscanf trio_sscanf -#endif -#ifndef HAVE_VSSCANF -# define vsscanf trio_vsscanf -#endif -/* These aren't stdio functions, but we make them look similar */ -#define dprintf trio_dprintf -#define vdprintf trio_vdprintf -#define aprintf trio_aprintf -#define vaprintf trio_vaprintf -#define asprintf trio_asprintf -#define vasprintf trio_vasprintf -#define dscanf trio_dscanf -#define vdscanf trio_vdscanf -#endif - -/* strio compatible names */ -#define StrScan trio_sscanf -#define StrFormat trio_sprintf -#define StrFormatMax trio_snprintf -#define StrFormatAlloc trio_aprintf -#define StrFormatAppendMax trio_snprintfcat - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* TRIO_TRIO_H */ diff --git a/org.glite.lbjp-utils.trio/src/escape.c b/org.glite.lbjp-utils.trio/src/escape.c deleted file mode 100644 index 9a1d545..0000000 --- a/org.glite.lbjp-utils.trio/src/escape.c +++ /dev/null @@ -1,224 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include - -#include "escape.h" - -#define ULM_QM '"' -#define ULM_BS '\\' -#define ULM_LF '\n' - -/* - *---------------------------------------------------------------------- - * - * \fn char *glite_lbu_EscapeULM(const char *str) - * \param str a string to escape - * \return new (allocated) escaped string - * \brief in given string escape all ULM_QM, ULM_BS and ULM_LF by ULM_BS - * - * Calls: malloc, strlen - * - * Algorithm: array lookup - * - the new string will be allocated - * - *---------------------------------------------------------------------- - */ - -char *glite_lbu_EscapeULM(const char *str) -{ -unsigned int i,j; -size_t size; -char *ret; - -if (str == NULL) return NULL; -if ((size = strlen(str)) == 0) return strdup(""); - -ret = (char*) malloc(1+2*size*sizeof(char)); - -j = 0; -for (i=0; i',"gt" }, - { '&',"amp" }, - { '"',"quot" }, - { '\'',"apos" }, - { 0, NULL } -}; - -#define XML_ESCAPE_SET "<>&\"'" - -char *glite_lbu_EscapeXML(const char *in) -{ - const char* tmp_in; - char *out; - int cnt,i,j,k; - - if (!in) return NULL; - - for (cnt = 0, tmp_in = in; *tmp_in != '\0'; ++tmp_in) { - if (strchr(XML_ESCAPE_SET, *tmp_in) || - (*tmp_in & 0x7f) < 0x20 /* control character */ || - (*tmp_in == '%')) cnt++; - } - - out = malloc(strlen(in)+1+cnt*5); - - for (i=j=0; in[i]; i++) { - for (k=0; xml_etab[k].c && xml_etab[k].c != in[i]; k++); - if (xml_etab[k].c) { - int l; - - out[j++] = '&'; - memcpy(out+j,xml_etab[k].e,l=strlen(xml_etab[k].e)); - j += l; - out[j++] = ';'; - } else if ((in[i] & 0x7f) < 0x20 || in[i] == '%') { - sprintf(out+j, "%%%02x", (unsigned char)in[i]); - j+=3; - } else { - out[j++] = in[i]; - } - } - out[j] = 0; - return out; -} - -char *glite_lbu_UnescapeXML(const char *in) -{ - char *out; - int i,j,k; - char xtmp[3]; - unsigned char origchar; - - if (!in) return NULL; - out = malloc(strlen(in)+1); - - for (i=j=0; in[i]; j++) if (in[i] == '&') { - char *s = strchr(in+i,';'); - if (s) { - int l = s-in-i+1; - for (k=0; xml_etab[k].c && strncasecmp(in+i+1,xml_etab[k].e,l-2); k++); - if (xml_etab[k].c) { - out[j] = xml_etab[k].c; - i += l; - } else out[j] = in[i++]; - } else out[j] = in[i++]; - } else if (in[i] == '%') { - if (isxdigit(xtmp[0]=in[i+1]) && isxdigit(xtmp[1]=in[i+2])) { - xtmp[2] = '\0'; - origchar = (unsigned char) strtol(xtmp, NULL, 16); - if ((origchar & 0x7f) < 0x20 || origchar == '%') { - out[j] = origchar; - i += 3; - } else out[j] = in[i++]; - } else out[j] = in[i++]; - } else { - out[j] = in[i++]; - } - out[j] = 0; - return out; -} - -char *glite_lbu_EscapeSQL(const char *in) -{ - const char* tmp_in; - char *out = NULL; - int i,j,cnt; - - if (!in) return NULL; - - for (cnt = 0, tmp_in = in; (tmp_in = strchr(tmp_in,'\'')) != NULL; ++tmp_in) { - ++cnt; - } - for (tmp_in = in; (tmp_in = strchr(tmp_in,'\\')) != NULL; ++tmp_in) { - ++cnt; - } - - out = malloc(strlen(in)+1+cnt); - - for (i=j=0; in[i]; i++) { - if (in[i] == '\\') out[j++] = '\\'; - if (in[i] == '\'') out[j++] = '\''; - out[j++] = in[i]; - } - out[j] = 0; - - return out; -} diff --git a/org.glite.lbjp-utils.trio/src/strio.c b/org.glite.lbjp-utils.trio/src/strio.c deleted file mode 100644 index f1ab5b8..0000000 --- a/org.glite.lbjp-utils.trio/src/strio.c +++ /dev/null @@ -1,581 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************/ - -/* - * TODO - * - StrToLongDouble - */ - -static const char rcsid[] = "@(#)$Id$"; - -#if defined(unix) || defined(__xlC__) || defined(__QNX__) -# define PLATFORM_UNIX -#elif defined(WIN32) || defined(_WIN32) -# define PLATFORM_WIN32 -#elif defined(AMIGA) && defined(__GNUC__) -# define PLATFORM_UNIX -#endif - -#if defined(__STDC__) && (__STDC_VERSION__ >= 199901L) -# define TRIO_C99 -#endif - -#include "strio.h" -#include -#include -#include -#include -#include -#include -#ifndef DEBUG -# define NDEBUG -#endif -#include - -#ifndef NULL -# define NULL 0 -#endif -#define NIL ((char)0) -#ifndef FALSE -# define FALSE (1 == 0) -# define TRUE (! FALSE) -#endif - -#define VALID(x) (NULL != (x)) -#define INVALID(x) (NULL == (x)) - -#if defined(PLATFORM_UNIX) -# define USE_STRCASECMP -# define USE_STRNCASECMP -# define USE_STRERROR -# if defined(__QNX__) -# define strcasecmp(x,y) stricmp(x,y) -# define strncasecmp(x,y,n) strnicmp(x,y,n) -# endif -#elif defined(PLATFORM_WIN32) -# define USE_STRCASECMP -# define strcasecmp(x,y) strcmpi(x,y) -#endif - -/************************************************************************* - * StrAppendMax - */ -char *StrAppendMax(char *target, size_t max, const char *source) -{ - assert(VALID(target)); - assert(VALID(source)); - assert(max > 0); - - max -= StrLength(target) + 1; - return (max > 0) ? strncat(target, source, max) : target; -} - -/************************************************************************* - * StrCopyMax - */ -char *StrCopyMax(char *target, size_t max, const char *source) -{ - assert(VALID(target)); - assert(VALID(source)); - assert(max > 0); /* Includes != 0 */ - - target = strncpy(target, source, max - 1); - target[max - 1] = (char)0; - return target; -} - -/************************************************************************* - * StrDuplicate - */ -char *StrDuplicate(const char *source) -{ - char *target; - - assert(VALID(source)); - - target = StrAlloc(StrLength(source) + 1); - if (target) - { - StrCopy(target, source); - } - return target; -} - -/************************************************************************* - * StrDuplicateMax - */ -char *StrDuplicateMax(const char *source, size_t max) -{ - char *target; - size_t len; - - assert(VALID(source)); - assert(max > 0); - - /* Make room for string plus a terminating zero */ - len = StrLength(source) + 1; - if (len > max) - { - len = max; - } - target = StrAlloc(len); - if (target) - { - StrCopyMax(target, len, source); - } - return target; -} - -/************************************************************************* - * StrEqual - */ -int StrEqual(const char *first, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { -#if defined(USE_STRCASECMP) - return (0 == strcasecmp(first, second)); -#else - while ((*first != NIL) && (*second != NIL)) - { - if (toupper(*first) != toupper(*second)) - { - break; - } - first++; - second++; - } - return ((*first == NIL) && (*second == NIL)); -#endif - } - return FALSE; -} - -/************************************************************************* - * StrEqualCase - */ -int StrEqualCase(const char *first, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { - return (0 == strcmp(first, second)); - } - return FALSE; -} - -/************************************************************************* - * StrEqualCaseMax - */ -int StrEqualCaseMax(const char *first, size_t max, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { - return (0 == strncmp(first, second, max)); - } - return FALSE; -} - -/************************************************************************* - * StrEqualLocale - */ -int StrEqualLocale(const char *first, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - -#if defined(LC_COLLATE) - return (strcoll(first, second) == 0); -#else - return StrEqual(first, second); -#endif -} - -/************************************************************************* - * StrEqualMax - */ -int StrEqualMax(const char *first, size_t max, const char *second) -{ - assert(VALID(first)); - assert(VALID(second)); - - if (VALID(first) && VALID(second)) - { -#if defined(USE_STRNCASECMP) - return (0 == strncasecmp(first, second, max)); -#else - /* Not adequately tested yet */ - size_t cnt = 0; - while ((*first != NIL) && (*second != NIL) && (cnt <= max)) - { - if (toupper(*first) != toupper(*second)) - { - break; - } - first++; - second++; - cnt++; - } - return ((cnt == max) || ((*first == NIL) && (*second == NIL))); -#endif - } - return FALSE; -} - -/************************************************************************* - * StrError - */ -const char *StrError(int errorNumber) -{ -#if defined(USE_STRERROR) - return strerror(errorNumber); -#else - return "unknown"; -#endif -} - -/************************************************************************* - * StrFormatDate - */ -size_t StrFormatDateMax(char *target, - size_t max, - const char *format, - const struct tm *datetime) -{ - assert(VALID(target)); - assert(VALID(format)); - assert(VALID(datetime)); - assert(max > 0); - - return strftime(target, max, format, datetime); -} - -/************************************************************************* - * StrHash - */ -unsigned long StrHash(const char *string, int type) -{ - unsigned long value = 0L; - char ch; - - assert(VALID(string)); - - switch (type) - { - case STRIO_HASH_PLAIN: - while ( (ch = *string++) != NIL ) - { - value *= 31; - value += (unsigned long)ch; - } - break; - default: - assert(FALSE); - break; - } - return value; -} - -/************************************************************************* - * StrMatch - */ -int StrMatch(char *string, char *pattern) -{ - assert(VALID(string)); - assert(VALID(pattern)); - - for (; ('*' != *pattern); ++pattern, ++string) - { - if (NIL == *string) - { - return (NIL == *pattern); - } - if ((toupper((int)*string) != toupper((int)*pattern)) - && ('?' != *pattern)) - { - return FALSE; - } - } - /* two-line patch to prevent *too* much recursiveness: */ - while ('*' == pattern[1]) - pattern++; - - do - { - if ( StrMatch(string, &pattern[1]) ) - { - return TRUE; - } - } - while (*string++); - - return FALSE; -} - -/************************************************************************* - * StrMatchCase - */ -int StrMatchCase(char *string, char *pattern) -{ - assert(VALID(string)); - assert(VALID(pattern)); - - for (; ('*' != *pattern); ++pattern, ++string) - { - if (NIL == *string) - { - return (NIL == *pattern); - } - if ((*string != *pattern) - && ('?' != *pattern)) - { - return FALSE; - } - } - /* two-line patch to prevent *too* much recursiveness: */ - while ('*' == pattern[1]) - pattern++; - - do - { - if ( StrMatchCase(string, &pattern[1]) ) - { - return TRUE; - } - } - while (*string++); - - return FALSE; -} - -/************************************************************************* - * StrSpanFunction - * - * Untested - */ -size_t StrSpanFunction(char *source, int (*Function)(int)) -{ - size_t count = 0; - - assert(VALID(source)); - assert(VALID(Function)); - - while (*source != NIL) - { - if (Function(*source)) - break; /* while */ - source++; - count++; - } - return count; -} - -/************************************************************************* - * StrSubstringMax - */ -char *StrSubstringMax(const char *string, size_t max, const char *find) -{ - size_t count; - size_t size; - char *result = NULL; - - assert(VALID(string)); - assert(VALID(find)); - - size = StrLength(find); - if (size <= max) - { - for (count = 0; count <= max - size; count++) - { - if (StrEqualMax(find, size, &string[count])) - { - result = (char *)&string[count]; - break; - } - } - } - return result; -} - -/************************************************************************* - * StrToDouble - * - * double ::= [ ] - * ( | - * | - * ) - * [ [ ] ] - * number ::= 1*( ) - * digit ::= ( '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ) - * exponential ::= ( 'e' | 'E' ) - * sign ::= ( '-' | '+' ) - * decimal_point ::= '.' - */ -double StrToDouble(const char *source, const char **endp) -{ -#if defined(TRIO_C99) - return strtod(source, endp); -#else - /* Preliminary code */ - int isNegative = FALSE; - int isExponentNegative = FALSE; - unsigned long integer = 0; - unsigned long fraction = 0; - unsigned long fracdiv = 1; - unsigned long exponent = 0; - double value = 0.0; - - /* First try hex-floats */ - if ((source[0] == '0') && ((source[1] == 'x') || (source[1] == 'X'))) - { - source += 2; - while (isxdigit((int)*source)) - { - integer *= 16; - integer += (isdigit((int)*source) - ? (*source - '0') - : 10 + (toupper((int)*source) - 'A')); - source++; - } - if (*source == '.') - { - source++; - while (isxdigit((int)*source)) - { - fraction *= 16; - fraction += (isdigit((int)*source) - ? (*source - '0') - : 10 + (toupper((int)*source) - 'A')); - fracdiv *= 16; - source++; - } - if ((*source == 'p') || (*source == 'P')) - { - source++; - if ((*source == '+') || (*source == '-')) - { - isExponentNegative = (*source == '-'); - source++; - } - while (isdigit((int)*source)) - { - exponent *= 10; - exponent += (*source - '0'); - source++; - } - } - } - } - else /* Then try normal decimal floats */ - { - isNegative = (*source == '-'); - /* Skip sign */ - if ((*source == '+') || (*source == '-')) - source++; - - /* Integer part */ - while (isdigit((int)*source)) - { - integer *= 10; - integer += (*source - '0'); - source++; - } - - if (*source == '.') - { - source++; /* skip decimal point */ - while (isdigit((int)*source)) - { - fraction *= 10; - fraction += (*source - '0'); - fracdiv *= 10; - source++; - } - } - if ((*source == 'e') || (*source == 'E')) - { - source++; /* Skip exponential indicator */ - isExponentNegative = (*source == '-'); - if ((*source == '+') || (*source == '-')) - source++; - while (isdigit((int)*source)) - { - exponent *= 10; - exponent += (*source - '0'); - source++; - } - } - } - - value = (double)integer; - if (fraction != 0) - { - value += (double)fraction / (double)fracdiv; - } - if (exponent != 0) - { - if (isExponentNegative) - value /= pow((double)10, (double)exponent); - else - value *= pow((double)10, (double)exponent); - } - if (isNegative) - value = -value; - - if (endp) - *endp = source; - return value; -#endif -} - -/************************************************************************* - * StrToFloat - */ -float StrToFloat(const char *source, const char **endp) -{ -#if defined(TRIO_C99) - return strtof(source, endp); -#else - return (float)StrToDouble(source, endp); -#endif -} - -/************************************************************************* - * StrToUpper - */ -int StrToUpper(char *target) -{ - int i = 0; - - assert(VALID(target)); - - while (NIL != *target) - { - *target = toupper((int)*target); - target++; - i++; - } - return i; -} diff --git a/org.glite.lbjp-utils.trio/src/strio.h b/org.glite.lbjp-utils.trio/src/strio.h deleted file mode 100644 index 68845a3..0000000 --- a/org.glite.lbjp-utils.trio/src/strio.h +++ /dev/null @@ -1,227 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************/ - -#ifndef TRIO_STRIO_H -#define TRIO_STRIO_H - -#if !(defined(DEBUG) || defined(NDEBUG)) -# define NDEBUG -#endif -#include -#include -#include -#include - -#ifndef STRIO_MALLOC -# define STRIO_MALLOC(n) malloc(n) -#endif -#ifndef STRIO_FREE -# define STRIO_FREE(x) free(x) -#endif - -/* - * StrAppend(target, source) - * StrAppendMax(target, maxsize, source) - * - * Append 'source' to 'target' - * - * target = StrAlloc(size) - * - * Allocate a new string - * - * StrContains(target, substring) - * - * Find out if the string 'substring' is - * contained in the string 'target' - * - * StrCopy(target, source) - * StrCopyMax(target, maxsize, source) - * - * Copy 'source' to 'target' - * - * target = StrDuplicate(source) - * target = StrDuplicateMax(source, maxsize) - * - * Allocate and copy 'source' to 'target' - * - * StrEqual(first, second) - * StrEqualMax(first, maxsize, second) - * - * Compare if 'first' is equal to 'second'. - * Case-independent. - * - * StrEqualCase(first, second) - * StrEqualCaseMax(first, maxsize, second) - * - * Compare if 'first' is equal to 'second' - * Case-dependent. Please note that the use of the - * word 'case' has the opposite meaning as that of - * strcasecmp(). - * - * StrFormat(target, format, ...) - * StrFormatMax(target, maxsize, format, ...) - * - * Build 'target' according to 'format' and succesive - * arguments. This is equal to the sprintf() and - * snprintf() functions. - * - * StrFormatDate(target, format, ...) - * - * StrFree(target) - * - * De-allocates a string - * - * StrHash(string, type) - * - * Calculates the hash value of 'string' based on the - * 'type'. - * - * StrIndex(target, character) - * StrIndexLast(target, character) - * - * Find the first/last occurrence of 'character' in - * 'target' - * - * StrLength(target) - * - * Return the length of 'target' - * - * StrMatch(string, pattern) - * StrMatchCase(string, pattern) - * - * Find 'pattern' within 'string'. 'pattern' may contain - * wildcards such as * (asterics) and ? (question mark) - * which matches zero or more characters and exactly - * on character respectively - * - * StrScan(source, format, ...) - * - * Equal to sscanf() - * - * StrSubstring(target, substring) - * - * Find the first occurrence of the string 'substring' - * within the string 'target' - * - * StrTokenize(target, list) - * - * Split 'target' into the first token delimited by - * one of the characters in 'list'. If 'target' is - * NULL then next token will be returned. - * - * StrToUpper(target) - * - * Convert all lower case characters in 'target' into - * upper case characters. - */ - -enum { - STRIO_HASH_NONE = 0, - STRIO_HASH_PLAIN, - STRIO_HASH_TWOSIGNED -}; - -#if !defined(DEBUG) || defined(__DECC) -#define StrAlloc(n) (char *)STRIO_MALLOC(n) -#define StrAppend(x,y) strcat((x), (y)) -#define StrContains(x,y) (0 != strstr((x), (y))) -#define StrCopy(x,y) strcpy((x), (y)) -#define StrIndex(x,y) strchr((x), (y)) -#define StrIndexLast(x,y) strrchr((x), (y)) -#define StrFree(x) STRIO_FREE(x) -#define StrLength(x) strlen((x)) -#define StrSubstring(x,y) strstr((x), (y)) -#define StrTokenize(x,y) strtok((x), (y)) -#define StrToLong(x,y,n) strtol((x), (y), (n)) -#define StrToUnsignedLong(x,y,n) strtoul((x), (y), (n)) -#else /* DEBUG */ - /* - * To be able to use these macros everywhere, including in - * if() sentences, the assertions are put first in a comma - * seperated list. - * - * Unfortunately the DECC compiler does not seem to like this - * so it will use the un-asserted functions above for the - * debugging case too. - */ -#define StrAlloc(n) \ - (assert((n) > 0),\ - (char *)STRIO_MALLOC(n)) -#define StrAppend(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - strcat((x), (y))) -#define StrContains(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - (0 != strstr((x), (y)))) -#define StrCopy(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - strcpy((x), (y))) -#define StrIndex(x,c) \ - (assert((x) != NULL),\ - strchr((x), (c))) -#define StrIndexLast(x,c) \ - (assert((x) != NULL),\ - strrchr((x), (c))) -#define StrFree(x) \ - (assert((x) != NULL),\ - STRIO_FREE(x)) -#define StrLength(x) \ - (assert((x) != NULL),\ - strlen((x))) -#define StrSubstring(x,y) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - strstr((x), (y))) -#define StrTokenize(x,y) \ - (assert((y) != NULL),\ - strtok((x), (y))) -#define StrToLong(x,y,n) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - assert((n) >= 2 && (n) <= 36),\ - strtol((x), (y), (n))) -#define StrToUnsignedLong(x,y,n) \ - (assert((x) != NULL),\ - assert((y) != NULL),\ - assert((n) >= 2 && (n) <= 36),\ - strtoul((x), (y), (n))) -#endif /* DEBUG */ - -char *StrAppendMax(char *target, size_t max, const char *source); -char *StrCopyMax(char *target, size_t max, const char *source); -char *StrDuplicate(const char *source); -char *StrDuplicateMax(const char *source, size_t max); -int StrEqual(const char *first, const char *second); -int StrEqualCase(const char *first, const char *second); -int StrEqualCaseMax(const char *first, size_t max, const char *second); -int StrEqualLocale(const char *first, const char *second); -int StrEqualMax(const char *first, size_t max, const char *second); -const char *StrError(int); -size_t StrFormatDateMax(char *target, size_t max, const char *format, const struct tm *datetime); -unsigned long StrHash(const char *string, int type); -int StrMatch(char *string, char *pattern); -int StrMatchCase(char *string, char *pattern); -size_t StrSpanFunction(char *source, int (*Function)(int)); -char *StrSubstringMax(const char *string, size_t max, const char *find); -float StrToFloat(const char *source, const char **target); -double StrToDouble(const char *source, const char **target); -int StrToUpper(char *target); - -#endif /* TRIO_STRIO_H */ diff --git a/org.glite.lbjp-utils.trio/src/trio.c b/org.glite.lbjp-utils.trio/src/trio.c deleted file mode 100644 index 6e4211e..0000000 --- a/org.glite.lbjp-utils.trio/src/trio.c +++ /dev/null @@ -1,5706 +0,0 @@ - -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 1998 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************* - * - * A note to trio contributors: - * - * Avoid heap allocation at all costs to ensure that the trio functions - * are async-safe. The exceptions are the printf/fprintf functions, which - * uses fputc, and the asprintf functions and the modifier, which - * by design are required to allocate form the heap. - * - ************************************************************************/ - -/* - * TODO: - * - Scan is probably too permissive about its modifiers. - * - C escapes in %#[] ? - * - C99 support has not been properly tested. - * - Multibyte characters (done for format parsing, except scan groups) - * - Complex numbers? (C99 _Complex) - * - Boolean values? (C99 _Bool) - * - C99 NaN(n-char-sequence) missing - * - Should we support the GNU %a alloc modifier? GNU has an ugly hack - * for %a, because C99 used %a for other purposes. If specified as - * %as or %a[ it is interpreted as the alloc modifier, otherwise as - * the C99 hex-float. This means that you cannot scan %as as a hex-float - * immediately followed by an 's'. - * - Scanning of collating symbols. - */ - -static const char rcsid[] = "@(#)$Id$"; - -/************************************************************************* - * Trio include files - */ -#include "trio.h" -#include "triop.h" -#include "strio.h" - -#ifdef DATAGRID_EXTENSION -#include "escape.h" -#endif - -/* - * Encode the error code and the position. This is decoded - * with TRIO_ERROR_CODE and TRIO_ERROR_POSITION. - */ -#if TRIO_ERRORS -# define TRIO_ERROR_RETURN(x,y) (- ((x) + ((y) << 8))) -#else -# define TRIO_ERROR_RETURN(x,y) (-1) -#endif - - -/************************************************************************* - * Platform and compiler support detection - */ -#if defined(unix) || defined(__xlC__) || defined(_AIX) || defined(__QNX__) -# define PLATFORM_UNIX -#elif defined(AMIGA) && defined(__GNUC__) -# define PLATFORM_UNIX -#elif defined(WIN32) || defined(_WIN32) || defined(_MSC_VER) -# define PLATFORM_WIN32 -# define TRIO_MSVC_5 1100 -#endif - -#if defined(__STDC__) && defined(__STDC_VERSION__) -# if (__STDC_VERSION__ >= 199409L) -# define TRIO_COMPILER_SUPPORTS_ISO94 -# endif -# if (__STDC_VERSION__ >= 199901L) -# define TRIO_COMPILER_SUPPORTS_C99 -# endif -#endif - -#if defined(_XOPEN_SOURCE) && defined(_XOPEN_SOURCE_EXTENDED) -# define TRIO_COMPILER_SUPPORTS_UNIX98 -#endif - -#if defined(__STDC_ISO_10646__) || defined(MB_LEN_MAX) || defined(USE_MULTIBYTE) || TRIO_WIDECHAR -# define TRIO_COMPILER_SUPPORTS_MULTIBYTE -# if !defined(MB_LEN_MAX) -# define MB_LEN_MAX 6 -# endif -#endif - - -/************************************************************************* - * Generic definitions - */ - -#if !(defined(DEBUG) || defined(NDEBUG)) -# define NDEBUG -#endif -#include -#include -#if !defined(TRIO_COMPILER_SUPPORTS_C99) && !defined(isblank) -# define isblank(x) (((x)==32) || ((x)==9)) -#endif -#include -#include -#include -#include -#include -#include - -#ifndef NULL -# define NULL 0 -#endif -#define NIL ((char)0) -#ifndef FALSE -# define FALSE (1 == 0) -# define TRUE (! FALSE) -#endif -#define BOOLEAN_T int - -/* mincore() can be used for debugging purposes */ -#define VALID(x) (NULL != (x)) - -/* xlC crashes on log10(0) */ -#define guarded_log10(x) (((x) == 0.0) ? -HUGE_VAL : log10(x)) -#define guarded_log16(x) (guarded_log10(x) / log10(16.0)) - - -/************************************************************************* - * Platform specific definitions - */ -#if defined(PLATFORM_UNIX) -# include -# include -# include -# define USE_LOCALE -#endif /* PLATFORM_UNIX */ -#if defined(PLATFORM_WIN32) -# include -# define read _read -# define write _write -#endif /* PLATFORM_WIN32 */ - -#if TRIO_WIDECHAR -# if defined(TRIO_COMPILER_SUPPORTS_ISO94) -# include -# include -# else -typedef char wchar_t; -typedef int wint_t; -# define WEOF EOF -# define iswalnum(x) isalnum(x) -# define iswalpha(x) isalpha(x) -# define iswblank(x) isblank(x) -# define iswcntrl(x) iscntrl(x) -# define iswdigit(x) isdigit(x) -# define iswgraph(x) isgraph(x) -# define iswlower(x) islower(x) -# define iswprint(x) isprint(x) -# define iswpunct(x) ispunct(x) -# define iswspace(x) isspace(x) -# define iswupper(x) isupper(x) -# define iswxdigit(x) isxdigit(x) -# endif -#endif - - -/************************************************************************* - * Compiler dependent definitions - */ - -/* Support for long long */ -#ifndef __cplusplus -# if !defined(USE_LONGLONG) -# if defined(__GNUC__) && !defined(__STRICT_ANSI__) -# define USE_LONGLONG -# elif defined(__SUNPRO_C) -# define USE_LONGLONG -# elif defined(_LONG_LONG) || defined(_LONGLONG) -# define USE_LONGLONG -# endif -# endif -#endif - -/* The extra long numbers */ -#if defined(USE_LONGLONG) -typedef signed long long int trio_longlong_t; -typedef unsigned long long int trio_ulonglong_t; -#elif defined(_MSC_VER) -# if (_MSC_VER >= TRIO_MSVC_5) -typedef signed __int64 trio_longlong_t; -typedef unsigned __int64 trio_ulonglong_t; -# else -typedef signed long int trio_longlong_t; -typedef unsigned long int trio_ulonglong_t; -# endif -#else -typedef signed long int trio_longlong_t; -typedef unsigned long int trio_ulonglong_t; -#endif - -/* Maximal and fixed integer types */ -#if defined(TRIO_COMPILER_SUPPORTS_C99) -# include -typedef intmax_t trio_intmax_t; -typedef uintmax_t trio_uintmax_t; -typedef int8_t trio_int8_t; -typedef int16_t trio_int16_t; -typedef int32_t trio_int32_t; -typedef int64_t trio_int64_t; -#elif defined(TRIO_COMPILER_SUPPORTS_UNIX98) -# include -typedef intmax_t trio_intmax_t; -typedef uintmax_t trio_uintmax_t; -typedef int8_t trio_int8_t; -typedef int16_t trio_int16_t; -typedef int32_t trio_int32_t; -typedef int64_t trio_int64_t; -#elif defined(_MSC_VER) && (_MSC_VER >= TRIO_MSVC_5) -typedef trio_longlong_t trio_intmax_t; -typedef trio_ulonglong_t trio_uintmax_t; -typedef __int8 trio_int8_t; -typedef __int16 trio_int16_t; -typedef __int32 trio_int32_t; -typedef __int64 trio_int64_t; -#else -typedef trio_longlong_t trio_intmax_t; -typedef trio_ulonglong_t trio_uintmax_t; -# if defined(TRIO_INT8_T) -typedef TRIO_INT8_T trio_int8_t; -# else -typedef signed char trio_int8_t; -# endif -# if defined(TRIO_INT16_T) -typedef TRIO_INT16_T trio_int16_t; -# else -typedef signed short trio_int16_t; -# endif -# if defined(TRIO_INT32_T) -typedef TRIO_INT32_T trio_int32_t; -# else -typedef signed int trio_int32_t; -# endif -# if defined(TRIO_INT64_T) -typedef TRIO_INT64_T trio_int64_t; -# else -typedef trio_longlong_t trio_int64_t; -# endif -#endif - - -/************************************************************************* - * Internal definitions - */ - -/* Long double sizes */ -#ifdef LDBL_DIG -# define MAX_MANTISSA_DIGITS LDBL_DIG -# define MAX_EXPONENT_DIGITS 4 -#else -# define MAX_MANTISSA_DIGITS DBL_DIG -# define MAX_EXPONENT_DIGITS 3 -#endif - -/* The maximal number of digits is for base 2 */ -#define MAX_CHARS_IN(x) (sizeof(x) * CHAR_BIT) -/* The width of a pointer. The number of bits in a hex digit is 4 */ -#define POINTER_WIDTH ((sizeof("0x") - 1) + sizeof(void *) * CHAR_BIT / 4) - -/* Infinite and Not-A-Number for floating-point */ -#define INFINITE_LOWER "inf" -#define INFINITE_UPPER "INF" -#define LONG_INFINITE_LOWER "infinite" -#define LONG_INFINITE_UPPER "INFINITE" -#define NAN_LOWER "nan" -#define NAN_UPPER "NAN" - -/* Various constants */ -enum { - TYPE_PRINT = 1, - TYPE_SCAN = 2, - - /* Flags. Use maximum 32 */ - FLAGS_NEW = 0, - FLAGS_STICKY = 1, - FLAGS_SPACE = 2 * FLAGS_STICKY, - FLAGS_SHOWSIGN = 2 * FLAGS_SPACE, - FLAGS_LEFTADJUST = 2 * FLAGS_SHOWSIGN, - FLAGS_ALTERNATIVE = 2 * FLAGS_LEFTADJUST, - FLAGS_SHORT = 2 * FLAGS_ALTERNATIVE, - FLAGS_SHORTSHORT = 2 * FLAGS_SHORT, - FLAGS_LONG = 2 * FLAGS_SHORTSHORT, - FLAGS_QUAD = 2 * FLAGS_LONG, - FLAGS_LONGDOUBLE = 2 * FLAGS_QUAD, - FLAGS_SIZE_T = 2 * FLAGS_LONGDOUBLE, - FLAGS_PTRDIFF_T = 2 * FLAGS_SIZE_T, - FLAGS_INTMAX_T = 2 * FLAGS_PTRDIFF_T, - FLAGS_NILPADDING = 2 * FLAGS_INTMAX_T, - FLAGS_UNSIGNED = 2 * FLAGS_NILPADDING, - FLAGS_UPPER = 2 * FLAGS_UNSIGNED, - FLAGS_WIDTH = 2 * FLAGS_UPPER, - FLAGS_WIDTH_PARAMETER = 2 * FLAGS_WIDTH, - FLAGS_PRECISION = 2 * FLAGS_WIDTH_PARAMETER, - FLAGS_PRECISION_PARAMETER = 2 * FLAGS_PRECISION, - FLAGS_BASE = 2 * FLAGS_PRECISION_PARAMETER, - FLAGS_BASE_PARAMETER = 2 * FLAGS_BASE, - FLAGS_FLOAT_E = 2 * FLAGS_BASE_PARAMETER, - FLAGS_FLOAT_G = 2 * FLAGS_FLOAT_E, - FLAGS_QUOTE = 2 * FLAGS_FLOAT_G, - FLAGS_WIDECHAR = 2 * FLAGS_QUOTE, - FLAGS_ALLOC = 2 * FLAGS_WIDECHAR, - FLAGS_IGNORE = 2 * FLAGS_ALLOC, - FLAGS_IGNORE_PARAMETER = 2 * FLAGS_IGNORE, - FLAGS_VARSIZE_PARAMETER = 2 * FLAGS_IGNORE_PARAMETER, - FLAGS_FIXED_SIZE = 2 * FLAGS_VARSIZE_PARAMETER, - /* Reused flags */ - FLAGS_EXCLUDE = FLAGS_SHORT, - FLAGS_USER_DEFINED = FLAGS_IGNORE, - /* Compounded flags */ - FLAGS_ALL_VARSIZES = FLAGS_LONG | FLAGS_QUAD | FLAGS_INTMAX_T | FLAGS_PTRDIFF_T | FLAGS_SIZE_T, - FLAGS_ALL_SIZES = FLAGS_ALL_VARSIZES | FLAGS_SHORTSHORT | FLAGS_SHORT, - - NO_POSITION = -1, - NO_WIDTH = 0, - NO_PRECISION = -1, - NO_SIZE = -1, - - NO_BASE = -1, - MIN_BASE = 2, - MAX_BASE = 36, - BASE_BINARY = 2, - BASE_OCTAL = 8, - BASE_DECIMAL = 10, - BASE_HEX = 16, - - /* Maximal number of allowed parameters */ - MAX_PARAMETERS = 64, - /* Maximal number of characters in class */ - MAX_CHARACTER_CLASS = UCHAR_MAX, - - /* Maximal string lengths for user-defined specifiers */ - MAX_USER_NAME = 64, - MAX_USER_DATA = 256, - - /* Maximal length of locale separator strings */ - MAX_LOCALE_SEPARATOR_LENGTH = MB_LEN_MAX, - /* Maximal number of integers in grouping */ - MAX_LOCALE_GROUPS = 64 -}; - -#define NO_GROUPING ((int)CHAR_MAX) - -/* Fundamental formatting parameter types */ -#define FORMAT_UNKNOWN 0 -#define FORMAT_INT 1 -#define FORMAT_DOUBLE 2 -#define FORMAT_CHAR 3 -#define FORMAT_STRING 4 -#define FORMAT_POINTER 5 -#define FORMAT_COUNT 6 -#define FORMAT_PARAMETER 7 -#define FORMAT_GROUP 8 -#if TRIO_GNU -# define FORMAT_ERRNO 9 -#endif -#if TRIO_EXTENSION -# define FORMAT_USER_DEFINED 10 -#endif - -/* Character constants */ -#define CHAR_IDENTIFIER '%' -#define CHAR_BACKSLASH '\\' -#define CHAR_QUOTE '\"' -#define CHAR_ADJUST ' ' - -/* Character class expressions */ -#define CLASS_ALNUM ":alnum:" -#define CLASS_ALPHA ":alpha:" -#define CLASS_CNTRL ":cntrl:" -#define CLASS_DIGIT ":digit:" -#define CLASS_GRAPH ":graph:" -#define CLASS_LOWER ":lower:" -#define CLASS_PRINT ":print:" -#define CLASS_PUNCT ":punct:" -#define CLASS_SPACE ":space:" -#define CLASS_UPPER ":upper:" -#define CLASS_XDIGIT ":xdigit:" - -/* - * SPECIFIERS: - * - * - * a Hex-float - * A Hex-float - * c Character - * C Widechar character (wint_t) - * d Decimal - * e Float - * E Float - * F Float - * F Float - * g Float - * G Float - * i Integer - * m Error message - * n Count - * o Octal - * p Pointer - * s String - * S Widechar string (wchar_t *) - * u Unsigned - * x Hex - * X Hex - * [] Group - * <> User-defined - * - * Reserved: - * - * D Binary Coded Decimal %D(length,precision) (OS/390) - */ -#define SPECIFIER_CHAR 'c' -#define SPECIFIER_STRING 's' -#define SPECIFIER_DECIMAL 'd' -#define SPECIFIER_INTEGER 'i' -#define SPECIFIER_UNSIGNED 'u' -#define SPECIFIER_OCTAL 'o' -#define SPECIFIER_HEX 'x' -#define SPECIFIER_HEX_UPPER 'X' -#define SPECIFIER_FLOAT_E 'e' -#define SPECIFIER_FLOAT_E_UPPER 'E' -#define SPECIFIER_FLOAT_F 'f' -#define SPECIFIER_FLOAT_F_UPPER 'F' -#define SPECIFIER_FLOAT_G 'g' -#define SPECIFIER_FLOAT_G_UPPER 'G' -#define SPECIFIER_POINTER 'p' -#define SPECIFIER_GROUP '[' -#define SPECIFIER_UNGROUP ']' -#define SPECIFIER_COUNT 'n' -#if TRIO_UNIX98 -# define SPECIFIER_CHAR_UPPER 'C' -# define SPECIFIER_STRING_UPPER 'S' -#endif -#if TRIO_C99 -# define SPECIFIER_HEXFLOAT 'a' -# define SPECIFIER_HEXFLOAT_UPPER 'A' -#endif -#if TRIO_GNU -# define SPECIFIER_ERRNO 'm' -#endif -#if TRIO_EXTENSION -# define SPECIFIER_BINARY 'b' -# define SPECIFIER_BINARY_UPPER 'B' -# define SPECIFIER_USER_DEFINED_BEGIN '<' -# define SPECIFIER_USER_DEFINED_END '>' -# define SPECIFIER_USER_DEFINED_SEPARATOR ':' -#endif - -/* - * QUALIFIERS: - * - * - * Numbers = d,i,o,u,x,X - * Float = a,A,e,E,f,F,g,G - * String = s - * Char = c - * - * - * 9$ Position - * Use the 9th parameter. 9 can be any number between 1 and - * the maximal argument - * - * 9 Width - * Set width to 9. 9 can be any number, but must not be postfixed - * by '$' - * - * h Short - * Numbers: - * (unsigned) short int - * - * hh Short short - * Numbers: - * (unsigned) char - * - * l Long - * Numbers: - * (unsigned) long int - * String: - * as the S specifier - * Char: - * as the C specifier - * - * ll Long Long - * Numbers: - * (unsigned) long long int - * - * L Long Double - * Float - * long double - * - * # Alternative - * Float: - * Decimal-point is always present - * String: - * non-printable characters are handled as \number - * - * Spacing - * - * + Sign - * - * - Alignment - * - * . Precision - * - * * Parameter - * print: use parameter - * scan: no parameter (ignore) - * - * q Quad - * - * Z size_t - * - * w Widechar - * - * ' Thousands/quote - * Numbers: - * Integer part grouped in thousands - * Binary numbers: - * Number grouped in nibbles (4 bits) - * String: - * Quoted string - * - * j intmax_t - * t prtdiff_t - * z size_t - * - * ! Sticky - * @ Parameter (for both print and scan) - * - * I n-bit Integer - * Numbers: - * The following options exists - * I8 = 8-bit integer - * I16 = 16-bit integer - * I32 = 32-bit integer - * I64 = 64-bit integer - */ -#define QUALIFIER_POSITION '$' -#define QUALIFIER_SHORT 'h' -#define QUALIFIER_LONG 'l' -#define QUALIFIER_LONG_UPPER 'L' -#define QUALIFIER_ALTERNATIVE '#' -#define QUALIFIER_SPACE ' ' -#define QUALIFIER_PLUS '+' -#define QUALIFIER_MINUS '-' -#define QUALIFIER_DOT '.' -#define QUALIFIER_STAR '*' -#define QUALIFIER_CIRCUMFLEX '^' -#if TRIO_C99 -# define QUALIFIER_SIZE_T 'z' -# define QUALIFIER_PTRDIFF_T 't' -# define QUALIFIER_INTMAX_T 'j' -#endif -#if TRIO_BSD || TRIO_GNU -# define QUALIFIER_QUAD 'q' -#endif -#if TRIO_GNU -# define QUALIFIER_SIZE_T_UPPER 'Z' -#endif -#if TRIO_MISC -# define QUALIFIER_WIDECHAR 'w' -#endif -#if TRIO_MICROSOFT -# define QUALIFIER_FIXED_SIZE 'I' -#endif -#if TRIO_EXTENSION -# define QUALIFIER_QUOTE '\'' -# define QUALIFIER_STICKY '!' -# define QUALIFIER_VARSIZE '&' /* This should remain undocumented */ -# define QUALIFIER_PARAM '@' /* Experimental */ -# define QUALIFIER_COLON ':' /* For scanlists */ -# define QUALIFIER_EQUAL '=' /* For scanlists */ -#endif -#if DATAGRID_EXTENSION -# define QUALIFIER_ESCAPE '|' -#endif - - -/************************************************************************* - * Internal structures - */ - -/* Parameters */ -typedef struct { - int type; - unsigned long flags; - int width; - int precision; - int base; - int varsize; -#ifdef QUALIFIER_ESCAPE - enum dg_escape { ESCAPE_NONE, ESCAPE_ULM, ESCAPE_XML, ESCAPE_SQL } escape; -#endif - int indexAfterSpecifier; - union { - char *string; -#if TRIO_WIDECHAR - wchar_t *wstring; -#endif - void *pointer; - union { - trio_uintmax_t as_signed; - trio_intmax_t as_unsigned; - } number; - double doubleNumber; - double *doublePointer; - long double longdoubleNumber; - long double *longdoublePointer; - int errorNumber; - } data; - /* For the user-defined specifier */ - char user_name[MAX_USER_NAME]; - char user_data[MAX_USER_DATA]; -} parameter_T; - -/* General trio "class" */ -typedef struct _trio_T { - void *location; - void (*OutStream)(struct _trio_T *, int); - void (*InStream)(struct _trio_T *, int *); - /* - * The number of characters that would have been written/read if - * there had been sufficient space. - */ - int processed; - /* - * The number of characters that are actually written/read. - * Processed and committed with only differ for the *nprintf - * and *nscanf functions. - */ - int committed; - int max; - int current; -} trio_T; - -/* References (for user-defined callbacks) */ -typedef struct _reference_T { - trio_T *data; - parameter_T *parameter; -} reference_T; - -/* Registered entries (for user-defined callbacks) */ -typedef struct _userdef_T { - struct _userdef_T *next; - trio_callback_t callback; - char *name; -} userdef_T; - - -/************************************************************************* - * Internal variables - */ - -static const char null[] = "(nil)"; - -#if defined(USE_LOCALE) -static struct lconv *internalLocaleValues = NULL; -#endif - -/* - * UNIX98 says "in a locale where the radix character is not defined, - * the radix character defaults to a period (.)" - */ -static char internalDecimalPoint[MAX_LOCALE_SEPARATOR_LENGTH + 1] = "."; -static char internalThousandSeparator[MAX_LOCALE_SEPARATOR_LENGTH + 1] = ","; -static char internalGrouping[MAX_LOCALE_GROUPS] = { (char)NO_GROUPING }; - -static const char internalDigitsLower[] = "0123456789abcdefghijklmnopqrstuvwxyz"; -static const char internalDigitsUpper[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; -static BOOLEAN_T internalDigitsUnconverted = TRUE; -static int internalDigitArray[128]; -#if TRIO_EXTENSION -static BOOLEAN_T internalCollationUnconverted = TRUE; -static char internalCollationArray[MAX_CHARACTER_CLASS][MAX_CHARACTER_CLASS]; -#endif - -static volatile trio_callback_t internalEnterCriticalRegion = NULL; -static volatile trio_callback_t internalLeaveCriticalRegion = NULL; -static userdef_T *internalUserDef = NULL; - - -/************************************************************************* - * trio_strerror [public] - */ -const char *trio_strerror(int errorcode) -{ - /* Textual versions of the error codes */ - switch (TRIO_ERROR_CODE(errorcode)) - { - case TRIO_EOF: - return "End of file"; - case TRIO_EINVAL: - return "Invalid argument"; - case TRIO_ETOOMANY: - return "Too many arguments"; - case TRIO_EDBLREF: - return "Double reference"; - case TRIO_EGAP: - return "Reference gap"; - case TRIO_ENOMEM: - return "Out of memory"; - case TRIO_ERANGE: - return "Invalid range"; - default: - return "Unknown"; - } -} - -/************************************************************************* - * TrioIsQualifier [private] - * - * Description: - * Remember to add all new qualifiers to this function. - * QUALIFIER_POSITION must not be added. - */ -static BOOLEAN_T -TrioIsQualifier(const char ch) -{ - /* QUALIFIER_POSITION is not included */ - switch (ch) - { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - case QUALIFIER_PLUS: - case QUALIFIER_MINUS: - case QUALIFIER_SPACE: - case QUALIFIER_DOT: - case QUALIFIER_STAR: - case QUALIFIER_ALTERNATIVE: - case QUALIFIER_SHORT: - case QUALIFIER_LONG: - case QUALIFIER_LONG_UPPER: - case QUALIFIER_CIRCUMFLEX: -#if defined(QUALIFIER_SIZE_T) - case QUALIFIER_SIZE_T: -#endif -#if defined(QUALIFIER_PTRDIFF_T) - case QUALIFIER_PTRDIFF_T: -#endif -#if defined(QUALIFIER_INTMAX_T) - case QUALIFIER_INTMAX_T: -#endif -#if defined(QUALIFIER_QUAD) - case QUALIFIER_QUAD: -#endif -#if defined(QUALIFIER_SIZE_T_UPPER) - case QUALIFIER_SIZE_T_UPPER: -#endif -#if defined(QUALIFIER_WIDECHAR) - case QUALIFIER_WIDECHAR: -#endif -#if defined(QUALIFIER_QUOTE) - case QUALIFIER_QUOTE: -#endif -#if defined(QUALIFIER_STICKY) - case QUALIFIER_STICKY: -#endif -#if defined(QUALIFIER_VARSIZE) - case QUALIFIER_VARSIZE: -#endif -#if defined(QUALIFIER_PARAM) - case QUALIFIER_PARAM: -#endif -#if defined(QUALIFIER_FIXED_SIZE) - case QUALIFIER_FIXED_SIZE: -#endif -#ifdef QUALIFIER_ESCAPE - case QUALIFIER_ESCAPE: -#endif - return TRUE; - default: - return FALSE; - } -} - -/************************************************************************* - * TrioGenerateNan [private] - * - * Calculating NaN portably is difficult. Some compilers will emit - * warnings about divide by zero, and others will simply fail to - * generate a NaN. - */ -static double -TrioGenerateNaN(void) -{ -#if defined(TRIO_COMPILER_SUPPORTS_C99) - return nan(NULL); -#elif defined(DBL_QNAN) - return DBL_QNAN; -#elif defined(PLATFORM_UNIX) - double value; - void (*signal_handler)(int); - - signal_handler = signal(SIGFPE, SIG_IGN); - value = 0.0 / 0.0; - signal(SIGFPE, signal_handler); - return value; -#else - return 0.0 / 0.0; -#endif -} - -/************************************************************************* - * TrioIsNan [private] - */ -static int -TrioIsNan(double number) -{ -#ifdef isnan - /* C99 defines isnan() as a macro */ - return isnan(number); -#else - double integral, fraction; - - return (/* NaN is the only number which does not compare to itself */ - (number != number) || - /* Fallback solution if NaN compares to NaN */ - ((number != 0.0) && - (fraction = modf(number, &integral), - integral == fraction))); -#endif -} - -/************************************************************************* - * TrioIsInfinite [private] - */ -static int -TrioIsInfinite(double number) -{ -#ifdef isinf - /* C99 defines isinf() as a macro */ - return isinf(number); -#else - return ((number == HUGE_VAL) ? 1 : ((number == -HUGE_VAL) ? -1 : 0)); -#endif -} - -/************************************************************************* - * TrioSetLocale [private] - */ -#if defined(USE_LOCALE) -static void -TrioSetLocale(void) -{ - internalLocaleValues = (struct lconv *)localeconv(); - if (internalLocaleValues) - { - if ((internalLocaleValues->decimal_point) && - (internalLocaleValues->decimal_point[0] != NIL)) - { - StrCopyMax(internalDecimalPoint, - sizeof(internalDecimalPoint), - internalLocaleValues->decimal_point); - } - if ((internalLocaleValues->thousands_sep) && - (internalLocaleValues->thousands_sep[0] != NIL)) - { - StrCopyMax(internalThousandSeparator, - sizeof(internalThousandSeparator), - internalLocaleValues->thousands_sep); - } - if ((internalLocaleValues->grouping) && - (internalLocaleValues->grouping[0] != NIL)) - { - StrCopyMax(internalGrouping, - sizeof(internalGrouping), - internalLocaleValues->grouping); - } - } -} -#endif /* defined(USE_LOCALE) */ - -/************************************************************************* - * TrioGetPosition [private] - * - * Get the %n$ position. - */ -static int -TrioGetPosition(const char *format, - int *indexPointer) -{ - char *tmpformat; - int number = 0; - int index = *indexPointer; - - number = (int)StrToLong(&format[index], &tmpformat, BASE_DECIMAL); - index = (int)(tmpformat - format); - if ((number != 0) && (QUALIFIER_POSITION == format[index++])) - { - *indexPointer = index; - /* - * number is decreased by 1, because n$ starts from 1, whereas - * the array it is indexing starts from 0. - */ - return number - 1; - } - return NO_POSITION; -} - -/************************************************************************* - * TrioFindNamespace [private] - * - * Find registered user-defined specifier. - * The prev argument is used for optimisation only. - */ -static userdef_T * -TrioFindNamespace(const char *name, userdef_T **prev) -{ - userdef_T *def; - - if (internalEnterCriticalRegion) - (void)internalEnterCriticalRegion(NULL); - - for (def = internalUserDef; def; def = def->next) - { - /* Case-sensitive string comparison */ - if (StrEqualCase(def->name, name)) - break; - - if (prev) - *prev = def; - } - - if (internalLeaveCriticalRegion) - (void)internalLeaveCriticalRegion(NULL); - - return def; -} - -/************************************************************************* - * TrioPreprocess [private] - * - * Description: - * Parse the format string - */ -static int -TrioPreprocess(int type, - const char *format, - parameter_T *parameters, - va_list arglist, - void **argarray) -{ -#if TRIO_ERRORS - /* Count the number of times a parameter is referenced */ - unsigned short usedEntries[MAX_PARAMETERS]; -#endif - /* Parameter counters */ - int parameterPosition; - int currentParam; - int maxParam = -1; - /* Utility variables */ - unsigned long flags; - int width; - int precision; - int varsize; -#ifdef QUALIFIER_ESCAPE - enum dg_escape escape; -#endif - int base; - int index; /* Index into formatting string */ - int dots; /* Count number of dots in modifier part */ - BOOLEAN_T positional; /* Does the specifier have a positional? */ - BOOLEAN_T got_sticky = FALSE; /* Are there any sticky modifiers at all? */ - /* - * indices specifies the order in which the parameters must be - * read from the va_args (this is necessary to handle positionals) - */ - int indices[MAX_PARAMETERS]; - int pos = 0; - /* Various variables */ - char ch; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int charlen; -#endif - int i = -1; - int num; - char *tmpformat; - - -#if TRIO_ERRORS - /* - * The 'parameters' array is not initialized, but we need to - * know which entries we have used. - */ - memset(usedEntries, 0, sizeof(usedEntries)); -#endif - - index = 0; - parameterPosition = 0; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - while (format[index]) - { -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - if (! isascii(format[index])) - { - /* - * Multibyte characters cannot be legal specifiers or - * modifiers, so we skip over them. - */ - charlen = mblen(&format[index], MB_LEN_MAX); - index += (charlen > 0) ? charlen : 1; - continue; /* while */ - } -#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - if (CHAR_IDENTIFIER == format[index++]) - { - if (CHAR_IDENTIFIER == format[index]) - { - index++; - continue; /* while */ - } - - flags = FLAGS_NEW; - dots = 0; - currentParam = TrioGetPosition(format, &index); - positional = (NO_POSITION != currentParam); - if (!positional) - { - /* We have no positional, get the next counter */ - currentParam = parameterPosition; - } - if(currentParam >= MAX_PARAMETERS) - { - /* Bail out completely to make the error more obvious */ - return TRIO_ERROR_RETURN(TRIO_ETOOMANY, index); - } - - if (currentParam > maxParam) - maxParam = currentParam; - - /* Default values */ - width = NO_WIDTH; - precision = NO_PRECISION; - base = NO_BASE; - varsize = NO_SIZE; -#ifdef QUALIFIER_ESCAPE - escape = ESCAPE_NONE; -#endif - - while (TrioIsQualifier(format[index])) - { - ch = format[index++]; - - switch (ch) - { - case QUALIFIER_SPACE: - flags |= FLAGS_SPACE; - break; - - case QUALIFIER_PLUS: - flags |= FLAGS_SHOWSIGN; - break; - - case QUALIFIER_MINUS: - flags |= FLAGS_LEFTADJUST; - flags &= ~FLAGS_NILPADDING; - break; - - case QUALIFIER_ALTERNATIVE: - flags |= FLAGS_ALTERNATIVE; - break; - - case QUALIFIER_DOT: - if (dots == 0) /* Precision */ - { - dots++; - - /* Skip if no precision */ - if (QUALIFIER_DOT == format[index]) - break; - - /* After the first dot we have the precision */ - flags |= FLAGS_PRECISION; - if ((QUALIFIER_STAR == format[index]) || - (QUALIFIER_PARAM == format[index])) - { - index++; - flags |= FLAGS_PRECISION_PARAMETER; - - precision = TrioGetPosition(format, &index); - if (precision == NO_POSITION) - { - parameterPosition++; - if (positional) - precision = parameterPosition; - else - { - precision = currentParam; - currentParam = precision + 1; - } - } - else - { - if (! positional) - currentParam = precision + 1; - if (width > maxParam) - maxParam = precision; - } - if (currentParam > maxParam) - maxParam = currentParam; - } - else - { - precision = StrToLong(&format[index], &tmpformat, BASE_DECIMAL); - index = (int)(tmpformat - format); - } - } - else if (dots == 1) /* Base */ - { - dots++; - - /* After the second dot we have the base */ - flags |= FLAGS_BASE; - if ((QUALIFIER_STAR == format[index]) || - (QUALIFIER_PARAM == format[index])) - { - index++; - flags |= FLAGS_BASE_PARAMETER; - base = TrioGetPosition(format, &index); - if (base == NO_POSITION) - { - parameterPosition++; - if (positional) - base = parameterPosition; - else - { - base = currentParam; - currentParam = base + 1; - } - } - else - { - if (! positional) - currentParam = base + 1; - if (base > maxParam) - maxParam = base; - } - if (currentParam > maxParam) - maxParam = currentParam; - } - else - { - base = StrToLong(&format[index], &tmpformat, BASE_DECIMAL); - if (base > MAX_BASE) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - index = (int)(tmpformat - format); - } - } - else - { - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - break; /* QUALIFIER_DOT */ - - case QUALIFIER_PARAM: - type = TYPE_PRINT; - /* FALLTHROUGH */ - case QUALIFIER_STAR: - /* This has different meanings for print and scan */ - if (TYPE_PRINT == type) - { - /* Read with from parameter */ - flags |= (FLAGS_WIDTH | FLAGS_WIDTH_PARAMETER); - width = TrioGetPosition(format, &index); - if (width == NO_POSITION) - { - parameterPosition++; - if (positional) - width = parameterPosition; - else - { - width = currentParam; - currentParam = width + 1; - } - } - else - { - if (! positional) - currentParam = width + 1; - if (width > maxParam) - maxParam = width; - } - if (currentParam > maxParam) - maxParam = currentParam; - } - else - { - /* Scan, but do not store result */ - flags |= FLAGS_IGNORE; - } - - break; /* QUALIFIER_STAR */ - - case '0': - if (! (flags & FLAGS_LEFTADJUST)) - flags |= FLAGS_NILPADDING; - /* FALLTHROUGH */ - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - flags |= FLAGS_WIDTH; - /* &format[index - 1] is used to "rewind" the read - * character from format - */ - width = StrToLong(&format[index - 1], &tmpformat, BASE_DECIMAL); - index = (int)(tmpformat - format); - break; - - case QUALIFIER_SHORT: - if (flags & FLAGS_SHORTSHORT) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - else if (flags & FLAGS_SHORT) - flags |= FLAGS_SHORTSHORT; - else - flags |= FLAGS_SHORT; - break; - - case QUALIFIER_LONG: - if (flags & FLAGS_QUAD) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - else if (flags & FLAGS_LONG) - flags |= FLAGS_QUAD; - else - flags |= FLAGS_LONG; - break; - - case QUALIFIER_LONG_UPPER: - flags |= FLAGS_LONGDOUBLE; - break; - -#if defined(QUALIFIER_SIZE_T) - case QUALIFIER_SIZE_T: - flags |= FLAGS_SIZE_T; - /* Modify flags for later truncation of number */ - if (sizeof(size_t) == sizeof(trio_ulonglong_t)) - flags |= FLAGS_QUAD; - else if (sizeof(size_t) == sizeof(long)) - flags |= FLAGS_LONG; - break; -#endif - -#if defined(QUALIFIER_PTRDIFF_T) - case QUALIFIER_PTRDIFF_T: - flags |= FLAGS_PTRDIFF_T; - if (sizeof(ptrdiff_t) == sizeof(trio_ulonglong_t)) - flags |= FLAGS_QUAD; - else if (sizeof(ptrdiff_t) == sizeof(long)) - flags |= FLAGS_LONG; - break; -#endif - -#if defined(QUALIFIER_INTMAX_T) - case QUALIFIER_INTMAX_T: - flags |= FLAGS_INTMAX_T; - if (sizeof(trio_intmax_t) == sizeof(trio_ulonglong_t)) - flags |= FLAGS_QUAD; - else if (sizeof(trio_intmax_t) == sizeof(long)) - flags |= FLAGS_LONG; - break; -#endif - -#if defined(QUALIFIER_QUAD) - case QUALIFIER_QUAD: - flags |= FLAGS_QUAD; - break; -#endif - -#if defined(QUALIFIER_FIXED_SIZE) - case QUALIFIER_FIXED_SIZE: - if (flags & FLAGS_FIXED_SIZE) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - if (flags & (FLAGS_ALL_SIZES | FLAGS_LONGDOUBLE | - FLAGS_WIDECHAR | FLAGS_VARSIZE_PARAMETER)) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - if ((format[index] == '6') && - (format[index + 1] == '4')) - { - varsize = sizeof(trio_int64_t); - index += 2; - } - else if ((format[index] == '3') && - (format[index + 1] == '2')) - { - varsize = sizeof(trio_int32_t); - index += 2; - } - else if ((format[index] == '1') && - (format[index + 1] == '6')) - { - varsize = sizeof(trio_int16_t); - index += 2; - } - else if (format[index] == '8') - { - varsize = sizeof(trio_int8_t); - index++; - } - else - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - flags |= FLAGS_FIXED_SIZE; - break; -#endif - -#ifdef QUALIFIER_ESCAPE - case QUALIFIER_ESCAPE: - switch (format[index++]) { - case 'U': escape = ESCAPE_ULM; break; - case 'X': escape = ESCAPE_XML; break; - case 'S': escape = ESCAPE_SQL; break; - default: return TRIO_ERROR_RETURN(TRIO_EINVAL,index); - } - break; -#endif - - -#if defined(QUALIFIER_WIDECHAR) - case QUALIFIER_WIDECHAR: - flags |= FLAGS_WIDECHAR; - break; -#endif - -#if defined(QUALIFIER_SIZE_T_UPPER) - case QUALIFIER_SIZE_T_UPPER: - break; -#endif - -#if defined(QUALIFIER_QUOTE) - case QUALIFIER_QUOTE: - flags |= FLAGS_QUOTE; - break; -#endif - -#if defined(QUALIFIER_STICKY) - case QUALIFIER_STICKY: - flags |= FLAGS_STICKY; - got_sticky = TRUE; - break; -#endif - -#if defined(QUALIFIER_VARSIZE) - case QUALIFIER_VARSIZE: - flags |= FLAGS_VARSIZE_PARAMETER; - parameterPosition++; - if (positional) - varsize = parameterPosition; - else - { - varsize = currentParam; - currentParam = varsize + 1; - } - if (currentParam > maxParam) - maxParam = currentParam; - break; -#endif - - default: - /* Bail out completely to make the error more obvious */ - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - } /* while qualifier */ - - /* - * Parameters only need the type and value. The value is - * read later. - */ - if (flags & FLAGS_WIDTH_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[width] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[width] = pos; - width = pos++; - } - if (flags & FLAGS_PRECISION_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[precision] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[precision] = pos; - precision = pos++; - } - if (flags & FLAGS_BASE_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[base] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[base] = pos; - base = pos++; - } - if (flags & FLAGS_VARSIZE_PARAMETER) - { -#if TRIO_ERRORS - usedEntries[varsize] += 1; -#endif - parameters[pos].type = FORMAT_PARAMETER; - indices[varsize] = pos; - varsize = pos++; - } - - indices[currentParam] = pos; - - switch (format[index++]) - { -#if defined(SPECIFIER_CHAR_UPPER) - case SPECIFIER_CHAR_UPPER: - flags |= FLAGS_WIDECHAR; - /* FALLTHROUGH */ -#endif - case SPECIFIER_CHAR: - if (flags & FLAGS_LONG) - flags |= FLAGS_WIDECHAR; - else if (flags & FLAGS_SHORT) - flags &= ~FLAGS_WIDECHAR; - parameters[pos].type = FORMAT_CHAR; - break; - -#if defined(SPECIFIER_STRING_UPPER) - case SPECIFIER_STRING_UPPER: - flags |= FLAGS_WIDECHAR; - /* FALLTHROUGH */ -#endif - case SPECIFIER_STRING: - if (flags & FLAGS_LONG) - flags |= FLAGS_WIDECHAR; - else if (flags & FLAGS_SHORT) - flags &= ~FLAGS_WIDECHAR; - parameters[pos].type = FORMAT_STRING; - break; - - - case SPECIFIER_GROUP: - if (TYPE_SCAN == type) - { - int depth = 1; - parameters[pos].type = FORMAT_GROUP; - if (format[index] == QUALIFIER_CIRCUMFLEX) - index++; - if (format[index] == SPECIFIER_UNGROUP) - index++; - if (format[index] == QUALIFIER_MINUS) - index++; - /* Skip nested brackets */ - while (format[index] != NIL) - { - if (format[index] == SPECIFIER_GROUP) - { - depth++; - } - else if (format[index] == SPECIFIER_UNGROUP) - { - if (--depth <= 0) - { - index++; - break; - } - } - index++; - } - } - break; - - case SPECIFIER_INTEGER: - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_UNSIGNED: - flags |= FLAGS_UNSIGNED; - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_DECIMAL: - /* Disable base modifier */ - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_DECIMAL; - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_OCTAL: - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_OCTAL; - parameters[pos].type = FORMAT_INT; - break; - -#if defined(SPECIFIER_BINARY) - case SPECIFIER_BINARY_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_BINARY: - flags |= FLAGS_NILPADDING; - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_BINARY; - parameters[pos].type = FORMAT_INT; - break; -#endif - - case SPECIFIER_HEX_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_HEX: - flags |= FLAGS_UNSIGNED; - flags &= ~FLAGS_BASE_PARAMETER; - base = BASE_HEX; - parameters[pos].type = FORMAT_INT; - break; - - case SPECIFIER_FLOAT_E_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_FLOAT_E: - flags |= FLAGS_FLOAT_E; - parameters[pos].type = FORMAT_DOUBLE; - break; - - case SPECIFIER_FLOAT_G_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_FLOAT_G: - flags |= FLAGS_FLOAT_G; - parameters[pos].type = FORMAT_DOUBLE; - break; - - case SPECIFIER_FLOAT_F_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ - case SPECIFIER_FLOAT_F: - parameters[pos].type = FORMAT_DOUBLE; - break; - - case SPECIFIER_POINTER: - parameters[pos].type = FORMAT_POINTER; - break; - - case SPECIFIER_COUNT: - parameters[pos].type = FORMAT_COUNT; - break; - -#if defined(SPECIFIER_HEXFLOAT) -# if defined(SPECIFIER_HEXFLOAT_UPPER) - case SPECIFIER_HEXFLOAT_UPPER: - flags |= FLAGS_UPPER; - /* FALLTHROUGH */ -# endif - case SPECIFIER_HEXFLOAT: - base = BASE_HEX; - parameters[pos].type = FORMAT_DOUBLE; - break; -#endif - -#if defined(FORMAT_ERRNO) - case SPECIFIER_ERRNO: - parameters[pos].type = FORMAT_ERRNO; - break; -#endif - -#if defined(SPECIFIER_USER_DEFINED_BEGIN) - case SPECIFIER_USER_DEFINED_BEGIN: - { - unsigned int max; - int without_namespace = TRUE; - - parameters[pos].type = FORMAT_USER_DEFINED; - parameters[pos].user_name[0] = NIL; - tmpformat = (char *)&format[index]; - - while ((ch = format[index])) - { - index++; - if (ch == SPECIFIER_USER_DEFINED_END) - { - if (without_namespace) - { - /* We must get the handle first */ - parameters[pos].type = FORMAT_PARAMETER; - parameters[pos].indexAfterSpecifier = index; - parameters[pos].flags = FLAGS_USER_DEFINED; - /* Adjust parameters for insertion of new one */ - pos++; -# if TRIO_ERRORS - usedEntries[currentParam] += 1; -# endif - parameters[pos].type = FORMAT_USER_DEFINED; - currentParam++; - indices[currentParam] = pos; - if (currentParam > maxParam) - maxParam = currentParam; - } - /* Copy the user data */ - max = (unsigned int)(&format[index] - tmpformat); - if (max > MAX_USER_DATA) - max = MAX_USER_DATA; - StrCopyMax(parameters[pos].user_data, - max, - tmpformat); - break; /* while */ - } - if (ch == SPECIFIER_USER_DEFINED_SEPARATOR) - { - without_namespace = FALSE; - /* Copy the namespace for later looking-up */ - max = (int)(&format[index] - tmpformat); - if (max > MAX_USER_NAME) - max = MAX_USER_NAME; - StrCopyMax(parameters[pos].user_name, - max, - tmpformat); - tmpformat = (char *)&format[index]; - } - } - if (ch != SPECIFIER_USER_DEFINED_END) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - break; -#endif /* defined(SPECIFIER_USER_DEFINED_BEGIN) */ - - default: - /* Bail out completely to make the error more obvious */ - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - -#if TRIO_ERRORS - /* Count the number of times this entry has been used */ - usedEntries[currentParam] += 1; -#endif - - /* Find last sticky parameters */ - if (got_sticky && !(flags & FLAGS_STICKY)) - { - for (i = pos - 1; i >= 0; i--) - { - if (parameters[i].type == FORMAT_PARAMETER) - continue; - if ((parameters[i].flags & FLAGS_STICKY) && - (parameters[i].type == parameters[pos].type)) - { - /* Do not overwrite current qualifiers */ - flags |= (parameters[i].flags & (unsigned long)~FLAGS_STICKY); - if (width == NO_WIDTH) - width = parameters[i].width; - if (precision == NO_PRECISION) - precision = parameters[i].precision; - if (base == NO_BASE) - base = parameters[i].base; - break; - } - } - } - - parameters[pos].indexAfterSpecifier = index; - parameters[pos].flags = flags; - parameters[pos].width = width; - parameters[pos].precision = precision; - parameters[pos].base = (base == NO_BASE) ? BASE_DECIMAL : base; - parameters[pos].varsize = varsize; -#ifdef QUALIFIER_ESCAPE - parameters[pos].escape = escape; -#endif - pos++; - - if (! positional) - parameterPosition++; - - } /* if identifier */ - - } /* while format characters left */ - - for (num = 0; num <= maxParam; num++) - { -#if TRIO_ERRORS - if (usedEntries[num] != 1) - { - if (usedEntries[num] == 0) /* gap detected */ - return TRIO_ERROR_RETURN(TRIO_EGAP, num); - else /* double references detected */ - return TRIO_ERROR_RETURN(TRIO_EDBLREF, num); - } -#endif - - i = indices[num]; - - /* - * FORMAT_PARAMETERS are only present if they must be read, - * so it makes no sense to check the ignore flag (besides, - * the flags variable is not set for that particular type) - */ - if ((parameters[i].type != FORMAT_PARAMETER) && - (parameters[i].flags & FLAGS_IGNORE)) - continue; /* for all arguments */ - - /* - * The stack arguments are read according to ANSI C89 - * default argument promotions: - * - * char = int - * short = int - * unsigned char = unsigned int - * unsigned short = unsigned int - * float = double - * - * In addition to the ANSI C89 these types are read (the - * default argument promotions of C99 has not been - * considered yet) - * - * long long - * long double - * size_t - * ptrdiff_t - * intmax_t - */ - switch (parameters[i].type) - { - case FORMAT_GROUP: - case FORMAT_STRING: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - parameters[i].data.wstring = (argarray == NULL) - ? va_arg(arglist, wchar_t *) - : (wchar_t *)(argarray[num]); - } - else -#endif - { - parameters[i].data.string = (argarray == NULL) - ? va_arg(arglist, char *) - : (char *)(argarray[num]); - } - break; - - case FORMAT_POINTER: - case FORMAT_COUNT: - case FORMAT_USER_DEFINED: - case FORMAT_UNKNOWN: - parameters[i].data.pointer = (argarray == NULL) - ? va_arg(arglist, void *) - : argarray[num]; - break; - - case FORMAT_CHAR: - case FORMAT_INT: - if (TYPE_SCAN == type) - { - if (argarray == NULL) - parameters[i].data.pointer = - (trio_uintmax_t *)va_arg(arglist, void *); - else - { - if (parameters[i].type == FORMAT_CHAR) - parameters[i].data.pointer = - (trio_uintmax_t *)((char *)argarray[num]); - else if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.pointer = - (trio_uintmax_t *)((short *)argarray[num]); - else - parameters[i].data.pointer = - (trio_uintmax_t *)((int *)argarray[num]); - } - } - else - { -#if defined(QUALIFIER_VARSIZE) || defined(QUALIFIER_FIXED_SIZE) - if ((parameters[i].flags & FLAGS_VARSIZE_PARAMETER) || - (parameters[i].flags & FLAGS_FIXED_SIZE)) - { - if (parameters[i].flags & FLAGS_VARSIZE_PARAMETER) - { - /* - * Variable sizes are mapped onto the fixed sizes, in - * accordance with integer promotion. - * - * Please note that this may not be portable, as we - * only guess the size, not the layout of the numbers. - * For example, if int is little-endian, and long is - * big-endian, then this will fail. - */ - varsize = (int)parameters[parameters[i].varsize].data.number.as_unsigned; - } - else - { - /* Used for the I modifiers */ - varsize = parameters[i].varsize; - } - parameters[i].flags &= ~FLAGS_ALL_VARSIZES; - - if (varsize <= (int)sizeof(int)) - ; - else if (varsize <= (int)sizeof(long)) - parameters[i].flags |= FLAGS_LONG; -#if defined(QUALIFIER_INTMAX_T) - else if (varsize <= (int)sizeof(trio_longlong_t)) - parameters[i].flags |= FLAGS_QUAD; - else - parameters[i].flags |= FLAGS_INTMAX_T; -#else - else - parameters[i].flags |= FLAGS_QUAD; -#endif - } -#endif /* defined(QUALIFIER_VARSIZE) */ -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (parameters[i].flags & FLAGS_SIZE_T) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, size_t) - : (trio_uintmax_t)(*((size_t *)argarray[num])); - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (parameters[i].flags & FLAGS_PTRDIFF_T) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, ptrdiff_t) - : (trio_uintmax_t)(*((ptrdiff_t *)argarray[num])); - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (parameters[i].flags & FLAGS_INTMAX_T) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, trio_intmax_t) - : (trio_uintmax_t)(*((trio_intmax_t *)argarray[num])); - else -#endif - if (parameters[i].flags & FLAGS_QUAD) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, trio_ulonglong_t) - : (trio_uintmax_t)(*((trio_ulonglong_t *)argarray[num])); - else if (parameters[i].flags & FLAGS_LONG) - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, long) - : (trio_uintmax_t)(*((long *)argarray[num])); - else - { - if (argarray == NULL) - parameters[i].data.number.as_unsigned = (trio_uintmax_t)va_arg(arglist, int); - else - { - if (parameters[i].type == FORMAT_CHAR) - parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((char *)argarray[num])); - else if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((short *)argarray[num])); - else - parameters[i].data.number.as_unsigned = (trio_uintmax_t)(*((int *)argarray[num])); - } - } - } - break; - - case FORMAT_PARAMETER: - /* - * The parameter for the user-defined specifier is a pointer, - * whereas the rest (width, precision, base) uses an integer. - */ - if (parameters[i].flags & FLAGS_USER_DEFINED) - parameters[i].data.pointer = (argarray == NULL) - ? va_arg(arglist, void *) - : argarray[num]; - else - parameters[i].data.number.as_unsigned = (argarray == NULL) - ? (trio_uintmax_t)va_arg(arglist, int) - : (trio_uintmax_t)(*((int *)argarray[num])); - break; - - case FORMAT_DOUBLE: - if (TYPE_SCAN == type) - { - if (parameters[i].flags & FLAGS_LONG) - parameters[i].data.longdoublePointer = (argarray == NULL) - ? va_arg(arglist, long double *) - : (long double *)((long double *)argarray[num]); - else - { - if (argarray == NULL) - parameters[i].data.doublePointer = - va_arg(arglist, double *); - else - { - if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.doublePointer = - (double *)((float *)argarray[num]); - else - parameters[i].data.doublePointer = - (double *)((double *)argarray[num]); - } - } - } - else - { - if (parameters[i].flags & FLAGS_LONG) - parameters[i].data.longdoubleNumber = (argarray == NULL) - ? va_arg(arglist, long double) - : (long double)(*((long double *)argarray[num])); - else - { - if (argarray == NULL) - parameters[i].data.longdoubleNumber = (long double)va_arg(arglist, double); - else - { - if (parameters[i].flags & FLAGS_SHORT) - parameters[i].data.longdoubleNumber = (long double)(*((float *)argarray[num])); - else - parameters[i].data.longdoubleNumber = (long double)(long double)(*((double *)argarray[num])); - } - } - } - break; - -#if defined(FORMAT_ERRNO) - case FORMAT_ERRNO: - parameters[i].data.errorNumber = errno; - break; -#endif - - default: - break; - } - } /* for all specifiers */ - return num; -} - - -/************************************************************************* - * - * @FORMATTING - * - ************************************************************************/ - - -/************************************************************************* - * TrioWriteNumber [private] - * - * Description: - * Output a number. - * The complexity of this function is a result of the complexity - * of the dependencies of the flags. - */ -static void -TrioWriteNumber(trio_T *self, - trio_uintmax_t number, - unsigned long flags, - int width, - int precision, - int base) -{ - BOOLEAN_T isNegative; - char buffer[MAX_CHARS_IN(trio_uintmax_t) * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1]; - char *bufferend; - char *pointer; - const char *digits; - int i; - int length; - char *p; - int charsPerThousand; - int groupingIndex; - int count; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE)); - - digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower; - - isNegative = (flags & FLAGS_UNSIGNED) - ? FALSE - : ((trio_intmax_t)number < 0); - if (isNegative) - number = -number; - - if (flags & FLAGS_QUAD) - number &= (trio_ulonglong_t)-1; - else if (flags & FLAGS_LONG) - number &= (unsigned long)-1; - else - number &= (unsigned int)-1; - - /* Build number */ - pointer = bufferend = &buffer[sizeof(buffer) - 1]; - *pointer-- = NIL; - charsPerThousand = (int)internalGrouping[0]; - groupingIndex = 1; - for (i = 1; i < (int)sizeof(buffer); i++) - { - *pointer-- = digits[number % base]; - number /= base; - if (number == 0) - break; - - if ((flags & FLAGS_QUOTE) - && (charsPerThousand != NO_GROUPING) - && (i % charsPerThousand == 0)) - { - /* - * We are building the number from the least significant - * to the most significant digit, so we have to copy the - * thousand separator backwards - */ - length = StrLength(internalThousandSeparator); - if (((int)(pointer - buffer) - length) > 0) - { - p = &internalThousandSeparator[length - 1]; - while (length-- > 0) - *pointer-- = *p--; - } - - /* Advance to next grouping number */ - switch (internalGrouping[groupingIndex]) - { - case CHAR_MAX: /* Disable grouping */ - charsPerThousand = NO_GROUPING; - break; - case 0: /* Repeat last group */ - break; - default: - charsPerThousand = (int)internalGrouping[groupingIndex++]; - break; - } - } - } - - /* Adjust width */ - width -= (bufferend - pointer) - 1; - - /* Adjust precision */ - if (NO_PRECISION != precision) - { - precision -= (bufferend - pointer) - 1; - if (precision < 0) - precision = 0; - flags |= FLAGS_NILPADDING; - } - - /* Adjust width further */ - if (isNegative || (flags & FLAGS_SHOWSIGN) || (flags & FLAGS_SPACE)) - width--; - if (flags & FLAGS_ALTERNATIVE) - { - switch (base) - { - case BASE_BINARY: - case BASE_HEX: - width -= 2; - break; - case BASE_OCTAL: - width--; - break; - default: - break; - } - } - - /* Output prefixes spaces if needed */ - if (! ((flags & FLAGS_LEFTADJUST) || - ((flags & FLAGS_NILPADDING) && (precision == NO_PRECISION)))) - { - count = (precision == NO_PRECISION) ? 0 : precision; - while (width-- > count) - self->OutStream(self, CHAR_ADJUST); - } - - /* width has been adjusted for signs and alternatives */ - if (isNegative) - self->OutStream(self, '-'); - else if (flags & FLAGS_SHOWSIGN) - self->OutStream(self, '+'); - else if (flags & FLAGS_SPACE) - self->OutStream(self, ' '); - - if (flags & FLAGS_ALTERNATIVE) - { - switch (base) - { - case BASE_BINARY: - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'B' : 'b'); - break; - - case BASE_OCTAL: - self->OutStream(self, '0'); - break; - - case BASE_HEX: - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); - break; - - default: - break; - } /* switch base */ - } - - /* Output prefixed zero padding if needed */ - if (flags & FLAGS_NILPADDING) - { - if (precision == NO_PRECISION) - precision = width; - while (precision-- > 0) - { - self->OutStream(self, '0'); - width--; - } - } - - /* Output the number itself */ - while (*(++pointer)) - { - self->OutStream(self, *pointer); - } - - /* Output trailing spaces if needed */ - if (flags & FLAGS_LEFTADJUST) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } -} - -/************************************************************************* - * TrioWriteStringCharacter [private] - * - * Description: - * Output a single character of a string - */ -static void -TrioWriteStringCharacter(trio_T *self, - int ch, - unsigned long flags) -{ - if (flags & FLAGS_ALTERNATIVE) - { - if (! (isprint(ch) || isspace(ch))) - { - /* - * Non-printable characters are converted to C escapes or - * \number, if no C escape exists. - */ - self->OutStream(self, CHAR_BACKSLASH); - switch (ch) - { - case '\007': self->OutStream(self, 'a'); break; - case '\b': self->OutStream(self, 'b'); break; - case '\f': self->OutStream(self, 'f'); break; - case '\n': self->OutStream(self, 'n'); break; - case '\r': self->OutStream(self, 'r'); break; - case '\t': self->OutStream(self, 't'); break; - case '\v': self->OutStream(self, 'v'); break; - case '\\': self->OutStream(self, '\\'); break; - default: - self->OutStream(self, 'x'); - TrioWriteNumber(self, (trio_intmax_t)ch, - FLAGS_UNSIGNED | FLAGS_NILPADDING, - 2, 2, BASE_HEX); - break; - } - } - else if (ch == CHAR_BACKSLASH) - { - self->OutStream(self, CHAR_BACKSLASH); - self->OutStream(self, CHAR_BACKSLASH); - } - else - { - self->OutStream(self, ch); - } - } - else - { - self->OutStream(self, ch); - } -} - -/************************************************************************* - * TrioWriteString [private] - * - * Description: - * Output a string - */ -static void -TrioWriteString(trio_T *self, - const char *string, - unsigned long flags, - int width, - int precision) -{ - int length; - int ch; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - - if (string == NULL) - { - string = null; - length = sizeof(null) - 1; - /* Disable quoting for the null pointer */ - flags &= (~FLAGS_QUOTE); - width = 0; - } - else - { - length = StrLength(string); - } - if ((NO_PRECISION != precision) && - (precision < length)) - { - length = precision; - } - width -= length; - - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); - - if (! (flags & FLAGS_LEFTADJUST)) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - - while (length-- > 0) - { - /* The ctype parameters must be an unsigned char (or EOF) */ - ch = (int)((unsigned char)(*string++)); - TrioWriteStringCharacter(self, ch, flags); - } - - if (flags & FLAGS_LEFTADJUST) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); -} - -/************************************************************************* - * TrioWriteWideStringCharacter [private] - * - * Description: - * Output a wide string as a multi-byte sequence - */ -#if TRIO_WIDECHAR -static int -TrioWriteWideStringCharacter(trio_T *self, - wchar_t wch, - unsigned long flags, - int width) -{ - int size; - int i; - int ch; - char *string; - char buffer[MB_LEN_MAX + 1]; - - if (width == NO_WIDTH) - width = sizeof(buffer); - - size = wctomb(buffer, wch); - if ((size <= 0) || (size > width) || (buffer[0] == NIL)) - return 0; - - string = buffer; - i = size; - while ((width >= i) && (width-- > 0) && (i-- > 0)) - { - /* The ctype parameters must be an unsigned char (or EOF) */ - ch = (int)((unsigned char)(*string++)); - TrioWriteStringCharacter(self, ch, flags); - } - return size; -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioWriteString [private] - * - * Description: - * Output a wide character string as a multi-byte string - */ -#if TRIO_WIDECHAR -static void -TrioWriteWideString(trio_T *self, - const wchar_t *wstring, - unsigned long flags, - int width, - int precision) -{ - int length; - int size; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - if (wstring == NULL) - { - TrioWriteString(self, NULL, flags, width, precision); - return; - } - - if (NO_PRECISION == precision) - { - length = INT_MAX; - } - else - { - length = precision; - width -= length; - } - - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); - - if (! (flags & FLAGS_LEFTADJUST)) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - - while (length > 0) - { - size = TrioWriteWideStringCharacter(self, *wstring++, flags, length); - if (size == 0) - break; /* while */ - length -= size; - } - - if (flags & FLAGS_LEFTADJUST) - { - while (width-- > 0) - self->OutStream(self, CHAR_ADJUST); - } - if (flags & FLAGS_QUOTE) - self->OutStream(self, CHAR_QUOTE); -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioWriteDouble [private] - */ -static void -TrioWriteDouble(trio_T *self, - long double longdoubleNumber, - unsigned long flags, - int width, - int precision, - int base) -{ - int charsPerThousand; - int length; - double number; - double workNumber; - int integerDigits; - int fractionDigits; - int exponentDigits; - int expectedWidth; - int exponent; - unsigned int uExponent = 0; - double dblBase; - BOOLEAN_T isNegative; - BOOLEAN_T isExponentNegative = FALSE; - BOOLEAN_T isHex; - const char *digits; - char numberBuffer[MAX_MANTISSA_DIGITS - * (1 + MAX_LOCALE_SEPARATOR_LENGTH) + 1]; - char *numberPointer; - char exponentBuffer[MAX_EXPONENT_DIGITS + 1]; - char *exponentPointer = NULL; - int groupingIndex; - char *work; - int i; - BOOLEAN_T onlyzero; - int zeroes = 0; - - assert(VALID(self)); - assert(VALID(self->OutStream)); - assert(base == BASE_DECIMAL || base == BASE_HEX); - - number = (double)longdoubleNumber; - - /* Look for infinite numbers and non-a-number first */ - switch (TrioIsInfinite(number)) - { - case 1: - /* Positive infinity */ - TrioWriteString(self, - (flags & FLAGS_UPPER) - ? INFINITE_UPPER - : INFINITE_LOWER, - flags, width, precision); - return; - - case -1: - /* Negative infinity */ - TrioWriteString(self, - (flags & FLAGS_UPPER) - ? "-" INFINITE_UPPER - : "-" INFINITE_LOWER, - flags, width, precision); - return; - - default: - /* Finitude */ - break; - } - if (TrioIsNan(number)) - { - TrioWriteString(self, - (flags & FLAGS_UPPER) - ? NAN_UPPER - : NAN_LOWER, - flags, width, precision); - return; - } - - /* Normal numbers */ - digits = (flags & FLAGS_UPPER) ? internalDigitsUpper : internalDigitsLower; - isHex = (base == BASE_HEX); - dblBase = (double)base; - - if (precision == NO_PRECISION) - precision = FLT_DIG; - - isNegative = (number < 0.0); - if (isNegative) - number = -number; - - if ((flags & FLAGS_FLOAT_G) || isHex) - { - if (precision == 0) - precision = 1; - - if ((number < 1.0e-4) || (number > pow(10.0, (double)precision))) - { - /* Use scientific notation */ - flags |= FLAGS_FLOAT_E; - } - else if (number < 1.0) - { - /* - * Use normal notation. If the integer part of the number is - * zero, then adjust the precision to include leading fractional - * zeros. - */ - workNumber = fabs(guarded_log10(number)); - if (workNumber - floor(workNumber) < 0.001) - workNumber--; - zeroes = (int)floor(workNumber); - } - } - - if (flags & FLAGS_FLOAT_E) - { - /* Scale the number */ - workNumber = guarded_log10(number); - if (workNumber == -HUGE_VAL) - { - exponent = 0; - /* Undo setting */ - if (flags & FLAGS_FLOAT_G) - flags &= ~FLAGS_FLOAT_E; - } - else - { - exponent = (int)floor(workNumber); - number /= pow(10.0, (double)exponent); - isExponentNegative = (exponent < 0); - uExponent = (isExponentNegative) ? -exponent : exponent; - /* No thousand separators */ - flags &= ~FLAGS_QUOTE; - } - } - - /* - * Truncated number. - * - * precision is number of significant digits for FLOAT_G - * and number of fractional digits for others - */ - integerDigits = (floor(number) > DBL_EPSILON) - ? 1 + (int)guarded_log10(floor(number)) - : 1; - fractionDigits = ((flags & FLAGS_FLOAT_G) && (zeroes == 0)) - ? precision - integerDigits - : zeroes + precision; - - number = floor(0.5 + number * pow(dblBase, (double)fractionDigits)); - workNumber = (isHex - ? guarded_log16(0.5 + number) - : guarded_log10(0.5 + number)); - if ((int)workNumber + 1 > integerDigits + fractionDigits) - { - if (flags & FLAGS_FLOAT_E) - { - /* Adjust if number was rounded up one digit (ie. 0.99 to 1.00) */ - exponent--; - uExponent -= (isExponentNegative) ? 1 : -1; - number /= dblBase; - } - else - { - /* Adjust if number was rounded up one digit (ie. 99 to 100) */ - integerDigits++; - } - } - - /* Build the fraction part */ - numberPointer = &numberBuffer[sizeof(numberBuffer) - 1]; - *numberPointer = NIL; - onlyzero = TRUE; - for (i = 0; i < fractionDigits; i++) - { - *(--numberPointer) = digits[(int)fmod(number, dblBase)]; - number = floor(number / dblBase); - - if ((flags & FLAGS_FLOAT_G) && !(flags & FLAGS_ALTERNATIVE)) - { - /* Prune trailing zeroes */ - if (numberPointer[0] != digits[0]) - onlyzero = FALSE; - else if (onlyzero && (numberPointer[0] == digits[0])) - numberPointer++; - } - else - onlyzero = FALSE; - } - - /* Insert decimal point */ - if ((flags & FLAGS_ALTERNATIVE) || ((fractionDigits > 0) && !onlyzero)) - { - i = StrLength(internalDecimalPoint); - while (i> 0) - { - *(--numberPointer) = internalDecimalPoint[--i]; - } - } - /* Insert the integer part and thousand separators */ - charsPerThousand = (int)internalGrouping[0]; - groupingIndex = 1; - for (i = 1; i < integerDigits + 1; i++) - { - *(--numberPointer) = digits[(int)fmod(number, dblBase)]; - number = floor(number / dblBase); - if (number < DBL_EPSILON) - break; - - if ((i > 0) - && ((flags & (FLAGS_FLOAT_E | FLAGS_QUOTE)) == FLAGS_QUOTE) - && (charsPerThousand != NO_GROUPING) - && (i % charsPerThousand == 0)) - { - /* - * We are building the number from the least significant - * to the most significant digit, so we have to copy the - * thousand separator backwards - */ - length = StrLength(internalThousandSeparator); - integerDigits += length; - if (((int)(numberPointer - numberBuffer) - length) > 0) - { - work = &internalThousandSeparator[length - 1]; - while (length-- > 0) - *(--numberPointer) = *work--; - } - - /* Advance to next grouping number */ - if (charsPerThousand != NO_GROUPING) - { - switch (internalGrouping[groupingIndex]) - { - case CHAR_MAX: /* Disable grouping */ - charsPerThousand = NO_GROUPING; - break; - case 0: /* Repeat last group */ - break; - default: - charsPerThousand = (int)internalGrouping[groupingIndex++]; - break; - } - } - } - } - - /* Build the exponent */ - exponentDigits = 0; - if (flags & FLAGS_FLOAT_E) - { - exponentPointer = &exponentBuffer[sizeof(exponentBuffer) - 1]; - *exponentPointer-- = NIL; - do { - *exponentPointer-- = digits[uExponent % base]; - uExponent /= base; - exponentDigits++; - } while (uExponent); - } - - /* - * Calculate expected width. - * sign + integer part + thousands separators + decimal point - * + fraction + exponent - */ - expectedWidth = StrLength(numberPointer); - if (isNegative || (flags & FLAGS_SHOWSIGN)) - expectedWidth += sizeof("-") - 1; - if (exponentDigits > 0) - expectedWidth += exponentDigits + - ((exponentDigits > 1) ? sizeof("E+") : sizeof("E+0")) - 1; - if (isHex) - expectedWidth += sizeof("0X") - 1; - - /* Output prefixing */ - if (flags & FLAGS_NILPADDING) - { - /* Leading zeros must be after sign */ - if (isNegative) - self->OutStream(self, '-'); - else if (flags & FLAGS_SHOWSIGN) - self->OutStream(self, '+'); - if (isHex) - { - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); - } - if (!(flags & FLAGS_LEFTADJUST)) - { - for (i = expectedWidth; i < width; i++) - { - self->OutStream(self, '0'); - } - } - } - else - { - /* Leading spaces must be before sign */ - if (!(flags & FLAGS_LEFTADJUST)) - { - for (i = expectedWidth; i < width; i++) - { - self->OutStream(self, CHAR_ADJUST); - } - } - if (isNegative) - self->OutStream(self, '-'); - else if (flags & FLAGS_SHOWSIGN) - self->OutStream(self, '+'); - if (isHex) - { - self->OutStream(self, '0'); - self->OutStream(self, (flags & FLAGS_UPPER) ? 'X' : 'x'); - } - } - /* Output number */ - for (i = 0; numberPointer[i]; i++) - { - self->OutStream(self, numberPointer[i]); - } - /* Output exponent */ - if (exponentDigits > 0) - { - self->OutStream(self, - isHex - ? ((flags & FLAGS_UPPER) ? 'P' : 'p') - : ((flags & FLAGS_UPPER) ? 'E' : 'e')); - self->OutStream(self, (isExponentNegative) ? '-' : '+'); - - /* The exponent must contain at least two digits */ - if (exponentDigits == 1) - self->OutStream(self, '0'); - - for (i = 0; i < exponentDigits; i++) - { - self->OutStream(self, exponentPointer[i + 1]); - } - } - /* Output trailing spaces */ - if (flags & FLAGS_LEFTADJUST) - { - for (i = expectedWidth; i < width; i++) - { - self->OutStream(self, CHAR_ADJUST); - } - } -} - -/************************************************************************* - * TrioFormatProcess [private] - */ -static int -TrioFormatProcess(trio_T *data, - const char *format, - parameter_T *parameters) - -{ -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int charlen; -#endif - int i; - const char *string; - void *pointer; - unsigned long flags; - int width; - int precision; - int base; - int index; - - index = 0; - i = 0; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - while (format[index]) - { -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - if (! isascii(format[index])) - { - charlen = mblen(&format[index], MB_LEN_MAX); - while (charlen-- > 0) - { - data->OutStream(data, format[index++]); - } - continue; /* while */ - } -#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - if (CHAR_IDENTIFIER == format[index]) - { - if (CHAR_IDENTIFIER == format[index + 1]) - { - data->OutStream(data, CHAR_IDENTIFIER); - index += 2; - } - else - { - /* Skip the parameter entries */ - while (parameters[i].type == FORMAT_PARAMETER) - i++; - - flags = parameters[i].flags; - - /* Find width */ - width = parameters[i].width; - if (flags & FLAGS_WIDTH_PARAMETER) - { - /* Get width from parameter list */ - width = (int)parameters[width].data.number.as_signed; - } - - /* Find precision */ - if (flags & FLAGS_PRECISION) - { - precision = parameters[i].precision; - if (flags & FLAGS_PRECISION_PARAMETER) - { - /* Get precision from parameter list */ - precision = (int)parameters[precision].data.number.as_signed; - } - } - else - { - precision = NO_PRECISION; - } - - /* Find base */ - base = parameters[i].base; - if (flags & FLAGS_BASE_PARAMETER) - { - /* Get base from parameter list */ - base = (int)parameters[base].data.number.as_signed; - } - - switch (parameters[i].type) - { - case FORMAT_CHAR: - if (flags & FLAGS_QUOTE) - data->OutStream(data, CHAR_QUOTE); - if (! (flags & FLAGS_LEFTADJUST)) - { - while (--width > 0) - data->OutStream(data, CHAR_ADJUST); - } -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - TrioWriteWideStringCharacter(data, - (wchar_t)parameters[i].data.number.as_signed, - flags, - NO_WIDTH); - } - else -#endif - TrioWriteStringCharacter(data, - (int)parameters[i].data.number.as_signed, - flags); - - if (flags & FLAGS_LEFTADJUST) - { - while(--width > 0) - data->OutStream(data, CHAR_ADJUST); - } - if (flags & FLAGS_QUOTE) - data->OutStream(data, CHAR_QUOTE); - - break; /* FORMAT_CHAR */ - - case FORMAT_INT: - if (base == NO_BASE) - base = BASE_DECIMAL; - - TrioWriteNumber(data, - parameters[i].data.number.as_signed, - flags, - width, - precision, - base); - - break; /* FORMAT_INT */ - - case FORMAT_DOUBLE: - TrioWriteDouble(data, - parameters[i].data.longdoubleNumber, - flags, - width, - precision, - base); - break; /* FORMAT_DOUBLE */ - - case FORMAT_STRING: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - TrioWriteWideString(data, - parameters[i].data.wstring, - flags, - width, - precision); - } - else -#endif -#ifdef QUALIFIER_ESCAPE - { - char *s = NULL; - static const char* empty = "(null)"; - switch (parameters[i].escape) - { - case ESCAPE_ULM: - s = glite_lbu_EscapeULM(parameters[i].data.string); - break; - case ESCAPE_XML: - s = glite_lbu_EscapeXML(parameters[i].data.string); - break; - case ESCAPE_SQL: - s = glite_lbu_EscapeSQL(parameters[i].data.string); - break; - case ESCAPE_NONE: - s = strdup(parameters[i].data.string ? parameters[i].data.string : empty); - break; - } - TrioWriteString(data,s,flags,width,precision); - free(s); - } -#else - { - TrioWriteString(data, - parameters[i].data.string, - flags, - width, - precision); - } -#endif - break; /* FORMAT_STRING */ - - case FORMAT_POINTER: - { - reference_T reference; - - reference.data = data; - reference.parameter = ¶meters[i]; - trio_print_pointer(&reference, parameters[i].data.pointer); - } - break; /* FORMAT_POINTER */ - - case FORMAT_COUNT: - pointer = parameters[i].data.pointer; - if (NULL != pointer) - { - /* - * C99 paragraph 7.19.6.1.8 says "the number of - * characters written to the output stream so far by - * this call", which is data->committed - */ -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (flags & FLAGS_SIZE_T) - *(size_t *)pointer = (size_t)data->committed; - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (flags & FLAGS_PTRDIFF_T) - *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed; - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (flags & FLAGS_INTMAX_T) - *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed; - else -#endif - if (flags & FLAGS_QUAD) - { - *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed; - } - else if (flags & FLAGS_LONG) - { - *(long int *)pointer = (long int)data->committed; - } - else if (flags & FLAGS_SHORT) - { - *(short int *)pointer = (short int)data->committed; - } - else - { - *(int *)pointer = (int)data->committed; - } - } - break; /* FORMAT_COUNT */ - - case FORMAT_PARAMETER: - break; /* FORMAT_PARAMETER */ - -#if defined(FORMAT_ERRNO) - case FORMAT_ERRNO: - string = StrError(parameters[i].data.errorNumber); - if (string) - { - TrioWriteString(data, - string, - flags, - width, - precision); - } - else - { - data->OutStream(data, '#'); - TrioWriteNumber(data, - (trio_intmax_t)parameters[i].data.errorNumber, - flags, - width, - precision, - BASE_DECIMAL); - } - break; /* FORMAT_ERRNO */ -#endif /* defined(FORMAT_ERRNO) */ - -#if defined(FORMAT_USER_DEFINED) - case FORMAT_USER_DEFINED: - { - reference_T reference; - userdef_T *def = NULL; - - if (parameters[i].user_name[0] == NIL) - { - /* Use handle */ - if ((i > 0) || - (parameters[i - 1].type == FORMAT_PARAMETER)) - def = (userdef_T *)parameters[i - 1].data.pointer; - } - else - { - /* Look up namespace */ - def = TrioFindNamespace(parameters[i].user_name, NULL); - } - if (def) { - reference.data = data; - reference.parameter = ¶meters[i]; - def->callback(&reference); - } - } - break; -#endif /* defined(FORMAT_USER_DEFINED) */ - - default: - break; - } /* switch parameter type */ - - /* Prepare for next */ - index = parameters[i].indexAfterSpecifier; - i++; - } - } - else /* not identifier */ - { - data->OutStream(data, format[index++]); - } - } - return data->processed; -} - -/************************************************************************* - * TrioFormatRef [private] - */ -static int -TrioFormatRef(reference_T *reference, - const char *format, - va_list arglist, - void **argarray) -{ - int status; - parameter_T parameters[MAX_PARAMETERS]; - - status = TrioPreprocess(TYPE_PRINT, format, parameters, arglist, argarray); - if (status < 0) - return status; - - return TrioFormatProcess(reference->data, format, parameters); -} - -/************************************************************************* - * TrioFormat [private] - * - * Description: - * This is the main engine for formatting output - */ -static int -TrioFormat(void *destination, - size_t destinationSize, - void (*OutStream)(trio_T *, int), - const char *format, - va_list arglist, - void **argarray) -{ - int status; - trio_T data; - parameter_T parameters[MAX_PARAMETERS]; - - assert(VALID(OutStream)); - assert(VALID(format)); - - memset(&data, 0, sizeof(data)); - data.OutStream = OutStream; - data.location = destination; - data.max = destinationSize; - -#if defined(USE_LOCALE) - if (NULL == internalLocaleValues) - { - TrioSetLocale(); - } -#endif - - status = TrioPreprocess(TYPE_PRINT, format, parameters, arglist, argarray); - if (status < 0) - return status; - - return TrioFormatProcess(&data, format, parameters); -} - -/************************************************************************* - * TrioOutStreamFile [private] - */ -static void -TrioOutStreamFile(trio_T *self, - int output) -{ - FILE *file = (FILE *)self->location; - - assert(VALID(self)); - assert(VALID(file)); - - self->processed++; - self->committed++; - (void)fputc(output, file); -} - -/************************************************************************* - * TrioOutStreamFileDescriptor [private] - */ -static void -TrioOutStreamFileDescriptor(trio_T *self, - int output) -{ - int fd = *((int *)self->location); - char ch; - - assert(VALID(self)); - - ch = (char)output; - (void)write(fd, &ch, sizeof(char)); - self->processed++; - self->committed++; -} - -/************************************************************************* - * TrioOutStreamString [private] - */ -static void -TrioOutStreamString(trio_T *self, - int output) -{ - char **buffer = (char **)self->location; - - assert(VALID(self)); - assert(VALID(buffer)); - - **buffer = (char)output; - (*buffer)++; - self->processed++; - self->committed++; -} - -/************************************************************************* - * TrioOutStreamStringMax [private] - */ -static void -TrioOutStreamStringMax(trio_T *self, - int output) -{ - char **buffer; - - assert(VALID(self)); - buffer = (char **)self->location; - assert(VALID(buffer)); - - if (self->processed < self->max) - { - **buffer = (char)output; - (*buffer)++; - self->committed++; - } - self->processed++; -} - -/************************************************************************* - * TrioOutStreamStringDynamic [private] - */ -#define DYNAMIC_START_SIZE 32 -struct dynamicBuffer { - char *buffer; - size_t length; - size_t allocated; -}; - -static void -TrioOutStreamStringDynamic(trio_T *self, - int output) -{ - struct dynamicBuffer *infop; - - assert(VALID(self)); - assert(VALID(self->location)); - - infop = (struct dynamicBuffer *)self->location; - - if (infop->buffer == NULL) - { - /* Start with a reasonable size */ - infop->buffer = (char *)TRIO_MALLOC(DYNAMIC_START_SIZE); - if (infop->buffer == NULL) - return; /* fail */ - - infop->allocated = DYNAMIC_START_SIZE; - self->processed = 0; - self->committed = 0; - } - else if (self->committed + sizeof(NIL) >= infop->allocated) - { - char *newptr; - - /* Allocate increasing chunks */ - newptr = (char *)TRIO_REALLOC(infop->buffer, infop->allocated * 2); - - if (newptr == NULL) - return; - - infop->buffer = newptr; - infop->allocated *= 2; - } - - infop->buffer[self->committed] = (char)output; - self->committed++; - self->processed++; - - infop->length = self->committed; -} - -/************************************************************************* - * printf - */ -int -trio_printf(const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(stdout, 0, TrioOutStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vprintf(const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioFormat(stdout, 0, TrioOutStreamFile, format, args, NULL); -} - -#ifdef __GNUC__ -#define UNUSED_VAR __attribute__((unused)) -#else -#define UNUSED_VAR -#endif - -static void shutup_unitialized(va_list *dummy UNUSED_VAR) { -} - -int -trio_printfv(const char *format, - void ** args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioFormat(stdout, 0, TrioOutStreamFile, format, dummy, args); -} - -/************************************************************************* - * fprintf - */ -int -trio_fprintf(FILE *file, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(file)); - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(file, 0, TrioOutStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vfprintf(FILE *file, - const char *format, - va_list args) -{ - assert(VALID(file)); - assert(VALID(format)); - - return TrioFormat(file, 0, TrioOutStreamFile, format, args, NULL); -} - -int -trio_fprintfv(FILE *file, - const char *format, - void ** args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(file)); - assert(VALID(format)); - - return TrioFormat(file, 0, TrioOutStreamFile, format, dummy, args); -} - -/************************************************************************* - * dprintf - */ -int -trio_dprintf(int fd, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vdprintf(int fd, - const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, args, NULL); -} - -int -trio_dprintfv(int fd, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioFormat(&fd, 0, TrioOutStreamFileDescriptor, format, dummy, args); -} - -/************************************************************************* - * sprintf - */ -int -trio_sprintf(char *buffer, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(buffer)); - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(&buffer, 0, TrioOutStreamString, format, args, NULL); - *buffer = NIL; /* Terminate with NIL character */ - va_end(args); - return status; -} - -int -trio_vsprintf(char *buffer, - const char *format, - va_list args) -{ - int status; - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, 0, TrioOutStreamString, format, args, NULL); - *buffer = NIL; - return status; -} - -int -trio_sprintfv(char *buffer, - const char *format, - void **args) -{ - int status; - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, 0, TrioOutStreamString, format, dummy, args); - *buffer = NIL; - return status; -} - -/************************************************************************* - * snprintf - */ -int -trio_snprintf(char *buffer, - size_t bufferSize, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(buffer)); - assert(VALID(format)); - - va_start(args, format); - status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0, - TrioOutStreamStringMax, format, args, NULL); - if (bufferSize > 0) - *buffer = NIL; - va_end(args); - return status; -} - -int -trio_vsnprintf(char *buffer, - size_t bufferSize, - const char *format, - va_list args) -{ - int status; - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0, - TrioOutStreamStringMax, format, args, NULL); - if (bufferSize > 0) - *buffer = NIL; - return status; -} - -int -trio_snprintfv(char *buffer, - size_t bufferSize, - const char *format, - void **args) -{ - int status; - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(buffer)); - assert(VALID(format)); - - status = TrioFormat(&buffer, bufferSize > 0 ? bufferSize - 1 : 0, - TrioOutStreamStringMax, format, dummy, args); - if (bufferSize > 0) - *buffer = NIL; - return status; -} - -/************************************************************************* - * snprintfcat - * Appends the new string to the buffer string overwriting the '\0' - * character at the end of buffer. - */ -int -trio_snprintfcat(char *buffer, - size_t bufferSize, - const char *format, - ...) -{ - int status; - va_list args; - size_t buf_len; - - va_start(args, format); - - assert(VALID(buffer)); - assert(VALID(format)); - - buf_len = strlen(buffer); - buffer = &buffer[buf_len]; - - status = TrioFormat(&buffer, bufferSize - 1 - buf_len, - TrioOutStreamStringMax, format, args, NULL); - va_end(args); - *buffer = NIL; - return status; -} - -int -trio_vsnprintfcat(char *buffer, - size_t bufferSize, - const char *format, - va_list args) -{ - int status; - size_t buf_len; - assert(VALID(buffer)); - assert(VALID(format)); - - buf_len = strlen(buffer); - buffer = &buffer[buf_len]; - status = TrioFormat(&buffer, bufferSize - 1 - buf_len, - TrioOutStreamStringMax, format, args, NULL); - *buffer = NIL; - return status; -} - -/************************************************************************* - * trio_aprintf - */ - -/* Deprecated */ -char * -trio_aprintf(const char *format, - ...) -{ - va_list args; - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - va_start(args, format); - (void)TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - va_end(args); - if (info.length) { - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - return info.buffer; - } - else - return NULL; -} - -/* Deprecated */ -char * -trio_vaprintf(const char *format, - va_list args) -{ - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - (void)TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - if (info.length) { - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - return info.buffer; - } - else - return NULL; -} - -int -trio_asprintf(char **result, - const char *format, - ...) -{ - va_list args; - int status; - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - va_start(args, format); - status = TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - va_end(args); - if (status < 0) { - *result = NULL; - return status; - } - if (info.length == 0) { - /* - * If the length is zero, no characters have been written and therefore - * no memory has been allocated, but we must to allocate and return an - * empty string. - */ - info.buffer = (char *)TRIO_MALLOC(sizeof(char)); - if (info.buffer == NULL) { - *result = NULL; - return TRIO_ERROR_RETURN(TRIO_ENOMEM, 0); - } - } - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - *result = info.buffer; - - return status; -} - -int -trio_vasprintf(char **result, - const char *format, - va_list args) -{ - int status; - struct dynamicBuffer info; - - assert(VALID(format)); - - info.buffer = NULL; - info.length = 0; - info.allocated = 0; - - status = TrioFormat(&info, 0, TrioOutStreamStringDynamic, format, args, NULL); - if (status < 0) { - *result = NULL; - return status; - } - if (info.length == 0) { - info.buffer = (char *)TRIO_MALLOC(sizeof(char)); - if (info.buffer == NULL) { - *result = NULL; - return TRIO_ERROR_RETURN(TRIO_ENOMEM, 0); - } - } - info.buffer[info.length] = NIL; /* we terminate this with a zero byte */ - *result = info.buffer; - - return status; -} - - -/************************************************************************* - * - * @CALLBACK - * - ************************************************************************/ - - -/************************************************************************* - * trio_register [public] - */ -void * -trio_register(trio_callback_t callback, - const char *name) -{ - userdef_T *def; - userdef_T *prev = NULL; - - if (callback == NULL) - return NULL; - - if (name) - { - /* Handle built-in namespaces */ - if (name[0] == ':') - { - if (StrEqual(name, ":enter")) - { - internalEnterCriticalRegion = callback; - } - else if (StrEqual(name, ":leave")) - { - internalLeaveCriticalRegion = callback; - } - return NULL; - } - - /* Bail out if namespace is too long */ - if (StrLength(name) >= MAX_USER_NAME) - return NULL; - - /* Bail out if namespace already is registered */ - def = TrioFindNamespace(name, &prev); - if (def) - return NULL; - } - - def = (userdef_T *)TRIO_MALLOC(sizeof(userdef_T)); - if (def) - { - if (internalEnterCriticalRegion) - (void)internalEnterCriticalRegion(NULL); - - if (name) - { - /* Link into internal list */ - if (prev == NULL) - internalUserDef = def; - else - prev->next = def; - } - /* Initialize */ - def->callback = callback; - def->name = (name == NULL) - ? NULL - : StrDuplicate(name); - def->next = NULL; - - if (internalLeaveCriticalRegion) - (void)internalLeaveCriticalRegion(NULL); - } - return def; -} - -/************************************************************************* - * trio_unregister [public] - */ -void -trio_unregister(void *handle) -{ - userdef_T *self = (userdef_T *)handle; - userdef_T *def; - userdef_T *prev = NULL; - - assert(VALID(self)); - - if (self->name) - { - def = TrioFindNamespace(self->name, &prev); - if (def) - { - if (internalEnterCriticalRegion) - (void)internalEnterCriticalRegion(NULL); - - if (prev == NULL) - internalUserDef = NULL; - else - prev->next = def->next; - - if (internalLeaveCriticalRegion) - (void)internalLeaveCriticalRegion(NULL); - } - StrFree(self->name); - } - TRIO_FREE(self); -} - -/************************************************************************* - * trio_get_format [public] - */ -const char * -trio_get_format(void *ref) -{ - assert(((reference_T *)ref)->parameter->type == FORMAT_USER_DEFINED); - - return (((reference_T *)ref)->parameter->user_data); -} - -/************************************************************************* - * trio_get_argument [public] - */ -void * -trio_get_argument(void *ref) -{ - assert(((reference_T *)ref)->parameter->type == FORMAT_USER_DEFINED); - - return ((reference_T *)ref)->parameter->data.pointer; -} - -/************************************************************************* - * trio_get_width / trio_set_width [public] - */ -int -trio_get_width(void *ref) -{ - return ((reference_T *)ref)->parameter->width; -} - -void -trio_set_width(void *ref, - int width) -{ - ((reference_T *)ref)->parameter->width = width; -} - -/************************************************************************* - * trio_get_precision / trio_set_precision [public] - */ -int -trio_get_precision(void *ref) -{ - return (((reference_T *)ref)->parameter->precision); -} - -void -trio_set_precision(void *ref, - int precision) -{ - ((reference_T *)ref)->parameter->precision = precision; -} - -/************************************************************************* - * trio_get_base / trio_set_base [public] - */ -int -trio_get_base(void *ref) -{ - return (((reference_T *)ref)->parameter->base); -} - -void -trio_set_base(void *ref, - int base) -{ - ((reference_T *)ref)->parameter->base = base; -} - -/************************************************************************* - * trio_get_long / trio_set_long [public] - */ -int -trio_get_long(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_LONG); -} - -void -trio_set_long(void *ref, - int is_long) -{ - if (is_long) - ((reference_T *)ref)->parameter->flags |= FLAGS_LONG; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_LONG; -} - -/************************************************************************* - * trio_get_longlong / trio_set_longlong [public] - */ -int -trio_get_longlong(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_QUAD); -} - -void -trio_set_longlong(void *ref, - int is_longlong) -{ - if (is_longlong) - ((reference_T *)ref)->parameter->flags |= FLAGS_QUAD; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_QUAD; -} - -/************************************************************************* - * trio_get_longdouble / trio_set_longdouble [public] - */ -int -trio_get_longdouble(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_LONGDOUBLE); -} - -void -trio_set_longdouble(void *ref, - int is_longdouble) -{ - if (is_longdouble) - ((reference_T *)ref)->parameter->flags |= FLAGS_LONGDOUBLE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_LONGDOUBLE; -} - -/************************************************************************* - * trio_get_short / trio_set_short [public] - */ -int -trio_get_short(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SHORT); -} - -void -trio_set_short(void *ref, - int is_short) -{ - if (is_short) - ((reference_T *)ref)->parameter->flags |= FLAGS_SHORT; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHORT; -} - -/************************************************************************* - * trio_get_shortshort / trio_set_shortshort [public] - */ -int -trio_get_shortshort(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SHORTSHORT); -} - -void -trio_set_shortshort(void *ref, - int is_shortshort) -{ - if (is_shortshort) - ((reference_T *)ref)->parameter->flags |= FLAGS_SHORTSHORT; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHORTSHORT; -} - -/************************************************************************* - * trio_get_alternative / trio_set_alternative [public] - */ -int -trio_get_alternative(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_ALTERNATIVE); -} - -void -trio_set_alternative(void *ref, - int is_alternative) -{ - if (is_alternative) - ((reference_T *)ref)->parameter->flags |= FLAGS_ALTERNATIVE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_ALTERNATIVE; -} - -/************************************************************************* - * trio_get_alignment / trio_set_alignment [public] - */ -int -trio_get_alignment(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_LEFTADJUST); -} - -void -trio_set_alignment(void *ref, - int is_leftaligned) -{ - if (is_leftaligned) - ((reference_T *)ref)->parameter->flags |= FLAGS_LEFTADJUST; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_LEFTADJUST; -} - -/************************************************************************* - * trio_get_spacing /trio_set_spacing [public] - */ -int -trio_get_spacing(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SPACE); -} - -void -trio_set_spacing(void *ref, - int is_space) -{ - if (is_space) - ((reference_T *)ref)->parameter->flags |= FLAGS_SPACE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SPACE; -} - -/************************************************************************* - * trio_get_sign / trio_set_sign [public] - */ -int -trio_get_sign(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SHOWSIGN); -} - -void -trio_set_sign(void *ref, - int is_sign) -{ - if (is_sign) - ((reference_T *)ref)->parameter->flags |= FLAGS_SHOWSIGN; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SHOWSIGN; -} - -/************************************************************************* - * trio_get_padding / trio_set_padding [public] - */ -int -trio_get_padding(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_NILPADDING); -} - -void -trio_set_padding(void *ref, - int is_padding) -{ - if (is_padding) - ((reference_T *)ref)->parameter->flags |= FLAGS_NILPADDING; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_NILPADDING; -} - -/************************************************************************* - * trio_get_quote / trio_set_quote [public] - */ -int -trio_get_quote(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_QUOTE); -} - -void -trio_set_quote(void *ref, - int is_quote) -{ - if (is_quote) - ((reference_T *)ref)->parameter->flags |= FLAGS_QUOTE; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_QUOTE; -} - -/************************************************************************* - * trio_get_upper / trio_set_upper [public] - */ -int -trio_get_upper(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_UPPER); -} - -void -trio_set_upper(void *ref, - int is_upper) -{ - if (is_upper) - ((reference_T *)ref)->parameter->flags |= FLAGS_UPPER; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_UPPER; -} - -/************************************************************************* - * trio_get_largest / trio_set_largest [public] - */ -#if TRIO_C99 -int -trio_get_largest(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_INTMAX_T); -} - -void -trio_set_largest(void *ref, - int is_largest) -{ - if (is_largest) - ((reference_T *)ref)->parameter->flags |= FLAGS_INTMAX_T; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_INTMAX_T; -} -#endif - -/************************************************************************* - * trio_get_ptrdiff / trio_set_ptrdiff [public] - */ -int -trio_get_ptrdiff(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_PTRDIFF_T); -} - -void -trio_set_ptrdiff(void *ref, - int is_ptrdiff) -{ - if (is_ptrdiff) - ((reference_T *)ref)->parameter->flags |= FLAGS_PTRDIFF_T; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_PTRDIFF_T; -} - -/************************************************************************* - * trio_get_size / trio_set_size [public] - */ -#if TRIO_C99 -int -trio_get_size(void *ref) -{ - return (((reference_T *)ref)->parameter->flags & FLAGS_SIZE_T); -} - -void -trio_set_size(void *ref, - int is_size) -{ - if (is_size) - ((reference_T *)ref)->parameter->flags |= FLAGS_SIZE_T; - else - ((reference_T *)ref)->parameter->flags &= ~FLAGS_SIZE_T; -} -#endif - -/************************************************************************* - * trio_print_int [public] - */ -void -trio_print_int(void *ref, - int number) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteNumber(self->data, - (trio_intmax_t)number, - self->parameter->flags, - self->parameter->width, - self->parameter->precision, - self->parameter->base); -} - -/************************************************************************* - * trio_print_uint [public] - */ -void -trio_print_uint(void *ref, - unsigned int number) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteNumber(self->data, - (trio_intmax_t)number, - self->parameter->flags | FLAGS_UNSIGNED, - self->parameter->width, - self->parameter->precision, - self->parameter->base); -} - -/************************************************************************* - * trio_print_double [public] - */ -void -trio_print_double(void *ref, - double number) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteDouble(self->data, - number, - self->parameter->flags, - self->parameter->width, - self->parameter->precision, - self->parameter->base); -} - -/************************************************************************* - * trio_print_string [public] - */ -void -trio_print_string(void *ref, - char *string) -{ - reference_T *self = (reference_T *)ref; - - TrioWriteString(self->data, - string, - self->parameter->flags, - self->parameter->width, - self->parameter->precision); -} - -/************************************************************************* - * trio_print_pointer [public] - */ -void -trio_print_pointer(void *ref, - void *pointer) -{ - reference_T *self = (reference_T *)ref; - unsigned long flags; - trio_uintmax_t number; - - if (NULL == pointer) - { - const char *string = null; - while (*string) - self->data->OutStream(self->data, *string++); - } - else - { - /* - * The subtraction of the null pointer is a workaround - * to avoid a compiler warning. The performance overhead - * is negligible (and likely to be removed by an - * optimising compiler). The (char *) casting is done - * to please ANSI C++. - */ - number = (trio_uintmax_t)((char *)pointer - (char *)0); - /* Shrink to size of pointer */ - number &= (trio_uintmax_t)-1; - flags = self->parameter->flags; - flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | - FLAGS_NILPADDING); - TrioWriteNumber(self->data, - (trio_intmax_t)number, - flags, - POINTER_WIDTH, - NO_PRECISION, - BASE_HEX); - } -} - -/************************************************************************* - * trio_print_ref [public] - */ -int -trio_print_ref(void *ref, - const char *format, - ...) -{ - int status; - va_list arglist; - - assert(VALID(format)); - - va_start(arglist, format); - status = TrioFormatRef((reference_T *)ref, format, arglist, NULL); - va_end(arglist); - return status; -} - -/************************************************************************* - * trio_vprint_ref [public] - */ -int -trio_vprint_ref(void *ref, - const char *format, - va_list arglist) -{ - assert(VALID(format)); - - return TrioFormatRef((reference_T *)ref, format, arglist, NULL); -} - -/************************************************************************* - * trio_printv_ref [public] - */ -int -trio_printv_ref(void *ref, - const char *format, - void **argarray) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioFormatRef((reference_T *)ref, format, dummy, argarray); -} - - -/************************************************************************* - * - * @SCANNING - * - ************************************************************************/ - - -/************************************************************************* - * TrioSkipWhitespaces [private] - */ -static int -TrioSkipWhitespaces(trio_T *self) -{ - int ch; - - ch = self->current; - while (isspace(ch)) - { - self->InStream(self, &ch); - } - return ch; -} - -/************************************************************************* - * TrioGetCollation [private] - */ -#if TRIO_EXTENSION -static void -TrioGetCollation() -{ - int i; - int j; - int k; - char first[2]; - char second[2]; - - /* This is computational expensive */ - first[1] = NIL; - second[1] = NIL; - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - { - k = 0; - first[0] = (char)i; - for (j = 0; j < MAX_CHARACTER_CLASS; j++) - { - second[0] = (char)j; - if (StrEqualLocale(first, second)) - internalCollationArray[i][k++] = (char)j; - } - internalCollationArray[i][k] = NIL; - } -} -#endif - -/************************************************************************* - * TrioGetCharacterClass [private] - * - * FIXME: - * multibyte - */ -static int -TrioGetCharacterClass(const char *format, - int *indexPointer, - unsigned long *flagsPointer, - int *characterclass) -{ - int index = *indexPointer; - int i; - char ch; - char range_begin; - char range_end; - - *flagsPointer &= ~FLAGS_EXCLUDE; - - if (format[index] == QUALIFIER_CIRCUMFLEX) - { - *flagsPointer |= FLAGS_EXCLUDE; - index++; - } - /* - * If the ungroup character is at the beginning of the scanlist, - * it will be part of the class, and a second ungroup character - * must follow to end the group. - */ - if (format[index] == SPECIFIER_UNGROUP) - { - characterclass[(int)SPECIFIER_UNGROUP]++; - index++; - } - /* - * Minus is used to specify ranges. To include minus in the class, - * it must be at the beginning of the list - */ - if (format[index] == QUALIFIER_MINUS) - { - characterclass[(int)QUALIFIER_MINUS]++; - index++; - } - /* Collect characters */ - for (ch = format[index]; - (ch != SPECIFIER_UNGROUP) && (ch != NIL); - ch = format[++index]) - { - switch (ch) - { - case QUALIFIER_MINUS: /* Scanlist ranges */ - - /* - * Both C99 and UNIX98 describes ranges as implementation- - * defined. - * - * We support the following behaviour (although this may - * change as we become wiser) - * - only increasing ranges, ie. [a-b] but not [b-a] - * - transitive ranges, ie. [a-b-c] == [a-c] - * - trailing minus, ie. [a-] is interpreted as an 'a' - * and a '-' - * - duplicates (although we can easily convert these - * into errors) - */ - range_begin = format[index - 1]; - range_end = format[++index]; - if (range_end == SPECIFIER_UNGROUP) - { - /* Trailing minus is included */ - characterclass[(int)ch]++; - ch = range_end; - break; /* for */ - } - if (range_end == NIL) - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - if (range_begin > range_end) - return TRIO_ERROR_RETURN(TRIO_ERANGE, index); - - for (i = (int)range_begin; i <= (int)range_end; i++) - characterclass[i]++; - - ch = range_end; - break; - -#if TRIO_EXTENSION - - case SPECIFIER_GROUP: - - switch (format[index + 1]) - { - case QUALIFIER_DOT: /* Collating symbol */ - /* - * FIXME: This will be easier to implement when multibyte - * characters have been implemented. Until now, we ignore - * this feature. - */ - for (i = index + 2; ; i++) - { - if (format[i] == NIL) - /* Error in syntax */ - return -1; - else if (format[i] == QUALIFIER_DOT) - break; /* for */ - } - if (format[++i] != SPECIFIER_UNGROUP) - return -1; - - index = i; - break; - - case QUALIFIER_EQUAL: /* Equivalence class expressions */ - { - unsigned int j; - unsigned int k; - - if (internalCollationUnconverted) - { - /* Lazy evalutation of collation array */ - TrioGetCollation(); - internalCollationUnconverted = FALSE; - } - for (i = index + 2; ; i++) - { - if (format[i] == NIL) - /* Error in syntax */ - return -1; - else if (format[i] == QUALIFIER_EQUAL) - break; /* for */ - else - { - /* Mark any equivalent character */ - k = (unsigned int)format[i]; - for (j = 0; internalCollationArray[k][j] != NIL; j++) - characterclass[(int)internalCollationArray[k][j]]++; - } - } - if (format[++i] != SPECIFIER_UNGROUP) - return -1; - - index = i; - } - break; - - case QUALIFIER_COLON: /* Character class expressions */ - - if (StrEqualMax(CLASS_ALNUM, sizeof(CLASS_ALNUM) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isalnum(i)) - characterclass[i]++; - index += sizeof(CLASS_ALNUM) - 1; - } - else if (StrEqualMax(CLASS_ALPHA, sizeof(CLASS_ALPHA) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isalpha(i)) - characterclass[i]++; - index += sizeof(CLASS_ALPHA) - 1; - } - else if (StrEqualMax(CLASS_CNTRL, sizeof(CLASS_CNTRL) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (iscntrl(i)) - characterclass[i]++; - index += sizeof(CLASS_CNTRL) - 1; - } - else if (StrEqualMax(CLASS_DIGIT, sizeof(CLASS_DIGIT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isdigit(i)) - characterclass[i]++; - index += sizeof(CLASS_DIGIT) - 1; - } - else if (StrEqualMax(CLASS_GRAPH, sizeof(CLASS_GRAPH) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isgraph(i)) - characterclass[i]++; - index += sizeof(CLASS_GRAPH) - 1; - } - else if (StrEqualMax(CLASS_LOWER, sizeof(CLASS_LOWER) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (islower(i)) - characterclass[i]++; - index += sizeof(CLASS_LOWER) - 1; - } - else if (StrEqualMax(CLASS_PRINT, sizeof(CLASS_PRINT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isprint(i)) - characterclass[i]++; - index += sizeof(CLASS_PRINT) - 1; - } - else if (StrEqualMax(CLASS_PUNCT, sizeof(CLASS_PUNCT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (ispunct(i)) - characterclass[i]++; - index += sizeof(CLASS_PUNCT) - 1; - } - else if (StrEqualMax(CLASS_SPACE, sizeof(CLASS_SPACE) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isspace(i)) - characterclass[i]++; - index += sizeof(CLASS_SPACE) - 1; - } - else if (StrEqualMax(CLASS_UPPER, sizeof(CLASS_UPPER) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isupper(i)) - characterclass[i]++; - index += sizeof(CLASS_UPPER) - 1; - } - else if (StrEqualMax(CLASS_XDIGIT, sizeof(CLASS_XDIGIT) - 1, - &format[index])) - { - for (i = 0; i < MAX_CHARACTER_CLASS; i++) - if (isxdigit(i)) - characterclass[i]++; - index += sizeof(CLASS_XDIGIT) - 1; - } - else - { - characterclass[(int)ch]++; - } - break; - - default: - characterclass[(int)ch]++; - break; - } - break; - -#endif /* TRIO_EXTENSION */ - - default: - characterclass[(int)ch]++; - break; - } - } - return 0; -} - -/************************************************************************* - * TrioReadNumber [private] - * - * We implement our own number conversion in preference of strtol and - * strtoul, because we must handle 'long long' and thousand separators. - */ -static BOOLEAN_T -TrioReadNumber(trio_T *self, - trio_uintmax_t *target, - unsigned long flags, - int width, - int base) -{ - trio_uintmax_t number = 0; - int digit; - int count; - BOOLEAN_T isNegative = FALSE; - int j; - - assert(VALID(self)); - assert(VALID(self->InStream)); - assert((base >= MIN_BASE && base <= MAX_BASE) || (base == NO_BASE)); - - if (internalDigitsUnconverted) - { - /* Lazy evaluation of digits array */ - memset(internalDigitArray, -1, sizeof(internalDigitArray)); - for (j = 0; j < (int)sizeof(internalDigitsLower) - 1; j++) - { - internalDigitArray[(int)internalDigitsLower[j]] = j; - internalDigitArray[(int)internalDigitsUpper[j]] = j; - } - internalDigitsUnconverted = FALSE; - } - - TrioSkipWhitespaces(self); - - if (!(flags & FLAGS_UNSIGNED)) - { - /* Leading sign */ - if (self->current == '+') - { - self->InStream(self, NULL); - } - else if (self->current == '-') - { - self->InStream(self, NULL); - isNegative = TRUE; - } - } - - count = self->processed; - - if (flags & FLAGS_ALTERNATIVE) - { - switch (base) - { - case NO_BASE: - case BASE_OCTAL: - case BASE_HEX: - case BASE_BINARY: - if (self->current == '0') - { - self->InStream(self, NULL); - if (self->current) - { - if ((base == BASE_HEX) && - (toupper(self->current) == 'X')) - { - self->InStream(self, NULL); - } - else if ((base == BASE_BINARY) && - (toupper(self->current) == 'B')) - { - self->InStream(self, NULL); - } - } - } - else - return FALSE; - break; - default: - break; - } - } - - while (((width == NO_WIDTH) || (self->processed - count < width)) && - (! ((self->current == EOF) || isspace(self->current)))) - { - if (isascii(self->current)) - { - digit = internalDigitArray[self->current]; - /* Abort if digit is not allowed in the specified base */ - if ((digit == -1) || (digit >= base)) - break; - } - else if (flags & FLAGS_QUOTE) - { - /* Compare with thousands separator */ - for (j = 0; internalThousandSeparator[j] && self->current; j++) - { - if (internalThousandSeparator[j] != self->current) - break; - - self->InStream(self, NULL); - } - if (internalThousandSeparator[j]) - break; /* Mismatch */ - else - continue; /* Match */ - } - else - break; - - number *= base; - number += digit; - - self->InStream(self, NULL); - } - - /* Was anything read at all? */ - if (self->processed == count) - return FALSE; - - if (target) - *target = (isNegative) ? -number : number; - return TRUE; -} - -/************************************************************************* - * TrioReadChar [private] - */ -static int -TrioReadChar(trio_T *self, - char *target, - unsigned long flags, - int width) -{ - int i; - char ch; - trio_uintmax_t number; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - for (i = 0; - (self->current != EOF) && (i < width); - i++) - { - ch = (char)self->current; - self->InStream(self, NULL); - if ((flags & FLAGS_ALTERNATIVE) && (ch == CHAR_BACKSLASH)) - { - switch (self->current) - { - case '\\': ch = '\\'; break; - case 'a': ch = '\007'; break; - case 'b': ch = '\b'; break; - case 'f': ch = '\f'; break; - case 'n': ch = '\n'; break; - case 'r': ch = '\r'; break; - case 't': ch = '\t'; break; - case 'v': ch = '\v'; break; - default: - if (isdigit(self->current)) - { - /* Read octal number */ - if (!TrioReadNumber(self, &number, 0, 3, BASE_OCTAL)) - return 0; - ch = (char)number; - } - else if (toupper(self->current) == 'X') - { - /* Read hexadecimal number */ - self->InStream(self, NULL); - if (!TrioReadNumber(self, &number, 0, 2, BASE_HEX)) - return 0; - ch = (char)number; - } - else - { - ch = (char)self->current; - } - break; - } - } - - if (target) - target[i] = ch; - } - return i + 1; -} - -/************************************************************************* - * TrioReadString [private] - */ -static BOOLEAN_T -TrioReadString(trio_T *self, - char *target, - unsigned long flags, - int width) -{ - int i; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - TrioSkipWhitespaces(self); - - /* - * Continue until end of string is reached, a whitespace is encountered, - * or width is exceeded - */ - for (i = 0; - ((width == NO_WIDTH) || (i < width)) && - (! ((self->current == EOF) || isspace(self->current))); - i++) - { - if (TrioReadChar(self, &target[i], flags, 1) == 0) - break; /* for */ - } - if (target) - target[i] = NIL; - return TRUE; -} - -/************************************************************************* - * TrioReadWideChar [private] - */ -#if TRIO_WIDECHAR -static int -TrioReadWideChar(trio_T *self, - wchar_t *target, - unsigned long flags, - int width) -{ - int i; - int j; - int size; - int amount = 0; - wchar_t wch; - char buffer[MB_LEN_MAX + 1]; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - for (i = 0; - (self->current != EOF) && (i < width); - i++) - { - if (isascii(self->current)) - { - if (TrioReadChar(self, buffer, flags, 1) == 0) - return 0; - buffer[1] = NIL; - } - else - { - /* - * Collect a multibyte character, by enlarging buffer until - * it contains a fully legal multibyte character, or the - * buffer is full. - */ - j = 0; - do - { - buffer[j++] = (char)self->current; - buffer[j] = NIL; - self->InStream(self, NULL); - } - while ((j < (int)sizeof(buffer)) && (mblen(buffer, (size_t)j) != j)); - } - if (target) - { - size = mbtowc(&wch, buffer, sizeof(buffer)); - if (size > 0) - target[i] = wch; - } - amount += size; - self->InStream(self, NULL); - } - return amount; -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioReadWideString [private] - */ -#if TRIO_WIDECHAR -static BOOLEAN_T -TrioReadWideString(trio_T *self, - wchar_t *target, - unsigned long flags, - int width) -{ - int i; - int size; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - TrioSkipWhitespaces(self); - -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - /* - * Continue until end of string is reached, a whitespace is encountered, - * or width is exceeded - */ - for (i = 0; - ((width == NO_WIDTH) || (i < width)) && - (! ((self->current == EOF) || isspace(self->current))); - ) - { - size = TrioReadWideChar(self, &target[i], flags, 1); - if (size == 0) - break; /* for */ - - i += size; - } - if (target) - target[i] = L'\0'; - return TRUE; -} -#endif /* TRIO_WIDECHAR */ - -/************************************************************************* - * TrioReadGroup [private] - * - * FIXME: characterclass does not work with multibyte characters - */ -static BOOLEAN_T -TrioReadGroup(trio_T *self, - char *target, - int *characterclass, - unsigned long flags, - int width) -{ - int ch; - int i; - - assert(VALID(self)); - assert(VALID(self->InStream)); - - ch = self->current; - for (i = 0; - ((width == NO_WIDTH) || (i < width)) && - (! ((ch == EOF) || - (((flags & FLAGS_EXCLUDE) != 0) ^ (characterclass[ch] == 0)))); - i++) - { - if (target) - target[i] = (char)ch; - self->InStream(self, &ch); - } - - if (target) - target[i] = NIL; - return TRUE; -} - -/************************************************************************* - * TrioReadDouble [private] - * - * FIXME: - * add long double - */ -static BOOLEAN_T -TrioReadDouble(trio_T *self, - double *target, - unsigned long flags, - int width) -{ - int ch; - char doubleString[512] = ""; - int index = 0; - int start; - int j; - BOOLEAN_T isHex = FALSE; - - if ((width == NO_WIDTH) || (width > (int)sizeof(doubleString) - 1)) - width = sizeof(doubleString) - 1; - - TrioSkipWhitespaces(self); - - /* - * Read entire double number from stream. StrToDouble requires a - * string as input, but InStream can be anything, so we have to - * collect all characters. - */ - ch = self->current; - if ((ch == '+') || (ch == '-')) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - width--; - } - - start = index; - switch (ch) - { - case 'n': - case 'N': - /* Not-a-number */ - if (index != 0) - break; - /* FALLTHROUGH */ - case 'i': - case 'I': - /* Infinity */ - while (isalpha(ch) && (index - start < width)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - doubleString[index] = NIL; - - /* Case insensitive string comparison */ - if (StrEqual(&doubleString[start], INFINITE_UPPER) || - StrEqual(&doubleString[start], LONG_INFINITE_UPPER)) - { - *target = ((start == 1 && doubleString[0] == '-')) - ? -HUGE_VAL - : HUGE_VAL; - return TRUE; - } - if (StrEqual(doubleString, NAN_LOWER)) - { - /* NaN must not have a preceeding + nor - */ - *target = TrioGenerateNaN(); - return TRUE; - } - return FALSE; - - default: - break; - } - - if (ch == '0') - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - if (toupper(ch) == 'X') - { - isHex = TRUE; - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - } - while ((ch != EOF) && (index - start < width)) - { - /* Integer part */ - if (isHex ? isxdigit(ch) : isdigit(ch)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - else if (flags & FLAGS_QUOTE) - { - /* Compare with thousands separator */ - for (j = 0; internalThousandSeparator[j] && self->current; j++) - { - if (internalThousandSeparator[j] != self->current) - break; - - self->InStream(self, &ch); - } - if (internalThousandSeparator[j]) - break; /* Mismatch */ - else - continue; /* Match */ - } - else - break; /* while */ - } - if (ch == '.') - { - /* Decimal part */ - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - while ((isHex ? isxdigit(ch) : isdigit(ch)) && - (index - start < width)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - if (isHex ? (toupper(ch) == 'P') : (toupper(ch) == 'E')) - { - /* Exponent */ - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - if ((ch == '+') || (ch == '-')) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - while ((isHex ? isxdigit(ch) : isdigit(ch)) && - (index - start < width)) - { - doubleString[index++] = (char)ch; - self->InStream(self, &ch); - } - } - } - - if ((index == start) || (*doubleString == NIL)) - return FALSE; - - if (flags & FLAGS_LONGDOUBLE) -/* *longdoublePointer = StrToLongDouble()*/ - return FALSE; /* FIXME: Remove when long double is implemented */ - else - { - *target = StrToDouble(doubleString, NULL); - } - return TRUE; -} - -/************************************************************************* - * TrioReadPointer [private] - */ -static BOOLEAN_T -TrioReadPointer(trio_T *self, - void **target, - unsigned long flags) -{ - trio_uintmax_t number; - char buffer[sizeof(null)]; - - flags |= (FLAGS_UNSIGNED | FLAGS_ALTERNATIVE | FLAGS_NILPADDING); - - if (TrioReadNumber(self, - &number, - flags, - POINTER_WIDTH, - BASE_HEX)) - { - /* - * The strange assignment of number is a workaround for a compiler - * warning - */ - if (target) - *target = (char *)0 + number; - return TRUE; - } - else if (TrioReadString(self, - (flags & FLAGS_IGNORE) - ? NULL - : buffer, - 0, - sizeof(null) - 1)) - { - if (StrEqualCase(buffer, null)) - { - if (target) - *target = NULL; - return TRUE; - } - } - return FALSE; -} - -/************************************************************************* - * TrioScan [private] - */ -static int -TrioScan(const void *source, - size_t sourceSize, - void (*InStream)(trio_T *, int *), - const char *format, - va_list arglist, - void **argarray) -{ -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int charlen; -#endif - int status; - int assignment; - parameter_T parameters[MAX_PARAMETERS]; - trio_T internalData; - trio_T *data; - int ch; -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - int cnt; -#endif - int index; /* Index of format string */ - int i; /* Index of current parameter */ - unsigned long flags; - int width; - int base; - void *pointer; - - assert(VALID(InStream)); - assert(VALID(format)); - - memset(&internalData, 0, sizeof(internalData)); - data = &internalData; - data->InStream = InStream; - data->location = (void *)source; - data->max = sourceSize; - -#if defined(USE_LOCALE) - if (NULL == internalLocaleValues) - { - TrioSetLocale(); - } -#endif - - status = TrioPreprocess(TYPE_SCAN, format, parameters, arglist, argarray); - if (status < 0) - return status; - - assignment = 0; - i = 0; - index = 0; - data->InStream(data, &ch); - -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - mblen(NULL, 0); -#endif - - while (format[index]) - { -#if defined(TRIO_COMPILER_SUPPORTS_MULTIBYTE) - if (! isascii(format[index])) - { - charlen = mblen(&format[index], MB_LEN_MAX); - /* Compare multibyte characters in format string */ - for (cnt = 0; cnt < charlen - 1; cnt++) - { - if (ch != format[index + cnt]) - { - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - data->InStream(data, &ch); - } - continue; /* while */ - } -#endif /* TRIO_COMPILER_SUPPORTS_MULTIBYTE */ - if (EOF == ch) - return EOF; - - if (CHAR_IDENTIFIER == format[index]) - { - if (CHAR_IDENTIFIER == format[index + 1]) - { - /* Two % in format matches one % in input stream */ - if (CHAR_IDENTIFIER == ch) - { - data->InStream(data, &ch); - index += 2; - continue; /* while format chars left */ - } - else - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - - /* Skip the parameter entries */ - while (parameters[i].type == FORMAT_PARAMETER) - i++; - - flags = parameters[i].flags; - /* Find width */ - width = parameters[i].width; - if (flags & FLAGS_WIDTH_PARAMETER) - { - /* Get width from parameter list */ - width = (int)parameters[width].data.number.as_signed; - } - /* Find base */ - base = parameters[i].base; - if (flags & FLAGS_BASE_PARAMETER) - { - /* Get base from parameter list */ - base = (int)parameters[base].data.number.as_signed; - } - - switch (parameters[i].type) - { - case FORMAT_INT: - { - trio_uintmax_t number; - - if (0 == base) - base = BASE_DECIMAL; - - if (!TrioReadNumber(data, - &number, - flags, - width, - base)) - return assignment; - assignment++; - - if (!(flags & FLAGS_IGNORE)) - { - pointer = parameters[i].data.pointer; -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (flags & FLAGS_SIZE_T) - *(size_t *)pointer = (size_t)number; - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (flags & FLAGS_PTRDIFF_T) - *(ptrdiff_t *)pointer = (ptrdiff_t)number; - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (flags & FLAGS_INTMAX_T) - *(trio_intmax_t *)pointer = (trio_intmax_t)number; - else -#endif - if (flags & FLAGS_QUAD) - *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)number; - else if (flags & FLAGS_LONG) - *(long int *)pointer = (long int)number; - else if (flags & FLAGS_SHORT) - *(short int *)pointer = (short int)number; - else - *(int *)pointer = (int)number; - } - } - break; /* FORMAT_INT */ - - case FORMAT_STRING: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - if (!TrioReadWideString(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.wstring, - flags, - width)) - return assignment; - } - else -#endif - { - if (!TrioReadString(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.string, - flags, - width)) - return assignment; - } - assignment++; - break; /* FORMAT_STRING */ - - case FORMAT_DOUBLE: - if (!TrioReadDouble(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.doublePointer, - flags, - width)) - return assignment; - assignment++; - break; /* FORMAT_DOUBLE */ - - case FORMAT_GROUP: - { - int characterclass[MAX_CHARACTER_CLASS + 1]; - int rc; - - /* Skip over modifiers */ - while (format[index] != SPECIFIER_GROUP) - { - index++; - } - /* Skip over group specifier */ - index++; - - memset(characterclass, 0, sizeof(characterclass)); - rc = TrioGetCharacterClass(format, - &index, - &flags, - characterclass); - if (rc < 0) - return rc; - - if (!TrioReadGroup(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.string, - characterclass, - flags, - parameters[i].width)) - return assignment; - assignment++; - } - break; /* FORMAT_GROUP */ - - case FORMAT_COUNT: - pointer = parameters[i].data.pointer; - if (NULL != pointer) - { -#if defined(QUALIFIER_SIZE_T) || defined(QUALIFIER_SIZE_T_UPPER) - if (flags & FLAGS_SIZE_T) - *(size_t *)pointer = (size_t)data->committed; - else -#endif -#if defined(QUALIFIER_PTRDIFF_T) - if (flags & FLAGS_PTRDIFF_T) - *(ptrdiff_t *)pointer = (ptrdiff_t)data->committed; - else -#endif -#if defined(QUALIFIER_INTMAX_T) - if (flags & FLAGS_INTMAX_T) - *(trio_intmax_t *)pointer = (trio_intmax_t)data->committed; - else -#endif - if (flags & FLAGS_QUAD) - { - *(trio_ulonglong_t *)pointer = (trio_ulonglong_t)data->committed; - } - else if (flags & FLAGS_LONG) - { - *(long int *)pointer = (long int)data->committed; - } - else if (flags & FLAGS_SHORT) - { - *(short int *)pointer = (short int)data->committed; - } - else - { - *(int *)pointer = (int)data->committed; - } - } - break; /* FORMAT_COUNT */ - - case FORMAT_CHAR: -#if TRIO_WIDECHAR - if (flags & FLAGS_WIDECHAR) - { - if (TrioReadWideChar(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.wstring, - flags, - (width == NO_WIDTH) ? 1 : width) > 0) - return assignment; - } - else -#endif - { - if (TrioReadChar(data, - (flags & FLAGS_IGNORE) - ? NULL - : parameters[i].data.string, - flags, - (width == NO_WIDTH) ? 1 : width) > 0) - return assignment; - } - assignment++; - break; /* FORMAT_CHAR */ - - case FORMAT_POINTER: - if (!TrioReadPointer(data, - (flags & FLAGS_IGNORE) - ? NULL - : (void **)parameters[i].data.pointer, - flags)) - return assignment; - assignment++; - break; /* FORMAT_POINTER */ - - case FORMAT_PARAMETER: - break; /* FORMAT_PARAMETER */ - - default: - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - } - ch = data->current; - index = parameters[i].indexAfterSpecifier; - i++; - } - else /* Not an % identifier */ - { - if (isspace((int)format[index])) - { - /* Whitespaces may match any amount of whitespaces */ - ch = TrioSkipWhitespaces(data); - } - else if (ch == format[index]) - { - data->InStream(data, &ch); - } - else - return TRIO_ERROR_RETURN(TRIO_EINVAL, index); - - index++; - } - } - return assignment; -} - -/************************************************************************* - * TrioInStreamFile [private] - */ -static void -TrioInStreamFile(trio_T *self, - int *intPointer) -{ - FILE *file = (FILE *)self->location; - - assert(VALID(self)); - assert(VALID(file)); - - self->current = fgetc(file); - self->processed++; - self->committed++; - - if (VALID(intPointer)) - { - *intPointer = self->current; - } -} - -/************************************************************************* - * TrioInStreamFileDescriptor [private] - */ -static void -TrioInStreamFileDescriptor(trio_T *self, - int *intPointer) -{ - int fd = *((int *)self->location); - int size; - unsigned char input; - - assert(VALID(self)); - - size = read(fd, &input, sizeof(char)); - self->current = (size == 0) ? EOF : input; - self->processed++; - self->committed++; - - if (VALID(intPointer)) - { - *intPointer = self->current; - } -} - -/************************************************************************* - * TrioInStreamString [private] - */ -static void -TrioInStreamString(trio_T *self, - int *intPointer) -{ - unsigned char **buffer; - - assert(VALID(self)); - assert(VALID(self->InStream)); - assert(VALID(self->location)); - - buffer = (unsigned char **)self->location; - self->current = (*buffer)[0]; - if (self->current == NIL) - self->current = EOF; - (*buffer)++; - self->processed++; - self->committed++; - - if (VALID(intPointer)) - { - *intPointer = self->current; - } -} - -/************************************************************************* - * scanf - */ -int -trio_scanf(const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(stdin, 0, TrioInStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vscanf(const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioScan(stdin, 0, TrioInStreamFile, format, args, NULL); -} - -int -trio_scanfv(const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioScan(stdin, 0, TrioInStreamFile, format, dummy, args); -} - -/************************************************************************* - * fscanf - */ -int -trio_fscanf(FILE *file, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(file)); - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(file, 0, TrioInStreamFile, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vfscanf(FILE *file, - const char *format, - va_list args) -{ - assert(VALID(file)); - assert(VALID(format)); - - return TrioScan(file, 0, TrioInStreamFile, format, args, NULL); -} - -int -trio_fscanfv(FILE *file, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(file)); - assert(VALID(format)); - - return TrioScan(file, 0, TrioInStreamFile, format, dummy, args); -} - -/************************************************************************* - * dscanf - */ -int -trio_dscanf(int fd, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vdscanf(int fd, - const char *format, - va_list args) -{ - assert(VALID(format)); - - return TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, args, NULL); -} - -int -trio_dscanfv(int fd, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(format)); - - return TrioScan(&fd, 0, TrioInStreamFileDescriptor, format, dummy, args); -} - -/************************************************************************* - * sscanf - */ -int -trio_sscanf(const char *buffer, - const char *format, - ...) -{ - int status; - va_list args; - - assert(VALID(buffer)); - assert(VALID(format)); - - va_start(args, format); - status = TrioScan(&buffer, 0, TrioInStreamString, format, args, NULL); - va_end(args); - return status; -} - -int -trio_vsscanf(const char *buffer, - const char *format, - va_list args) -{ - assert(VALID(buffer)); - assert(VALID(format)); - - return TrioScan(&buffer, 0, TrioInStreamString, format, args, NULL); -} - -int -trio_sscanfv(const char *buffer, - const char *format, - void **args) -{ - va_list dummy; - shutup_unitialized(&dummy); - - assert(VALID(buffer)); - assert(VALID(format)); - - return TrioScan(&buffer, 0, TrioInStreamString, format, dummy, args); -} - diff --git a/org.glite.lbjp-utils.trio/src/triop.h b/org.glite.lbjp-utils.trio/src/triop.h deleted file mode 100644 index ca49fab..0000000 --- a/org.glite.lbjp-utils.trio/src/triop.h +++ /dev/null @@ -1,138 +0,0 @@ -/************************************************************************* - * - * $Id$ - * - * Copyright (C) 2000 Bjorn Reese and Daniel Stenberg. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF - * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHORS AND - * CONTRIBUTORS ACCEPT NO RESPONSIBILITY IN ANY CONCEIVABLE MANNER. - * - ************************************************************************ - * - * Private functions, types, etc. used for callback functions. - * - * The ref pointer is an opaque type and should remain as such. - * Private data must only be accessible through the getter and - * setter functions. - * - ************************************************************************/ - -#ifndef TRIO_TRIOP_H -#define TRIO_TRIOP_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef TRIO_C99 -# define TRIO_C99 1 -#endif -#ifndef TRIO_BSD -# define TRIO_BSD 1 -#endif -#ifndef TRIO_GNU -# define TRIO_GNU 1 -#endif -#ifndef TRIO_MISC -# define TRIO_MISC 1 -#endif -#ifndef TRIO_UNIX98 -# define TRIO_UNIX98 1 -#endif -#ifndef TRIO_MICROSOFT -# define TRIO_MICROSOFT 1 -#endif -#ifndef TRIO_EXTENSION -# define TRIO_EXTENSION 1 -#endif -#ifndef TRIO_WIDECHAR -# define TRIO_WIDECHAR 0 -#endif -#ifndef TRIO_ERRORS -# define TRIO_ERRORS 1 -#endif - -#ifndef TRIO_MALLOC -# define TRIO_MALLOC(n) malloc(n) -#endif -#ifndef TRIO_REALLOC -# define TRIO_REALLOC(x,n) realloc((x),(n)) -#endif -#ifndef TRIO_FREE -# define TRIO_FREE(x) free(x) -#endif - -typedef int (*trio_callback_t)(void *ref); - -void *trio_register(trio_callback_t callback, const char *name); -void trio_unregister(void *handle); - -const char *trio_get_format(void *ref); -void *trio_get_argument(void *ref); - -/* Modifiers */ -int trio_get_width(void *ref); -void trio_set_width(void *ref, int width); -int trio_get_precision(void *ref); -void trio_set_precision(void *ref, int precision); -int trio_get_base(void *ref); -void trio_set_base(void *ref, int base); -int trio_get_padding(void *ref); -void trio_set_padding(void *ref, int is_padding); -int trio_get_short(void *ref); /* h */ -void trio_set_shortshort(void *ref, int is_shortshort); -int trio_get_shortshort(void *ref); /* hh */ -void trio_set_short(void *ref, int is_short); -int trio_get_long(void *ref); /* l */ -void trio_set_long(void *ref, int is_long); -int trio_get_longlong(void *ref); /* ll */ -void trio_set_longlong(void *ref, int is_longlong); -int trio_get_longdouble(void *ref); /* L */ -void trio_set_longdouble(void *ref, int is_longdouble); -int trio_get_alternative(void *ref); /* # */ -void trio_set_alternative(void *ref, int is_alternative); -int trio_get_alignment(void *ref); /* - */ -void trio_set_alignment(void *ref, int is_leftaligned); -int trio_get_spacing(void *ref); /* (space) */ -void trio_set_spacing(void *ref, int is_space); -int trio_get_sign(void *ref); /* + */ -void trio_set_sign(void *ref, int is_showsign); -int trio_get_quote(void *ref); /* ' */ -void trio_set_quote(void *ref, int is_quote); -int trio_get_upper(void *ref); -void trio_set_upper(void *ref, int is_upper); -#if TRIO_C99 -int trio_get_largest(void *ref); /* j */ -void trio_set_largest(void *ref, int is_largest); -int trio_get_ptrdiff(void *ref); /* t */ -void trio_set_ptrdiff(void *ref, int is_ptrdiff); -int trio_get_size(void *ref); /* z / Z */ -void trio_set_size(void *ref, int is_size); -#endif - -/* Printing */ -int trio_print_ref(void *ref, const char *format, ...); -int trio_vprint_ref(void *ref, const char *format, va_list args); -int trio_printv_ref(void *ref, const char *format, void **args); - -void trio_print_int(void *ref, int number); -void trio_print_uint(void *ref, unsigned int number); -/* void trio_print_long(void *ref, long number); */ -/* void trio_print_ulong(void *ref, unsigned long number); */ -void trio_print_double(void *ref, double number); -void trio_print_string(void *ref, char *string); -void trio_print_pointer(void *ref, void *pointer); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* TRIO_TRIOP_H */ diff --git a/org.glite.lbjp-utils.trio/test/trio_test.cpp b/org.glite.lbjp-utils.trio/test/trio_test.cpp deleted file mode 100644 index 3ba4b9c..0000000 --- a/org.glite.lbjp-utils.trio/test/trio_test.cpp +++ /dev/null @@ -1,85 +0,0 @@ -#include - -#include -#include - -#include "trio.h" - -class TrioTest: public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(TrioTest); - CPPUNIT_TEST(escapeULM); - CPPUNIT_TEST(escapeXML); - CPPUNIT_TEST(escapeSQL); - CPPUNIT_TEST_SUITE_END(); - -public: - void escapeULM(); - void escapeXML(); - void escapeSQL(); -}; - -void TrioTest::escapeULM() -{ - char *e, *r = "START we have =, \\\", and \\n in the string END"; - - trio_asprintf(&e,"START %|Us END", "we have =, \", and \n in the string"), - std::cerr << e << std::endl; - - CPPUNIT_ASSERT_MESSAGE("escape ULM failed",!strcmp(e,r)); -} - -void TrioTest::escapeXML() -{ - char *e, *r = "START there is a <tag> containing &something; </tag> END"; - - trio_asprintf(&e,"START %|Xs END", "there is a containing &something; "), - std::cerr << e << std::endl; - - CPPUNIT_ASSERT_MESSAGE("escape XML failed",!strcmp(e,r)); -} - -void TrioTest::escapeSQL() -{ - char *e, *r = "START SQL doesn''t like '' END"; - - trio_asprintf(&e,"START %|Ss END", "SQL doesn't like '"), - std::cerr << e << std::endl; - - CPPUNIT_ASSERT_MESSAGE("escape SQL failed",!strcmp(e,r)); -} - -CPPUNIT_TEST_SUITE_REGISTRATION( TrioTest ); - -#include -#include - -#include -#include -#include -#include -#include -#include - -int main (int argc,const char *argv[]) -{ - CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); - - assert(argc == 2); - std::ofstream xml(argv[1]); - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - CppUnit::TestRunner runner; - runner.addTest(suite); - runner.run(controller); - - CppUnit::XmlOutputter xout( &result, xml ); - CppUnit::CompilerOutputter tout( &result, std::cout); - xout.write(); - tout.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} diff --git a/org.glite.myproxy-config/.cvsignore b/org.glite.myproxy-config/.cvsignore deleted file mode 100644 index 6b4e759..0000000 --- a/org.glite.myproxy-config/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -rpmbuild diff --git a/org.glite.myproxy-config/Makefile b/org.glite.myproxy-config/Makefile deleted file mode 100644 index 9ac7d65..0000000 --- a/org.glite.myproxy-config/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -prefix=/ -package=myproxy-config -name=$Name$ -tag:=$(shell echo $(name) | sed 's/^[^:]*: //' ) -version:=$(shell echo "$(tag)" | sed 's/^.*R_//' | sed 's/_/\./g') -release:=$(shell echo "$(version)" | sed 's/.*\.//') -version:=$(shell echo "$(version)" | sed 's/\(.*\)\.[0-9]*/\1/') - -.PHONY: configure install clean rpm - -all: configure - -install: - @echo installing ... - @install -D -m 0755 myproxy-initd $(prefix)/etc/init.d/myproxy - -clean:: - rm -f *~ test/*~ etc/*~ doc/*~ src/*~ - rm -rf rpmbuild - -rpm: - @mkdir -p rpmbuild/RPMS/noarch - @mkdir -p rpmbuild/SRPMS/ - @mkdir -p rpmbuild/SPECS/ - @mkdir -p rpmbuild/SOURCES/ - @mkdir -p rpmbuild/BUILD/ - -ifneq ("$(tag)","ame:") - @sed -i 's/^Version:.*/Version: $(version)/' $(package).spec - @sed -i 's/^Release:.*/Release: $(release)/' $(package).spec -endif - @tar --gzip --exclude='*CVS*' -cf rpmbuild/SOURCES/${package}.tgz * - @rpmbuild -ba ${package}.spec - - diff --git a/org.glite.myproxy-config/myproxy-config.spec b/org.glite.myproxy-config/myproxy-config.spec deleted file mode 100644 index 09ae1f2..0000000 --- a/org.glite.myproxy-config/myproxy-config.spec +++ /dev/null @@ -1,50 +0,0 @@ -%define topdir %(pwd)/rpmbuild -%define _topdir %{topdir} -Summary: Provides an init.d script for MyProxy -Name: myproxy-config -Version: 2.0.2 -Release: 1 -License: EDG -Group: EGEE -Source0: %{name}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root -BuildArch: noarch -Packager: Steve Traylen - -%description -Provides a startup init.d script for myproxy and nothing -else basically. - -%prep -%setup -c %{name} - -%build - - -%install -make install prefix=%{buildroot} - - -%clean -[ $RPM_BUILD_ROOT != / ] && rm -rf $RPM_BUILD_ROOT - - -%files -%defattr(-,root,root,-) -/etc/init.d/myproxy - - -%doc - - -%changelog -* Fri Oct 10 2008 Steve Traylen - 2.0.2-1 -- Fix for DNs with spaces in. - https://savannah.cern.ch/bugs/?42604 -* Wed Aug 13 2008 Steve Traylen -Clean up of echo statements from init.d script. -* Mon Aug 11 2008 Steve Traleen -- Rewrite a little for Makefile and etics. -* Wed May 21 2008 Ulrich Schwickerath - config-1 -- Initial build. - diff --git a/org.glite.myproxy-config/myproxy-initd b/org.glite.myproxy-config/myproxy-initd deleted file mode 100644 index 34bac01..0000000 --- a/org.glite.myproxy-config/myproxy-initd +++ /dev/null @@ -1,173 +0,0 @@ -#!/bin/bash -# -# SysV-style boot script for MyProxy -# -# chkconfig: 345 99 06 -# description: MyProxy online credential repository - -# source function library -. /etc/rc.d/init.d/functions - -### configuration - -GLOBUS_SYSCONFIG=${GLOBUS_SYSCONFIG:-/etc/sysconfig/globus} -if [ -f "$GLOBUS_SYSCONFIG" ]; then - . "$GLOBUS_SYSCONFIG" -fi - -GLOBUS_LOCATION=${GLOBUS_LOCATION:-/opt/globus} -if [ ! -d "$GLOBUS_LOCATION" ]; then - echo "GLOBUS_LOCATION not found" - exit 1 -fi -export GLOBUS_LOCATION -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLOBUS_LOCATION/lib - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -if [ ! -d "$GLITE_LOCATION" ]; then - echo "GLITE_LOCATION not found" - exit 1 -fi -export GLITE_LOCATION - -# Optional server configuration arguments, defaults shown commented out. -# Any parameter can be overridden in $MYPROXY_SYSCONFIG defined below. -#PORT="-p 7512" -PORT= -#CONFIG= -CONFIG=$GLITE_LOCATION/etc/myproxy-server.conf -#STORE="-s /var/myproxy" -STORE= -#VERBOSE= -VERBOSE=--verbose - -MYPROXY_SYSCONFIG=${MYPROXY_SYSCONFIG:-/etc/sysconfig/myproxy} -if [ -f "$MYPROXY_SYSCONFIG" ]; then - . "$MYPROXY_SYSCONFIG" -fi - -### main script - -prog="myproxy-server" -MYPROXY=$GLOBUS_LOCATION/sbin/$prog - -# check if executable exists -if [ ! -x $MYPROXY ] -then - echo "ERROR: $MYPROXY not present or not executable" - exit 2 -fi - -dn=` - openssl x509 -noout -subject -in \ - /etc/grid-security/hostcert.pem | sed 's-[^/]*--' -` -test=test-`date +%Y%m%d-%H%M%S`-$$ - -check_response() -{ - TIMEOUT=5 - check="MYPROXY_SERVER_DN=\"${dn}\" ${GLOBUS_LOCATION}/bin/myproxy-info \ - -s `hostname` $PORT -l $test 2>&1 | grep -i credential > /dev/null" - - ( - perl -e ' - $SIG{"TTIN"} = "IGNORE"; - $SIG{"TTOU"} = "IGNORE"; - setpgrp(0, 0); - exec(@ARGV); - warn "could not exec $ARGV[0]: $!\n"; - exit(127); - ' sh -c "$check" & - ping=$! - - exec 2> /dev/null - - perl -e ' - sleep('"$TIMEOUT"'); - kill(-9, '"$ping"'); - ' & - watchdog=$! - - wait $ping - status=$? - # the bash kill command does not work properly on process groups - /bin/kill -9 $watchdog $ping -$ping - exit $status - ) -} - -case $1 in -start) - - - # the myproxy-server assumes it is started from inetd if its - # stdin is connected to a socket; by connecting stdin to /dev/null - # we avoid problems if stdin happened to be a socket by accident, - # as observed with actuators in the Lemon fabric monitoring system - - server="'$MYPROXY $PORT -c $CONFIG $STORE $VERBOSE < /dev/null'" - - for i in 1 2 3 - do - echo -n $"Starting $prog, attempt $i of 3 :" - daemon sh -c "$server" - RETVAL=$? - [ $RETVAL = "0" ] && touch /var/lock/subsys/myproxy - echo - - for j in 1 2 3 4 5 - do - echo -n $"Checking myproxy response attempt: " - echo -n "$j of 5 " - sleep 1 - check_response - RETVAL=$? - [ $RETVAL = "0" ] && success && echo && exit 0 - failure - echo - done - done - - echo "ERROR: $prog not responsive - check /var/log/messages" - exit 1 - ;; -stop) - echo -n "Shutting down $prog" - killproc ${prog} - rc=$? - rm -f /var/lock/subsys/myproxy - echo - exit $rc - ;; -reload) - echo "Reconfiguring $prog" - - # as of version v4.2 the myproxy-server rereads its configuration file - # automatically on changes, so we do not have to do anything, besides - # ensuring that it actually is running - - $0 status && exit - $0 restart - exit - ;; -restart) - $0 stop - $0 start - exit - ;; -status) - status ${prog} - rc=$? - test $rc = 0 || exit $rc - - check_response && exit 0 - - echo "ERROR: $prog not responsive!" - exit 1 - ;; -*) - echo "Usage: $0 {start|stop|reload|restart|status}" - exit 2 -esac - diff --git a/org.glite.px.emi-px/Makefile b/org.glite.px.emi-px/Makefile deleted file mode 100644 index ce91d5f..0000000 --- a/org.glite.px.emi-px/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -top_srcdir=.. -stagedir=. -package=glite-PX -version=0.0.0 -PREFIX=/opt/glite -prefix= - --include Makefile.inc --include ../project/version.properties - -default all: - -install: - -stage: - $(MAKE) install PREFIX=${stagedir} - -check: - -clean: - rm -rvf log.xml rpmbuild/ RPMS/ tgz/ debian/ - -.PHONY: default all check install stage clean diff --git a/org.glite.px.emi-px/configure b/org.glite.px.emi-px/configure deleted file mode 100755 index 96cd3e0..0000000 --- a/org.glite.px.emi-px/configure +++ /dev/null @@ -1,1353 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = '/usr'; -my $stagedir = undef; -my $root = $pwd.'/stage'; -my $sysroot = ''; -my $sysconfdir; -my $localstatedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $branch; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $jobid_tag = ''; -my $libdir = getlibdir(); -my $project = 'glite'; -my (%projects, %project); -my $debug = 0; -my $pkg_config_env = (defined $ENV{PKG_CONFIG_PATH}) ? "$ENV{PKG_CONFIG_PATH}:" : ''; - -my @nodes = qw/client server logger logger-msg utils client-java doc ws-test db jpprimary jpindex jpclient harvester lb px proxyrenewal/; -my @default_nodes = qw/lb px proxyrenewal/; -my %enable_nodes; -my %disable_nodes; -my %default_nodes; @default_nodes{@default_nodes} = (1) x ($#default_nodes + 1); - -# key: internal package name (arguments, ...) -# 'pkg': pkg-config name -# 'prefix': used when pkg-config fails -my %externs = ( - cares => { - prefix => '/opt/c-ares', - pkg => 'libcares' - }, - classads => { - prefix=> '/usr', - pkg => 'classads' - }, - cppunit => { - prefix=> '/usr', - pkg => 'cppunit' - }, - expat => { - prefix=> '/usr', - pkg => 'expat' - }, - globus => { - prefix=> '/opt/globus', - pkg => 'globus-gssapi-gsi' - }, - 'myproxy-devel' => { - prefix=> '/opt/globus', - pkg => 'myproxy' - }, - 'myproxy-server' => { - prefix=> '', - }, - 'myproxy-libs' => { - prefix=> '', - }, - 'myproxy-admin' => { - prefix=> '', - }, - gsoap => { - prefix=> '/usr', - pkg => 'gsoap' - }, - gsoapxx => { - prefix=> '/usr', - pkg => 'gsoap++' - }, - mysql => { - prefix=> '/usr' - }, - 'mysql-devel' => { - prefix=> '' - }, - 'mysql-server' => { - prefix => '' - }, - voms => { - prefix => '/opt/glite', - pkg => 'voms-2.0' - }, - gridsite => { - prefix => '/opt/glite' - }, - lcas => { - prefix => '/opt/glite', - pkg => 'lcas' - }, - trustmanager => { - prefix => '/opt/glite' - }, - trustmanager_axis => { - prefix => '/opt/glite' - }, - utiljava => { - prefix=> '/opt/glite' - }, - ant => { - prefix=> '/usr' - }, - jdk => { - prefix=> '/usr/java/latest' - }, - libtar => { - prefix=> '/usr' - }, - axis => { - prefix=> '/usr' - }, - log4c => { - prefix=> '/usr' - }, - postgresql => { - prefix=> '/usr' - }, - activemq => { - prefix=>'/opt/activemq-cpp-library', - pkg => 'activemq-cpp' - }, - apr => { - prefix=>'/opt/apr', - pkg => 'apr-1' - }, - aprutil => { - prefix=>'/opt/apr-util', - pkg => 'apr-util-1' - }, -); - -my %jar = ( - 'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar', - 'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %buildroot; -my (%etics_externs, %etics_projects); - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim glite-LB logger-msg/], - 'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - 'gridsite' => [ qw/apache shared commands core devel slashgrid services service-clients gsexec/ ], - 'px' => [ qw/proxyrenewal glite-PX myproxy-yaim/ ], - ); - - -my @opts = ( - 'prefix:s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour:s' => \$thrflavour, - 'nothrflavour:s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'branch=s' => \$branch, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'root:s' => \$root, - 'sysroot:s' => \$sysroot, - 'sysconfdir=s' => \$sysconfdir, - 'localstatedir=s' => \$localstatedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, - 'libdir=s' => \$libdir, - 'project=s' => \$project, - 'debug' => \$debug, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$externs{$_}{withprefix} for keys %externs; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; -$prefix=~s/\/$//; -$stagedir=~s/\/$// if ($stagedir); -$root=~s/\/$//; -$sysroot=~s/\/$//; -if (not $sysconfdir) { $sysconfdir = $prefix eq '/usr' ? '/etc' : "$prefix/etc"; } -if (not $localstatedir) { $localstatedir = $prefix eq '/usr' ? '/var' : "$prefix/var"; } -$sysconfdir=~s/\/$//; -$localstatedir=~s/\/$//; - -$externs{'mysql-server'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-server'}{prefix} eq ''; -$externs{'mysql-devel'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-devel'}{prefix} eq ''; -$externs{'gsoapxx'}{prefix}=$externs{gsoap}{prefix} if $externs{'gsoapxx'}{prefix} eq ''; - -%project = %{$projects{$project}}; -for $_ (keys %{$project{etics_externs}}) { - $etics_externs{$_} = $project{etics_externs}{$_}; -} -for $_ (keys %{$project{etics_projects}}) { - $etics_projects{$_} = $project{etics_projects}{$_}; -} -for $_ (keys %{$project{need_externs_aux}}) { - $need_externs_aux{$_} = $project{need_externs_aux}{$_}; -} -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - my ($pkg, $type) =/([^:]*)(?::(.*))?/; - $type = 'BR' unless ($type); - - push @{$need_externs{$ext}},$pkg; - $need_externs_type{$ext}->{$pkg} = $type; - } -} - - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my $name_prefix = ($listmodules eq 'gridsite' and $project eq 'glite') ? 'org' : $project{etics_name}; - my @m = map "$name_prefix.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version, --branch and --output make sense only in --mode=etics\n" - if ($version || $output || $branch) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless ($disable_nodes{$_} or not $default_nodes{$_}); - } -} - -if (!$en && !$dis) { for (@nodes) { $enable_nodes{$_} = 1 if ($default_nodes{$_}) } }; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $root unless $stagedir; - -if ($mode eq 'build') { for my $ext (keys %externs) { - if (defined $externs{$ext} and defined $externs{$ext}{withprefix}) { $externs{$ext}{prefix} = $externs{$ext}{withprefix}; } - elsif (defined $externs{$ext}{pkg}) { - my ($flag, $env, $cmd, $ret); - my $pkg = $externs{$ext}{pkg}; - my $flagname = uc $externs{$ext}{pkg}; - $flagname =~ s/-[0-9\.]*$//; - $flagname =~ y/-\+/_X/; - - print "Checking $pkg ... "; - $env = "PKG_CONFIG_PATH=$pkg_config_env$stagedir$prefix/$libdir/pkgconfig"; - $cmd = "$env pkg-config $pkg --exists >/dev/null"; - `$cmd`; $ret = $?; - print "('$cmd' => $ret)\n" if ($debug); - if ($ret == 0) { - $externs{$ext}{prefix}=`$env pkg-config $pkg --variable=prefix`; - chomp $externs{$ext}{prefix}; - print "$externs{$ext}{prefix}\n"; - - $flag=`$env pkg-config $pkg --cflags`; - $externs{$ext}{flags} .= "${flagname}_CFLAGS=$flag" if ($flag); - $flag=`$env pkg-config $pkg --libs`; - $externs{$ext}{flags} .= "${flagname}_LIBS=$flag" if ($flag); - } else { - print "(using default $externs{$ext}{prefix})\n"; - } - print "\n" if ($debug); - } - elsif ($ext eq 'jdk') { - my $jdk_prefix; - - print "Looking for some caffein ... "; - if (defined $ENV{'JDK_HOME'}) { - $jdk_prefix = $ENV{'JDK_HOME'}; - print "JDK_HOME=$jdk_prefix\n"; - } elsif (defined $ENV{'JAVA_HOME'}) { - $jdk_prefix = $ENV{'JAVA_HOME'}; - print "JAVA_HOME=$jdk_prefix\n"; - } else { - print "(using default $externs{$ext}{prefix}))\n" - } - $externs{$ext}{prefix} = $jdk_prefix if ($jdk_prefix); - } -} } - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - for ('JDK_HOME', 'JAVA_HOME', 'PKG_CONFIG_PATH') { - print CONF "$_=$ENV{$_} " if (defined $ENV{$_}); - } - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - print "Mode: "; print $module ? "single module" : "multiple modules"; print "\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: ".($externs{$_}{prefix}?$externs{$_}{prefix}:'-')."\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - for (@ext) { if (defined($externs{$_}{flags})) { print "$externs{$_}{flags}"; } }; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - if ($module) { - print "Not creating summary Makefile\n" if $debug; - } else { - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean check:\n"; - - for (@modules) { - my $full = full($_); - print MAK "\tcd $full/$buildroot{$_} && \${MAKE} \$@\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $buildroot{$_} eq '' ? - "\tcd $full && \${MAKE} distclean\n" : - "\trm -rf $full/$buildroot{$_}\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $buildroot{$_}; - - print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; - } -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%etics_externs = ( - 'myproxy-devel'=>'myproxy-devel', - 'myproxy-libs'=>'myproxy-libs', - 'myproxy-server'=>'myproxy-server', - 'myproxy-admin'=>'myproxy-admin', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - utiljava=>'org.glite.security.util-java', - gpt=>'gpt', - fetchcrl=>'fetch-crl', - activemq=>'activemq-cpp-library', - apr=>'apr-dev', - aprutil=>'aprutil-dev', -); - -%etics_projects = ( -); - -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads libtool:B/ ], - 'lb.common' => [ qw/expat cares:B cppunit:B classads libtool:B/ ], - 'lb.doc' => [ qw/tetex-latex:B/ ], - 'lb.logger' => [ qw/cppunit:B libtool:B/ ], - 'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B/ ], - 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite bison:B libtool:B/ ], - 'lb.state-machine' => [ qw/classads libtool:B/ ], - 'lb.utils' => [ qw/cppunit:B libtool:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B libtool:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/docbook-utils:B libtool:B/ ], - 'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.log' => [ qw/log4c libtool:B/ ], - 'lbjp-common.maildir' => [ qw/libtool:B/ ], - 'lbjp-common.server-bones' => [ qw/libtool:B/ ], - 'lbjp-common.trio' => [ qw/cppunit:B libtool:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B libtool:B/ ], - 'lbjp-common.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap gsoapxx libtool:B/ ], - 'jobid.api-c' => [ qw/cppunit:B libtool:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], - 'gridsite.core' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2 openssl:B build_common_cpp:B doxygen:B/ ], - 'gridsite.commands' => [ qw/curl:R openssl:R/ ], - 'gridsite.apache' => [ qw/libxml2:R openssl:R curl:R/ ], - 'gridsite.shared' => [ qw/libxml2:R openssl:R/ ], - 'gridsite.devel' => [], - 'gridsite.slashgrid' => [ qw/curl:R fuse-libs:R fuse:R/], - 'gridsite.services' => [ qw/curl:R gsoap:R/ ], - 'gridsite.service-clients' => [ qw/curl:R gsoap:R gsoapxx:R/ ], - 'gridsite.gsexec' => [ qw// ], - 'px.proxyrenewal' => [ qw/globus:B globus_essentials:R myproxy-devel:B myproxy-libs:R voms libtool:R/ ], - 'px.myproxy-config' => [ qw/myproxy-admin:R/ ], # in myproxy-config.spec -); - -%need_jars = ( - 'jobid.api-java' => [ qw/jakarta-commons-codec/ ], - 'lb.client-java' => [ qw/jakarta-commons-lang/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp:B jobid.api-c - lbjp-common.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - lb.ws-interface:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp:B jobid.api-c - lb.types:B lbjp-common.trio lbjp-common.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - lbjp-common.log - jobid.api-c - lb.common - lbjp-common.gss - / ], - 'lb.logger-msg' => [ qw/ - lb.logger - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log - jobid.api-c - lbjp-common.gsoap-plugin lbjp-common.gss - / ], - 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface lbjp-common.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/lbjp-common.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/ - jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client - lbjp-common.gss lbjp-common.log - / ], - 'lb.yaim' => [ qw// ], - 'lb.glite-LB' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - lb.logger-msg:R - / ], - 'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.log' => [ qw// ], - 'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ], - 'lbjp-common.trio' => [ qw// ], - 'lbjp-common.gss' => [ qw// ], - 'lbjp-common.gsoap-plugin' => [ qw/lbjp-common.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - lbjp-common.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], - - 'gridsite.core' => [ qw// ], - 'gridsite.commands' => [ qw/gridsite.shared:R/ ], - 'gridsite.apache' => [ qw/gridsite.shared:R/ ], - 'gridsite.shared' => [ qw// ], - 'gridsite.devel' => [ qw/gridsite.shared:R/ ], - 'gridsite.slashgrid' => [ qw/gridsite.shared:R/], - 'gridsite.services' => [ qw/gridsite.shared:R/ ], - 'gridsite.service-clients' => [ qw/gridsite.shared:R/ ], - 'gridsite.gsexec' => [ qw// ], - - 'px.proxyrenewal' => [ qw// ], - 'px.glite-PX' => [qw/px.myproxy-yaim:R/], - 'px.myproxy-yaim' => [ qw// ], - 'px.myproxy-config' => [], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', - lb => 'lb.glite-LB', - px => 'px.glite-PX', - proxyrenewal => 'px.proxyrenewal' -); - -%obsoletes = ( - 'lb.yaim' => [ qq/glite-yaim-lb/ ], - 'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ], - 'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ], - 'px.myproxy-config' => [ qq/myproxy-config/ ], # in myproxy-config.spec - 'lbjp-common.gss' => [ qq/glite-security-gss/ ], - 'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ], - 'lb.glite-LB' => [ qq/glite-LB/ ], - 'px.glite-PX' => [ qq/glite-PX/ ], -); - -%cvs_prefix = ( - 'lb' => 'org.glite', - 'jp' => 'org.glite', - 'jobid' => 'org.glite', - 'lbjp-common' => 'org.glite', - 'gridsite' => 'org', - 'px' => 'org.glite', -); - -%cvs_tag_prefix = ( - 'lb' => 'glite-', - 'jp' => 'glite-', - 'jobid' => 'glite-', - 'lbjp-common' => 'glite-', - 'gridsite' => '', - 'px' => 'glite-', -); - -# ==== projects specification ==== -# etics_name ........... ETICS project name -# conf_prefix .......... ETICS configurations name prefix -# tag_prefix ........... VCS tag prefix -# local_prefix ......... prefix (relative to stage) -# etics_externs ........ ETICS modules names of externals -# (${NAME.location}, ETICS conf. dependencies) -# etics_projects ....... ETICS project names of externals -# etics_externs_devel .. ETICS modules names of devel versions of externals -# need_externs_aux ..... project-specific external dependencies -# supported_platforms .. platforms supported by the project -%projects = ( - glite => { - etics_name => 'org.glite', - conf_prefix => { %cvs_tag_prefix }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour=${globus.thr.flavor} --nothrflavour=${globus.nothr.flavor}', - local_prefix => '', - etics_externs => { - globus_essentials=>'vdt_globus_essentials', - globus=>'globus', - gridsite=>'org.gridsite.shared', - yaim_core=>'org.glite.yaim.core', - gip_release=>'glite-info-provider-release', - gip_service=>'glite-info-provider-service', - bdii=>'bdii', - glite_version=>'glite-version', - glite_info_templates=>'glite-info-templates', - glue_schema=>'glue-schema', - trustmanager=>'org.glite.security.trustmanager', - axis=>'axis', - lcas=>'org.glite.security.lcas', - gsoapxx=>'-', - build_common_cpp=>'org.glite.build.common-cpp', - }, - etics_externs_devel => { - gridsite=>'org.gridsite.devel', - }, - etics_projects => { - vdt=>[qw/globus globus_essentials gpt/], - 'org.glite'=>[qw/voms gridsite lcas gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R gpt:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R/ ], - }, - }, - - emi => { - etics_name => 'emi', - conf_prefix => { - 'lb' => 'emi-', - 'jp' => 'emi-', - 'jobid' => 'emi-', - 'lbjp-common' => 'emi-', - 'gridsite' => '', - 'px' => 'emi-', - }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour= --nothrflavour=', - local_prefix => '/usr', - etics_externs => { - globus_essentials=>'globus-gssapi-gsi', - globus=>'globus-gssapi-gsi-devel', - gridsite=>'emi.gridsite.shared', - yaim_core=>'emi.yaim.yaim-core', - yaim_bdii=>'emi.bdii.yaim-bdii', - gip_release=>'emi.bdii.glite-info-provider-release', - gip_service=>'emi.bdii.glite-info-provider-service', - bdii=>'emi.bdii.bdii-core', - glite_version=>'emi.misc.glite-version', - glue_schema=>'emi.bdii.glue-schema', - trustmanager=>'emi.java-security.trustmanager', - trustmanager_axis=>'emi.java-security.trustmanager-axis', - axis=>'axis1.4', - lcas=>'emi.sac.lcas', - gsoapxx=>'-', - build_common_cpp=>'emi.misc.glite.build-common-cpp', - }, - etics_externs_devel => { - cares => 'c-ares-devel', - classads => 'classads-devel', - cppunit => 'cppunit-devel', - expat => 'expat-devel', - gsoap => 'gsoap-devel', - voms => 'org.glite.security.voms-api', - libtar => 'libtar-devel', - log4c => 'log4c-devel', - postgresql => 'postgresql-devel', - curl => 'curl-devel', - libxml2 => 'libxml2-devel', - openssl => 'openssl-devel', - gridsite=>'emi.gridsite.devel', - }, - etics_projects => { - 'emi'=>[qw/voms voms-devel gridsite lcas gip_release gip_service bdii glite_version glue_schema yaim_core yaim_bdii trustmanager trustmanager_axis/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager trustmanager_axis libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gip_release:R gip_service:R bdii:R glite_version:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - }, - supported_platforms => { - sl5_x86_64_gcc412EPEL => 1, - sl5_ia32_gcc412EPEL => 1, - }, - }, -); - -%platform_properties = ( - 'gridsite.core' => { - sl5_x86_64_gcc412 => { aprSuffix => '1' }, - sl5_ia32_gcc412 => { aprSuffix => '1' }, - sl5_x86_64_gcc412EPEL => { aprSuffix => '1' }, - sl5_ia32_gcc412EPEL => { aprSuffix => '1' }, - deb5_x86_64_gcc432 => { aprSuffix => '1.0' }, - deb5_ia32_gcc432 => { aprSuffix => '1.0' }, - slc4_x86_64_gcc346 => { aprSuffix => '0' }, - slc4_ia32_gcc346 => { aprSuffix => '0' }, - default => { - } - }, - 'jobid.api-java' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.types' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.doc' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.ws-interface' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.myproxy-config' => { - default => { 'package.buildarch' => 'noarch' }, - }, -); - -my @k = keys %deps_aux; -@buildroot{@k} = ('') x ($#k+1); - -$buildroot{'gridsite.core'} = 'src'; -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.logger-msg lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB -lbjp-common.gss lbjp-common.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface lbjp-common.gss lbjp-common.gsoap-plugin -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $top_srcdir = '.'; - my $build = ''; - - if ($module) { - $top_srcdir = $0; - $top_srcdir =~ s,/?[^/]*$,,; - $top_srcdir =~ s,^$,\.,; - } else { - $build = "$full/"; - unless ($buildroot{$_} eq '') { - $top_srcdir = '..'; - $build .= "$buildroot{$_}/"; - unless (-d "$build") { - mkdir "$build" or die "mkdir $build: $!\n"; - } - } - } - unless ($top_srcdir eq '.') { - unlink $build."Makefile"; - symlink "$top_srcdir/Makefile",$build."Makefile" or die "symlink $top_srcdir/Makefile ".$build."Makefile: $!\n"; - for my $file ('.pre', '.post', '.preun', '.postun changelog') { - my $pfile = "project/$file"; - if (-f "$full/$pfile") { - mkdir "$build/project" unless (-d "$build/project"); - unlink $build.$pfile; - symlink "../$top_srcdir/$pfile", $build.$pfile or die "symlink ../$top_srcdir/$pfile ".$build."$pfile: $!\n"; - } - } - } - - open MKINC,">".$build."Makefile.inc" - or die $build."Makefile.inc: $!\n"; - - print "Creating ".$build."Makefile.inc\n"; - - print MKINC qq{project = $project -PREFIX = $root -prefix = $prefix -stagedir = $stagedir -sysroot = $sysroot -sysconfdir = $sysconfdir -localstatedir = $localstatedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -libdir = $libdir -top_srcdir = $top_srcdir -}; - - for (@{$need_externs{$short}}) { - next unless defined $externs{$_} and defined $externs{$_}{prefix}; - print MKINC "${_}_prefix = $externs{$_}{prefix}\n"; - print MKINC "$externs{$_}{flags}" if defined $externs{$_}{flags}; - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -BEGIN{ -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - my $path = "$cvs_prefix{$subsys}.$subsys.$module/project"; - if ($subsys eq 'gridsite') { - $path = "$cvs_prefix{$subsys}.$subsys.core/project"; - } - open V,"$path/version.properties" - or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{$project{etics_name}}}} = (1) x ($#{$etics_projects{$project{etics_name}}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/ and (defined $externs{$_} or defined $jar{$_})) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - next if ($eext eq '-'); - if ($project ne 'glite') { - if ($ge{$_} and not defined $externs{$_}{pkg}) { - push @copts, "--with-$_=\${stageDir}"; - } - } else { - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - } - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}$jar{$_}" if ($project eq 'glite'); - } - - my $conf; - my $conftag; - my ($confprefix, $nameprefix); - - $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n"; - - $confprefix = $project{conf_prefix}{$subsys}; - $nameprefix = $confprefix; - $nameprefix =~ s/-$//; - $nameprefix =~ s/-/\./g; - - if ($branch) { - $conf = "$confprefix${subsys}-${module}_$branch"; - $conftag = $branch; - # forced low age number - $age = $branch eq 'HEAD' ? '0head' : '0dev'; } - else { - $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - -# XXX: gridsite hack - $conftag = $subsys eq 'gridsite' ? "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : - "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; } - - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"}; - - my $confdir = $buildroot{"$subsys.$module"} eq '' ? '.' : '..'; - - my $package_description = ""; - my $package_summary = ""; - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description"; - $package_description = join ("", ); - close V; - chomp $package_description; - $package_description =~ s/\n/\\n/g; - $package_description = "package.description = $package_description\n"; - } - else { - print STDERR "package.description not found for $subsys.$module!\n"; } - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary"; - $package_summary = join ("", ); - close V; - chomp $package_summary; - $package_summary =~ s/\n/\\n/g; - $package_summary = "package.summary = $package_summary\n"; - } - else { - print STDERR "package.summary not found for $subsys.$module!\n"; } - - my %cmd; - @cmd{qw/configure compile test install packaging clean/} = ('None') x 6; - $cmd{clean} = 'make clean'; - $cmd{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_prefix{$subsys}.$subsys.$module 2>/dev/null"; - #$cmd{checkout} = "(test -d \${moduleName}/.git && (cd \${moduleName}; git pull) || git clone http://scientific.zcu.cz/git/jra1mw.git \${moduleName})"; - #$cmd{checkout} .= " && (cd \${moduleName}; git checkout ${tag})" unless ($conftag =~ /HEAD/); - $cmd{tag} = "cvs -d \${vcsroot} tag -R \${tag} ${moduleName}"; - - if ($subsys eq 'gridsite') { - $cmd{tag} = 'None'; - - if ($module eq 'core') { - my ($flags, $prefix); - - if ($project ne 'glite') { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=`pkg-config gsoap --variable=prefix` OPENSSL_GLOBUS_FLAGS=`pkg-config globus-openssl --cflags` OPENSSL_GLOBUS_LIBS=`pkg-config globus-openssl --libs` FLAVOR_GLOBUS_EXT= HTTPD_FLAGS="-I/usr/include/httpd -I/usr/include/apache2 -I/usr/include/apr-${aprSuffix} -I/usr/include/pcre"'; - $prefix = "prefix=${prefix}/usr"; - } else { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"'; - $prefix = "prefix=${prefix}"; - } - - $cmd{compile} = "echo 'make $flags' > build.sh\n\tmake $flags build"; - $cmd{clean} = "rm -rvf build.sh; $cmd{clean}"; - $cmd{install} = "make $prefix $flags install"; - $cmd{packaging} = "make $prefix $flags rpm"; - } - else { - $cmd{clean} = 'None'; - $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this"; - $cmd{checkout} = "mkdir -v \${moduleName} 2>/dev/null || true"; - } - } - elsif ($subsys eq 'px' and $module eq 'myproxy-config') { - $cmd{configure} = "/usr/bin/perl $confdir/configure --root=\${prefix} --prefix= --stage=\${stageDir} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{packaging} = "make rpm package=".$confprefix."$subsys-myproxy-config"; - } - else { - $cmd{configure} = "/usr/bin/perl $confdir/configure $project{flavours} --root=\${prefix} --prefix=$project{local_prefix} --stage=\${stageDir} --sysroot=\${package.prefix} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{compile} = 'make'; - $cmd{test} = 'make check'; - $cmd{install} = 'make install'; - } - - my $defprops = ''; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) { - $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n"; - } - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = $project{etics_name}.$subsys.$module -displayName = $conf -description = $cvs_prefix{$subsys}.$subsys.$module -projectName = $project{etics_name} -age = $age -deploymentType = None -vcsroot = :pserver:anonymous\@glite.cvs.cern.ch:/cvs/glite -tag = $conftag -version = $major.$minor.$rev -$dwpath -[Platform-default:VcsCommand] -displayName = None -description = None -tag = $cmd{tag} -branch = None -commit = None -checkout = $cmd{checkout} - -[Platform-default:BuildCommand] -postpublish = None -packaging = $cmd{packaging} -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = $cmd{compile} -init = None -install = $cmd{install} -clean = $cmd{clean} -test = $cmd{test} -configure = $cmd{configure} -checkstyle = None - -[Platform-default:Property] -$buildroot -aprSuffix = 0 -package.RPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/SRPMS -package.preserve.libtool = false -$package_description$package_summary$defprops}; - - for (@{$obsoletes{"$subsys.$module"}}) { - print C "package.obsoletes = $_\n"; - print C "package.replaces = $_\n"; - } - - for my $pp (keys %{$platform_properties{"$subsys.$module"}}) { - next if $pp eq 'default'; - next if exists $project{supported_platforms} and not exists $project{supported_platforms}{$pp}; - - print C "[Platform-$pp:Property]\n$buildroot\n"; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) { - print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n"; - } - print C "package.RPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/SRPMS\n"; - print C "$package_description$package_summary\n"; - } - - print C qq{ -[Platform-default:DynamicDependency] -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - my $edev = $project{etics_externs_devel}{$_}; - next if ($eext eq '-'); - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - - if ($edev) { - if ($type eq 'B') { - $eext = $edev; # no runtime - change to devel pkg - } elsif ($type eq 'BR' or $type eq 'RB') { - print C "$proj|$edev = B\n"; # additional devel pkg - } - } - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "$project{etics_name}|$project{etics_name}.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$externs{gsoap}{prefix}/bin/soapcpp2 -v 2>&1 |" or die "$externs{gsoap}{prefix}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - $gsoap_version = $1 if /The gSOAP code generator for C and C\+\+, soapcpp2 release ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - -sub getlibdir { - if ( -e "/etc/debian_version") { # We are on Debian - $lib64="lib"; - $lib32="lib32"; } - else { # Another distribution - $lib64="lib64"; - $lib32="lib"; } - $libdir=$lib32; - - open INP, "uname -s | "; # Check kernel name - $kname= ; - chomp($kname); - close INP; - - if ( $kname eq "Linux") { - $arch = ("x86_64\npowerpc\nppc64\n"); - - open INP, "uname -p | "; # Check processor type - $procname= ; - chomp($procname); - close INP; - - if ($arch =~/^$procname\n/) { - return ($lib64); } - - open INP, "uname -m | "; # Check machine hardware - $machname= ; - chomp($machname); - close INP; - - if ($arch =~/^$machname\n/) { - return ($lib64); } - - # special cases (hyperlink lib64, Debian) - if (-l "/usr/lib64") { - $libdir=$lib32; } - - # if /usr/lib64 doesn't exist at all (AIX) - unless ( -e "/usr/lib64" ) { - $libdir=$lib32; } - } - - if ( $kname eq "SunOS") { - if (-e "/usr/lib/64") { - $libdir="lib/64"; } - } - - return $libdir; -} - -sub usage { - my @ext = keys %externs; - my @myjars = keys %jar; - - print STDERR qq{ -Usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --stage=DIR staging directory [./stage] - --root=DIR installation root (custom relocation root -> sysroot) [./stage] - --sysroot=DIR system root (custom relocation root -> sysroot) [] - --sysconfdir=DIR system configuration directory [PREFIX/etc] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - --version=maj.min.rev-age specify version here instead of reading version.properties - --branch=branch CVS branch/etics name suffix (HEAD, branch_2_1, ...) - --libdir=libdir typically [lib,lib64] postfix - --project=PROJECT build or generate etics for a project (glite/emi) [emi] - --debug print more details - -Mode of operation: - --mode=\{checkout|build|etics\} what to do [build] - -What to build: - --module=module build this module only - --enable-NODE build this "node" (set of modules) only - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies (summary of what will be used is always printed): - --with-EXTERNAL=PATH where to look for an external [autodetect] - --with-JAR=JAR where to look for jars - -Available nodes: - @nodes - -Default nodes: - @default_nodes - -Externals (not all for all modules) are: - @ext - -External jars are: - @myjars - -}; - -} diff --git a/org.glite.px.emi-px/project/ChangeLog b/org.glite.px.emi-px/project/ChangeLog deleted file mode 100644 index 98ade7d..0000000 --- a/org.glite.px.emi-px/project/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -1.0.0-1 -- Initial release with EMI - diff --git a/org.glite.px.emi-px/project/package.description b/org.glite.px.emi-px/project/package.description deleted file mode 100644 index 2fc1c7b..0000000 --- a/org.glite.px.emi-px/project/package.description +++ /dev/null @@ -1 +0,0 @@ -Metapackage to install MyProxy with gLite-specific YAIM configurations. diff --git a/org.glite.px.emi-px/project/package.summary b/org.glite.px.emi-px/project/package.summary deleted file mode 100644 index 5acdab1..0000000 --- a/org.glite.px.emi-px/project/package.summary +++ /dev/null @@ -1 +0,0 @@ -Metapackage to install MyProxy with gLite-specific YAIM configurations diff --git a/org.glite.px.emi-px/project/version.properties b/org.glite.px.emi-px/project/version.properties deleted file mode 100644 index cd1e9e7..0000000 --- a/org.glite.px.emi-px/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.0.0 -module.age=1 diff --git a/org.glite.px.glite-PX/Makefile b/org.glite.px.glite-PX/Makefile deleted file mode 100644 index ce91d5f..0000000 --- a/org.glite.px.glite-PX/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -top_srcdir=.. -stagedir=. -package=glite-PX -version=0.0.0 -PREFIX=/opt/glite -prefix= - --include Makefile.inc --include ../project/version.properties - -default all: - -install: - -stage: - $(MAKE) install PREFIX=${stagedir} - -check: - -clean: - rm -rvf log.xml rpmbuild/ RPMS/ tgz/ debian/ - -.PHONY: default all check install stage clean diff --git a/org.glite.px.glite-PX/configure b/org.glite.px.glite-PX/configure deleted file mode 100755 index 96cd3e0..0000000 --- a/org.glite.px.glite-PX/configure +++ /dev/null @@ -1,1353 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = '/usr'; -my $stagedir = undef; -my $root = $pwd.'/stage'; -my $sysroot = ''; -my $sysconfdir; -my $localstatedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $branch; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $jobid_tag = ''; -my $libdir = getlibdir(); -my $project = 'glite'; -my (%projects, %project); -my $debug = 0; -my $pkg_config_env = (defined $ENV{PKG_CONFIG_PATH}) ? "$ENV{PKG_CONFIG_PATH}:" : ''; - -my @nodes = qw/client server logger logger-msg utils client-java doc ws-test db jpprimary jpindex jpclient harvester lb px proxyrenewal/; -my @default_nodes = qw/lb px proxyrenewal/; -my %enable_nodes; -my %disable_nodes; -my %default_nodes; @default_nodes{@default_nodes} = (1) x ($#default_nodes + 1); - -# key: internal package name (arguments, ...) -# 'pkg': pkg-config name -# 'prefix': used when pkg-config fails -my %externs = ( - cares => { - prefix => '/opt/c-ares', - pkg => 'libcares' - }, - classads => { - prefix=> '/usr', - pkg => 'classads' - }, - cppunit => { - prefix=> '/usr', - pkg => 'cppunit' - }, - expat => { - prefix=> '/usr', - pkg => 'expat' - }, - globus => { - prefix=> '/opt/globus', - pkg => 'globus-gssapi-gsi' - }, - 'myproxy-devel' => { - prefix=> '/opt/globus', - pkg => 'myproxy' - }, - 'myproxy-server' => { - prefix=> '', - }, - 'myproxy-libs' => { - prefix=> '', - }, - 'myproxy-admin' => { - prefix=> '', - }, - gsoap => { - prefix=> '/usr', - pkg => 'gsoap' - }, - gsoapxx => { - prefix=> '/usr', - pkg => 'gsoap++' - }, - mysql => { - prefix=> '/usr' - }, - 'mysql-devel' => { - prefix=> '' - }, - 'mysql-server' => { - prefix => '' - }, - voms => { - prefix => '/opt/glite', - pkg => 'voms-2.0' - }, - gridsite => { - prefix => '/opt/glite' - }, - lcas => { - prefix => '/opt/glite', - pkg => 'lcas' - }, - trustmanager => { - prefix => '/opt/glite' - }, - trustmanager_axis => { - prefix => '/opt/glite' - }, - utiljava => { - prefix=> '/opt/glite' - }, - ant => { - prefix=> '/usr' - }, - jdk => { - prefix=> '/usr/java/latest' - }, - libtar => { - prefix=> '/usr' - }, - axis => { - prefix=> '/usr' - }, - log4c => { - prefix=> '/usr' - }, - postgresql => { - prefix=> '/usr' - }, - activemq => { - prefix=>'/opt/activemq-cpp-library', - pkg => 'activemq-cpp' - }, - apr => { - prefix=>'/opt/apr', - pkg => 'apr-1' - }, - aprutil => { - prefix=>'/opt/apr-util', - pkg => 'apr-util-1' - }, -); - -my %jar = ( - 'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar', - 'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %buildroot; -my (%etics_externs, %etics_projects); - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim glite-LB logger-msg/], - 'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - 'gridsite' => [ qw/apache shared commands core devel slashgrid services service-clients gsexec/ ], - 'px' => [ qw/proxyrenewal glite-PX myproxy-yaim/ ], - ); - - -my @opts = ( - 'prefix:s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour:s' => \$thrflavour, - 'nothrflavour:s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'branch=s' => \$branch, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'root:s' => \$root, - 'sysroot:s' => \$sysroot, - 'sysconfdir=s' => \$sysconfdir, - 'localstatedir=s' => \$localstatedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, - 'libdir=s' => \$libdir, - 'project=s' => \$project, - 'debug' => \$debug, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$externs{$_}{withprefix} for keys %externs; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; -$prefix=~s/\/$//; -$stagedir=~s/\/$// if ($stagedir); -$root=~s/\/$//; -$sysroot=~s/\/$//; -if (not $sysconfdir) { $sysconfdir = $prefix eq '/usr' ? '/etc' : "$prefix/etc"; } -if (not $localstatedir) { $localstatedir = $prefix eq '/usr' ? '/var' : "$prefix/var"; } -$sysconfdir=~s/\/$//; -$localstatedir=~s/\/$//; - -$externs{'mysql-server'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-server'}{prefix} eq ''; -$externs{'mysql-devel'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-devel'}{prefix} eq ''; -$externs{'gsoapxx'}{prefix}=$externs{gsoap}{prefix} if $externs{'gsoapxx'}{prefix} eq ''; - -%project = %{$projects{$project}}; -for $_ (keys %{$project{etics_externs}}) { - $etics_externs{$_} = $project{etics_externs}{$_}; -} -for $_ (keys %{$project{etics_projects}}) { - $etics_projects{$_} = $project{etics_projects}{$_}; -} -for $_ (keys %{$project{need_externs_aux}}) { - $need_externs_aux{$_} = $project{need_externs_aux}{$_}; -} -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - my ($pkg, $type) =/([^:]*)(?::(.*))?/; - $type = 'BR' unless ($type); - - push @{$need_externs{$ext}},$pkg; - $need_externs_type{$ext}->{$pkg} = $type; - } -} - - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my $name_prefix = ($listmodules eq 'gridsite' and $project eq 'glite') ? 'org' : $project{etics_name}; - my @m = map "$name_prefix.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version, --branch and --output make sense only in --mode=etics\n" - if ($version || $output || $branch) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless ($disable_nodes{$_} or not $default_nodes{$_}); - } -} - -if (!$en && !$dis) { for (@nodes) { $enable_nodes{$_} = 1 if ($default_nodes{$_}) } }; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $root unless $stagedir; - -if ($mode eq 'build') { for my $ext (keys %externs) { - if (defined $externs{$ext} and defined $externs{$ext}{withprefix}) { $externs{$ext}{prefix} = $externs{$ext}{withprefix}; } - elsif (defined $externs{$ext}{pkg}) { - my ($flag, $env, $cmd, $ret); - my $pkg = $externs{$ext}{pkg}; - my $flagname = uc $externs{$ext}{pkg}; - $flagname =~ s/-[0-9\.]*$//; - $flagname =~ y/-\+/_X/; - - print "Checking $pkg ... "; - $env = "PKG_CONFIG_PATH=$pkg_config_env$stagedir$prefix/$libdir/pkgconfig"; - $cmd = "$env pkg-config $pkg --exists >/dev/null"; - `$cmd`; $ret = $?; - print "('$cmd' => $ret)\n" if ($debug); - if ($ret == 0) { - $externs{$ext}{prefix}=`$env pkg-config $pkg --variable=prefix`; - chomp $externs{$ext}{prefix}; - print "$externs{$ext}{prefix}\n"; - - $flag=`$env pkg-config $pkg --cflags`; - $externs{$ext}{flags} .= "${flagname}_CFLAGS=$flag" if ($flag); - $flag=`$env pkg-config $pkg --libs`; - $externs{$ext}{flags} .= "${flagname}_LIBS=$flag" if ($flag); - } else { - print "(using default $externs{$ext}{prefix})\n"; - } - print "\n" if ($debug); - } - elsif ($ext eq 'jdk') { - my $jdk_prefix; - - print "Looking for some caffein ... "; - if (defined $ENV{'JDK_HOME'}) { - $jdk_prefix = $ENV{'JDK_HOME'}; - print "JDK_HOME=$jdk_prefix\n"; - } elsif (defined $ENV{'JAVA_HOME'}) { - $jdk_prefix = $ENV{'JAVA_HOME'}; - print "JAVA_HOME=$jdk_prefix\n"; - } else { - print "(using default $externs{$ext}{prefix}))\n" - } - $externs{$ext}{prefix} = $jdk_prefix if ($jdk_prefix); - } -} } - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - for ('JDK_HOME', 'JAVA_HOME', 'PKG_CONFIG_PATH') { - print CONF "$_=$ENV{$_} " if (defined $ENV{$_}); - } - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - print "Mode: "; print $module ? "single module" : "multiple modules"; print "\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: ".($externs{$_}{prefix}?$externs{$_}{prefix}:'-')."\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - for (@ext) { if (defined($externs{$_}{flags})) { print "$externs{$_}{flags}"; } }; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - if ($module) { - print "Not creating summary Makefile\n" if $debug; - } else { - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean check:\n"; - - for (@modules) { - my $full = full($_); - print MAK "\tcd $full/$buildroot{$_} && \${MAKE} \$@\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $buildroot{$_} eq '' ? - "\tcd $full && \${MAKE} distclean\n" : - "\trm -rf $full/$buildroot{$_}\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $buildroot{$_}; - - print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; - } -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%etics_externs = ( - 'myproxy-devel'=>'myproxy-devel', - 'myproxy-libs'=>'myproxy-libs', - 'myproxy-server'=>'myproxy-server', - 'myproxy-admin'=>'myproxy-admin', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - utiljava=>'org.glite.security.util-java', - gpt=>'gpt', - fetchcrl=>'fetch-crl', - activemq=>'activemq-cpp-library', - apr=>'apr-dev', - aprutil=>'aprutil-dev', -); - -%etics_projects = ( -); - -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads libtool:B/ ], - 'lb.common' => [ qw/expat cares:B cppunit:B classads libtool:B/ ], - 'lb.doc' => [ qw/tetex-latex:B/ ], - 'lb.logger' => [ qw/cppunit:B libtool:B/ ], - 'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B/ ], - 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite bison:B libtool:B/ ], - 'lb.state-machine' => [ qw/classads libtool:B/ ], - 'lb.utils' => [ qw/cppunit:B libtool:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B libtool:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/docbook-utils:B libtool:B/ ], - 'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.log' => [ qw/log4c libtool:B/ ], - 'lbjp-common.maildir' => [ qw/libtool:B/ ], - 'lbjp-common.server-bones' => [ qw/libtool:B/ ], - 'lbjp-common.trio' => [ qw/cppunit:B libtool:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B libtool:B/ ], - 'lbjp-common.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap gsoapxx libtool:B/ ], - 'jobid.api-c' => [ qw/cppunit:B libtool:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], - 'gridsite.core' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2 openssl:B build_common_cpp:B doxygen:B/ ], - 'gridsite.commands' => [ qw/curl:R openssl:R/ ], - 'gridsite.apache' => [ qw/libxml2:R openssl:R curl:R/ ], - 'gridsite.shared' => [ qw/libxml2:R openssl:R/ ], - 'gridsite.devel' => [], - 'gridsite.slashgrid' => [ qw/curl:R fuse-libs:R fuse:R/], - 'gridsite.services' => [ qw/curl:R gsoap:R/ ], - 'gridsite.service-clients' => [ qw/curl:R gsoap:R gsoapxx:R/ ], - 'gridsite.gsexec' => [ qw// ], - 'px.proxyrenewal' => [ qw/globus:B globus_essentials:R myproxy-devel:B myproxy-libs:R voms libtool:R/ ], - 'px.myproxy-config' => [ qw/myproxy-admin:R/ ], # in myproxy-config.spec -); - -%need_jars = ( - 'jobid.api-java' => [ qw/jakarta-commons-codec/ ], - 'lb.client-java' => [ qw/jakarta-commons-lang/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp:B jobid.api-c - lbjp-common.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - lb.ws-interface:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp:B jobid.api-c - lb.types:B lbjp-common.trio lbjp-common.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - lbjp-common.log - jobid.api-c - lb.common - lbjp-common.gss - / ], - 'lb.logger-msg' => [ qw/ - lb.logger - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log - jobid.api-c - lbjp-common.gsoap-plugin lbjp-common.gss - / ], - 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface lbjp-common.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/lbjp-common.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/ - jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client - lbjp-common.gss lbjp-common.log - / ], - 'lb.yaim' => [ qw// ], - 'lb.glite-LB' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - lb.logger-msg:R - / ], - 'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.log' => [ qw// ], - 'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ], - 'lbjp-common.trio' => [ qw// ], - 'lbjp-common.gss' => [ qw// ], - 'lbjp-common.gsoap-plugin' => [ qw/lbjp-common.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - lbjp-common.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], - - 'gridsite.core' => [ qw// ], - 'gridsite.commands' => [ qw/gridsite.shared:R/ ], - 'gridsite.apache' => [ qw/gridsite.shared:R/ ], - 'gridsite.shared' => [ qw// ], - 'gridsite.devel' => [ qw/gridsite.shared:R/ ], - 'gridsite.slashgrid' => [ qw/gridsite.shared:R/], - 'gridsite.services' => [ qw/gridsite.shared:R/ ], - 'gridsite.service-clients' => [ qw/gridsite.shared:R/ ], - 'gridsite.gsexec' => [ qw// ], - - 'px.proxyrenewal' => [ qw// ], - 'px.glite-PX' => [qw/px.myproxy-yaim:R/], - 'px.myproxy-yaim' => [ qw// ], - 'px.myproxy-config' => [], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', - lb => 'lb.glite-LB', - px => 'px.glite-PX', - proxyrenewal => 'px.proxyrenewal' -); - -%obsoletes = ( - 'lb.yaim' => [ qq/glite-yaim-lb/ ], - 'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ], - 'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ], - 'px.myproxy-config' => [ qq/myproxy-config/ ], # in myproxy-config.spec - 'lbjp-common.gss' => [ qq/glite-security-gss/ ], - 'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ], - 'lb.glite-LB' => [ qq/glite-LB/ ], - 'px.glite-PX' => [ qq/glite-PX/ ], -); - -%cvs_prefix = ( - 'lb' => 'org.glite', - 'jp' => 'org.glite', - 'jobid' => 'org.glite', - 'lbjp-common' => 'org.glite', - 'gridsite' => 'org', - 'px' => 'org.glite', -); - -%cvs_tag_prefix = ( - 'lb' => 'glite-', - 'jp' => 'glite-', - 'jobid' => 'glite-', - 'lbjp-common' => 'glite-', - 'gridsite' => '', - 'px' => 'glite-', -); - -# ==== projects specification ==== -# etics_name ........... ETICS project name -# conf_prefix .......... ETICS configurations name prefix -# tag_prefix ........... VCS tag prefix -# local_prefix ......... prefix (relative to stage) -# etics_externs ........ ETICS modules names of externals -# (${NAME.location}, ETICS conf. dependencies) -# etics_projects ....... ETICS project names of externals -# etics_externs_devel .. ETICS modules names of devel versions of externals -# need_externs_aux ..... project-specific external dependencies -# supported_platforms .. platforms supported by the project -%projects = ( - glite => { - etics_name => 'org.glite', - conf_prefix => { %cvs_tag_prefix }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour=${globus.thr.flavor} --nothrflavour=${globus.nothr.flavor}', - local_prefix => '', - etics_externs => { - globus_essentials=>'vdt_globus_essentials', - globus=>'globus', - gridsite=>'org.gridsite.shared', - yaim_core=>'org.glite.yaim.core', - gip_release=>'glite-info-provider-release', - gip_service=>'glite-info-provider-service', - bdii=>'bdii', - glite_version=>'glite-version', - glite_info_templates=>'glite-info-templates', - glue_schema=>'glue-schema', - trustmanager=>'org.glite.security.trustmanager', - axis=>'axis', - lcas=>'org.glite.security.lcas', - gsoapxx=>'-', - build_common_cpp=>'org.glite.build.common-cpp', - }, - etics_externs_devel => { - gridsite=>'org.gridsite.devel', - }, - etics_projects => { - vdt=>[qw/globus globus_essentials gpt/], - 'org.glite'=>[qw/voms gridsite lcas gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R gpt:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R/ ], - }, - }, - - emi => { - etics_name => 'emi', - conf_prefix => { - 'lb' => 'emi-', - 'jp' => 'emi-', - 'jobid' => 'emi-', - 'lbjp-common' => 'emi-', - 'gridsite' => '', - 'px' => 'emi-', - }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour= --nothrflavour=', - local_prefix => '/usr', - etics_externs => { - globus_essentials=>'globus-gssapi-gsi', - globus=>'globus-gssapi-gsi-devel', - gridsite=>'emi.gridsite.shared', - yaim_core=>'emi.yaim.yaim-core', - yaim_bdii=>'emi.bdii.yaim-bdii', - gip_release=>'emi.bdii.glite-info-provider-release', - gip_service=>'emi.bdii.glite-info-provider-service', - bdii=>'emi.bdii.bdii-core', - glite_version=>'emi.misc.glite-version', - glue_schema=>'emi.bdii.glue-schema', - trustmanager=>'emi.java-security.trustmanager', - trustmanager_axis=>'emi.java-security.trustmanager-axis', - axis=>'axis1.4', - lcas=>'emi.sac.lcas', - gsoapxx=>'-', - build_common_cpp=>'emi.misc.glite.build-common-cpp', - }, - etics_externs_devel => { - cares => 'c-ares-devel', - classads => 'classads-devel', - cppunit => 'cppunit-devel', - expat => 'expat-devel', - gsoap => 'gsoap-devel', - voms => 'org.glite.security.voms-api', - libtar => 'libtar-devel', - log4c => 'log4c-devel', - postgresql => 'postgresql-devel', - curl => 'curl-devel', - libxml2 => 'libxml2-devel', - openssl => 'openssl-devel', - gridsite=>'emi.gridsite.devel', - }, - etics_projects => { - 'emi'=>[qw/voms voms-devel gridsite lcas gip_release gip_service bdii glite_version glue_schema yaim_core yaim_bdii trustmanager trustmanager_axis/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager trustmanager_axis libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gip_release:R gip_service:R bdii:R glite_version:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - }, - supported_platforms => { - sl5_x86_64_gcc412EPEL => 1, - sl5_ia32_gcc412EPEL => 1, - }, - }, -); - -%platform_properties = ( - 'gridsite.core' => { - sl5_x86_64_gcc412 => { aprSuffix => '1' }, - sl5_ia32_gcc412 => { aprSuffix => '1' }, - sl5_x86_64_gcc412EPEL => { aprSuffix => '1' }, - sl5_ia32_gcc412EPEL => { aprSuffix => '1' }, - deb5_x86_64_gcc432 => { aprSuffix => '1.0' }, - deb5_ia32_gcc432 => { aprSuffix => '1.0' }, - slc4_x86_64_gcc346 => { aprSuffix => '0' }, - slc4_ia32_gcc346 => { aprSuffix => '0' }, - default => { - } - }, - 'jobid.api-java' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.types' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.doc' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.ws-interface' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.myproxy-config' => { - default => { 'package.buildarch' => 'noarch' }, - }, -); - -my @k = keys %deps_aux; -@buildroot{@k} = ('') x ($#k+1); - -$buildroot{'gridsite.core'} = 'src'; -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.logger-msg lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB -lbjp-common.gss lbjp-common.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface lbjp-common.gss lbjp-common.gsoap-plugin -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $top_srcdir = '.'; - my $build = ''; - - if ($module) { - $top_srcdir = $0; - $top_srcdir =~ s,/?[^/]*$,,; - $top_srcdir =~ s,^$,\.,; - } else { - $build = "$full/"; - unless ($buildroot{$_} eq '') { - $top_srcdir = '..'; - $build .= "$buildroot{$_}/"; - unless (-d "$build") { - mkdir "$build" or die "mkdir $build: $!\n"; - } - } - } - unless ($top_srcdir eq '.') { - unlink $build."Makefile"; - symlink "$top_srcdir/Makefile",$build."Makefile" or die "symlink $top_srcdir/Makefile ".$build."Makefile: $!\n"; - for my $file ('.pre', '.post', '.preun', '.postun changelog') { - my $pfile = "project/$file"; - if (-f "$full/$pfile") { - mkdir "$build/project" unless (-d "$build/project"); - unlink $build.$pfile; - symlink "../$top_srcdir/$pfile", $build.$pfile or die "symlink ../$top_srcdir/$pfile ".$build."$pfile: $!\n"; - } - } - } - - open MKINC,">".$build."Makefile.inc" - or die $build."Makefile.inc: $!\n"; - - print "Creating ".$build."Makefile.inc\n"; - - print MKINC qq{project = $project -PREFIX = $root -prefix = $prefix -stagedir = $stagedir -sysroot = $sysroot -sysconfdir = $sysconfdir -localstatedir = $localstatedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -libdir = $libdir -top_srcdir = $top_srcdir -}; - - for (@{$need_externs{$short}}) { - next unless defined $externs{$_} and defined $externs{$_}{prefix}; - print MKINC "${_}_prefix = $externs{$_}{prefix}\n"; - print MKINC "$externs{$_}{flags}" if defined $externs{$_}{flags}; - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -BEGIN{ -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - my $path = "$cvs_prefix{$subsys}.$subsys.$module/project"; - if ($subsys eq 'gridsite') { - $path = "$cvs_prefix{$subsys}.$subsys.core/project"; - } - open V,"$path/version.properties" - or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{$project{etics_name}}}} = (1) x ($#{$etics_projects{$project{etics_name}}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/ and (defined $externs{$_} or defined $jar{$_})) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - next if ($eext eq '-'); - if ($project ne 'glite') { - if ($ge{$_} and not defined $externs{$_}{pkg}) { - push @copts, "--with-$_=\${stageDir}"; - } - } else { - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - } - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}$jar{$_}" if ($project eq 'glite'); - } - - my $conf; - my $conftag; - my ($confprefix, $nameprefix); - - $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n"; - - $confprefix = $project{conf_prefix}{$subsys}; - $nameprefix = $confprefix; - $nameprefix =~ s/-$//; - $nameprefix =~ s/-/\./g; - - if ($branch) { - $conf = "$confprefix${subsys}-${module}_$branch"; - $conftag = $branch; - # forced low age number - $age = $branch eq 'HEAD' ? '0head' : '0dev'; } - else { - $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - -# XXX: gridsite hack - $conftag = $subsys eq 'gridsite' ? "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : - "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; } - - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"}; - - my $confdir = $buildroot{"$subsys.$module"} eq '' ? '.' : '..'; - - my $package_description = ""; - my $package_summary = ""; - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description"; - $package_description = join ("", ); - close V; - chomp $package_description; - $package_description =~ s/\n/\\n/g; - $package_description = "package.description = $package_description\n"; - } - else { - print STDERR "package.description not found for $subsys.$module!\n"; } - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary"; - $package_summary = join ("", ); - close V; - chomp $package_summary; - $package_summary =~ s/\n/\\n/g; - $package_summary = "package.summary = $package_summary\n"; - } - else { - print STDERR "package.summary not found for $subsys.$module!\n"; } - - my %cmd; - @cmd{qw/configure compile test install packaging clean/} = ('None') x 6; - $cmd{clean} = 'make clean'; - $cmd{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_prefix{$subsys}.$subsys.$module 2>/dev/null"; - #$cmd{checkout} = "(test -d \${moduleName}/.git && (cd \${moduleName}; git pull) || git clone http://scientific.zcu.cz/git/jra1mw.git \${moduleName})"; - #$cmd{checkout} .= " && (cd \${moduleName}; git checkout ${tag})" unless ($conftag =~ /HEAD/); - $cmd{tag} = "cvs -d \${vcsroot} tag -R \${tag} ${moduleName}"; - - if ($subsys eq 'gridsite') { - $cmd{tag} = 'None'; - - if ($module eq 'core') { - my ($flags, $prefix); - - if ($project ne 'glite') { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=`pkg-config gsoap --variable=prefix` OPENSSL_GLOBUS_FLAGS=`pkg-config globus-openssl --cflags` OPENSSL_GLOBUS_LIBS=`pkg-config globus-openssl --libs` FLAVOR_GLOBUS_EXT= HTTPD_FLAGS="-I/usr/include/httpd -I/usr/include/apache2 -I/usr/include/apr-${aprSuffix} -I/usr/include/pcre"'; - $prefix = "prefix=${prefix}/usr"; - } else { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"'; - $prefix = "prefix=${prefix}"; - } - - $cmd{compile} = "echo 'make $flags' > build.sh\n\tmake $flags build"; - $cmd{clean} = "rm -rvf build.sh; $cmd{clean}"; - $cmd{install} = "make $prefix $flags install"; - $cmd{packaging} = "make $prefix $flags rpm"; - } - else { - $cmd{clean} = 'None'; - $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this"; - $cmd{checkout} = "mkdir -v \${moduleName} 2>/dev/null || true"; - } - } - elsif ($subsys eq 'px' and $module eq 'myproxy-config') { - $cmd{configure} = "/usr/bin/perl $confdir/configure --root=\${prefix} --prefix= --stage=\${stageDir} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{packaging} = "make rpm package=".$confprefix."$subsys-myproxy-config"; - } - else { - $cmd{configure} = "/usr/bin/perl $confdir/configure $project{flavours} --root=\${prefix} --prefix=$project{local_prefix} --stage=\${stageDir} --sysroot=\${package.prefix} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{compile} = 'make'; - $cmd{test} = 'make check'; - $cmd{install} = 'make install'; - } - - my $defprops = ''; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) { - $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n"; - } - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = $project{etics_name}.$subsys.$module -displayName = $conf -description = $cvs_prefix{$subsys}.$subsys.$module -projectName = $project{etics_name} -age = $age -deploymentType = None -vcsroot = :pserver:anonymous\@glite.cvs.cern.ch:/cvs/glite -tag = $conftag -version = $major.$minor.$rev -$dwpath -[Platform-default:VcsCommand] -displayName = None -description = None -tag = $cmd{tag} -branch = None -commit = None -checkout = $cmd{checkout} - -[Platform-default:BuildCommand] -postpublish = None -packaging = $cmd{packaging} -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = $cmd{compile} -init = None -install = $cmd{install} -clean = $cmd{clean} -test = $cmd{test} -configure = $cmd{configure} -checkstyle = None - -[Platform-default:Property] -$buildroot -aprSuffix = 0 -package.RPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/SRPMS -package.preserve.libtool = false -$package_description$package_summary$defprops}; - - for (@{$obsoletes{"$subsys.$module"}}) { - print C "package.obsoletes = $_\n"; - print C "package.replaces = $_\n"; - } - - for my $pp (keys %{$platform_properties{"$subsys.$module"}}) { - next if $pp eq 'default'; - next if exists $project{supported_platforms} and not exists $project{supported_platforms}{$pp}; - - print C "[Platform-$pp:Property]\n$buildroot\n"; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) { - print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n"; - } - print C "package.RPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/SRPMS\n"; - print C "$package_description$package_summary\n"; - } - - print C qq{ -[Platform-default:DynamicDependency] -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - my $edev = $project{etics_externs_devel}{$_}; - next if ($eext eq '-'); - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - - if ($edev) { - if ($type eq 'B') { - $eext = $edev; # no runtime - change to devel pkg - } elsif ($type eq 'BR' or $type eq 'RB') { - print C "$proj|$edev = B\n"; # additional devel pkg - } - } - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "$project{etics_name}|$project{etics_name}.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$externs{gsoap}{prefix}/bin/soapcpp2 -v 2>&1 |" or die "$externs{gsoap}{prefix}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - $gsoap_version = $1 if /The gSOAP code generator for C and C\+\+, soapcpp2 release ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - -sub getlibdir { - if ( -e "/etc/debian_version") { # We are on Debian - $lib64="lib"; - $lib32="lib32"; } - else { # Another distribution - $lib64="lib64"; - $lib32="lib"; } - $libdir=$lib32; - - open INP, "uname -s | "; # Check kernel name - $kname= ; - chomp($kname); - close INP; - - if ( $kname eq "Linux") { - $arch = ("x86_64\npowerpc\nppc64\n"); - - open INP, "uname -p | "; # Check processor type - $procname= ; - chomp($procname); - close INP; - - if ($arch =~/^$procname\n/) { - return ($lib64); } - - open INP, "uname -m | "; # Check machine hardware - $machname= ; - chomp($machname); - close INP; - - if ($arch =~/^$machname\n/) { - return ($lib64); } - - # special cases (hyperlink lib64, Debian) - if (-l "/usr/lib64") { - $libdir=$lib32; } - - # if /usr/lib64 doesn't exist at all (AIX) - unless ( -e "/usr/lib64" ) { - $libdir=$lib32; } - } - - if ( $kname eq "SunOS") { - if (-e "/usr/lib/64") { - $libdir="lib/64"; } - } - - return $libdir; -} - -sub usage { - my @ext = keys %externs; - my @myjars = keys %jar; - - print STDERR qq{ -Usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --stage=DIR staging directory [./stage] - --root=DIR installation root (custom relocation root -> sysroot) [./stage] - --sysroot=DIR system root (custom relocation root -> sysroot) [] - --sysconfdir=DIR system configuration directory [PREFIX/etc] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - --version=maj.min.rev-age specify version here instead of reading version.properties - --branch=branch CVS branch/etics name suffix (HEAD, branch_2_1, ...) - --libdir=libdir typically [lib,lib64] postfix - --project=PROJECT build or generate etics for a project (glite/emi) [emi] - --debug print more details - -Mode of operation: - --mode=\{checkout|build|etics\} what to do [build] - -What to build: - --module=module build this module only - --enable-NODE build this "node" (set of modules) only - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies (summary of what will be used is always printed): - --with-EXTERNAL=PATH where to look for an external [autodetect] - --with-JAR=JAR where to look for jars - -Available nodes: - @nodes - -Default nodes: - @default_nodes - -Externals (not all for all modules) are: - @ext - -External jars are: - @myjars - -}; - -} diff --git a/org.glite.px.glite-PX/project/ChangeLog b/org.glite.px.glite-PX/project/ChangeLog deleted file mode 100644 index 8e877bb..0000000 --- a/org.glite.px.glite-PX/project/ChangeLog +++ /dev/null @@ -1,30 +0,0 @@ -3.2.0-1 -- First regular tag - -3.2.0-2 -- Module rebuilt - -3.2.0-3 -- Module rebuilt - -3.2.1-1 -- Files contained in MP adjusted to project policies - -3.2.1-2 -- Module rebuilt - -3.2.1-3 -- Module rebuilt - -3.2.1-4 -- Module rebuilt - -3.2.2-1 -- Relocatable build directory. - -3.2.2-2 -- Module rebuilt - -3.2.2-3 -- Module rebuilt - diff --git a/org.glite.px.glite-PX/project/package.description b/org.glite.px.glite-PX/project/package.description deleted file mode 100644 index 2fc1c7b..0000000 --- a/org.glite.px.glite-PX/project/package.description +++ /dev/null @@ -1 +0,0 @@ -Metapackage to install MyProxy with gLite-specific YAIM configurations. diff --git a/org.glite.px.glite-PX/project/package.summary b/org.glite.px.glite-PX/project/package.summary deleted file mode 100644 index 5acdab1..0000000 --- a/org.glite.px.glite-PX/project/package.summary +++ /dev/null @@ -1 +0,0 @@ -Metapackage to install MyProxy with gLite-specific YAIM configurations diff --git a/org.glite.px.glite-PX/project/version.properties b/org.glite.px.glite-PX/project/version.properties deleted file mode 100644 index 0ea796c..0000000 --- a/org.glite.px.glite-PX/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=3.2.2 -module.age=3 diff --git a/org.glite.px.myproxy-yaim/Makefile b/org.glite.px.myproxy-yaim/Makefile deleted file mode 100644 index d8bda34..0000000 --- a/org.glite.px.myproxy-yaim/Makefile +++ /dev/null @@ -1,59 +0,0 @@ -top_srcdir=.. -stagedir=. -package=glite-px-myproxy-yaim -version=0.0.0 -PREFIX=/opt/glite -yaim_prefix= -sysconfdir=/opt/glite/etc - --include Makefile.inc --include ../project/version.properties - -yaim_prefix=/opt/glite -ifeq (${project},emi) -yaim_project=/emi -endif - -FILES=glite-px.pre LICENSE COPYRIGHT node-version arch service update - -all ${FILES}: - glite_var="${localstatedir}/glite"; \ - if echo "${localstatedir}" | grep 'glite'>/dev/null; then \ - glite_var="${localstatedir}"; \ - fi; \ - sed -e 's:@glite_prefix@:${sysroot}${prefix}:' -e 's:@glite_etc@:${sysconfdir}:' -e "s:@glite_var@:$$glite_var:" $(top_srcdir)/config/defaults/glite-px.pre > glite-px.pre - - # metapackage files - echo -e "${gLiteCopyrightText}\n\n${gLiteLicenseText}" > LICENSE - cp LICENSE COPYRIGHT - echo ${module.version}-${module.age} > node-version - echo ${platformArch} > arch - echo "NA" > service - echo "NA" > update - -install: ${FILES} - mkdir -p ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/functions/ - mkdir -p ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/node-info.d - mkdir -p ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/examples/siteinfo/services - mkdir -p ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/etc/versions - mkdir -p ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/defaults - install -m 0644 $(top_srcdir)/config/services/glite-px ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/examples/siteinfo/services/glite-px - for c in gip_px proxy_server ; do \ - install -m 0644 $(top_srcdir)/config/functions/config_$$c ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/functions; \ - done - install -m 0644 $(top_srcdir)/config/functions${yaim_project}/config_info_service_px ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/functions - install -m 0644 ${top_srcdir}/config/node-info.d${yaim_project}/glite-px ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/node-info.d; \ - install -m 0644 glite-px.pre ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/defaults - echo "$(package) $(module.version)-$(module.age)" > ${DESTDIR}${PREFIX}${yaim_prefix}/yaim/etc/versions/$(package) - mkdir -p ${DESTDIR}${PREFIX}${yaim_prefix}/release/glite-PX - cp -fp LICENSE COPYRIGHT node-version arch service update ${DESTDIR}${PREFIX}${yaim_prefix}/release/glite-PX/ - -stage: - $(MAKE) install PREFIX=${stagedir} - -check: - -clean: - rm -rvf log.xml rpmbuild/ RPMS/ tgz/ debian/ ${FILES} - -.PHONY: default all check install stage clean diff --git a/org.glite.px.myproxy-yaim/config/defaults/glite-px.pre b/org.glite.px.myproxy-yaim/config/defaults/glite-px.pre deleted file mode 100644 index 9416c10..0000000 --- a/org.glite.px.myproxy-yaim/config/defaults/glite-px.pre +++ /dev/null @@ -1,3 +0,0 @@ -GLITE_PX_LOCATION='@glite_prefix@' -GLITE_PX_LOCATION_ETC='@glite_etc@' -GLITE_PX_LOCATION_VAR='@glite_var@' diff --git a/org.glite.px.myproxy-yaim/config/functions/config_gip_px b/org.glite.px.myproxy-yaim/config/functions/config_gip_px deleted file mode 100755 index e7f49e8..0000000 --- a/org.glite.px.myproxy-yaim/config/functions/config_gip_px +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_gip_px -# -# DESCRIPTION : This function configures the generic information providor (GIP) -# for MyProxy (PX) node. -# -# AUTHORS : Shu-Ting.Liao@cern.ch -# -# NOTES : The config_gip_ function creates the ldif file. -# This is currently done by the function config_info_service_. -# This function is still included in the function list for cleaning tasks. -# -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## -config_gip_px_check () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_gip_px_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_gip_px () { - -CONF_DIR="$INSTALL_ROOT/glite/var/tmp/gip" -LDIF_DIR="${INSTALL_ROOT}/glite/etc/gip/ldif" - -rm -rf ${CONF_DIR}/glite-info-static-px.conf -rm -rf ${LDIF_DIR}/static-file-PX.ldif - -return 0 - -} diff --git a/org.glite.px.myproxy-yaim/config/functions/config_info_service_px b/org.glite.px.myproxy-yaim/config/functions/config_info_service_px deleted file mode 100644 index 06725d6..0000000 --- a/org.glite.px.myproxy-yaim/config/functions/config_info_service_px +++ /dev/null @@ -1,88 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_info_service_px -# -# DESCRIPTION : This function configures the dynamic service publisher -# for MyProxy (PX) node. -# -# AUTHORS : Maria.Alandes.Pradillo@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -config_info_service_px_check () { - requires $1 SITE_NAME INSTALL_ROOT PX_HOST -} - -config_info_service_px_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_info_service_px () { - -INFO_SERVICE_CONFIG=${INFO_SERVICE_CONFIG:-${INSTALL_ROOT}/glite/etc} -INFO_SERVICE_SCRIPT=${INFO_SERVICE_SCRIPT:-${INSTALL_ROOT}/glite/libexec} -INFO_PROVIDER_PATH=${INFO_PROVIDER_PATH:-${INSTALL_ROOT}/glite/etc/gip/provider} - -SERVICE=MYPROXY -SERVICE_HOST=${PX_HOST} - -SERVICE_LC=`echo ${SERVICE} | tr '[:upper:]' '[:lower:]'` - -if [ ! -f ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ]; then - yaimlog ERROR "The template file for glite-info-service-${SERVICE_LC}.conf.template was not found in ${INFO_SERVICE_CONFIG}." - exit 1 -fi - -if [ ! -f ${INFO_SERVICE_SCRIPT}/glite-info-service ]; then - yaimlog ERROR "The script file for glite-info-service was not found in ${INFO_SERVICE_SCRIPT}." - exit 1 -fi - -yaimlog DEBUG "Delete a previous version of the glite-info-service-${SERVICE_LC}.conf if it exists" -rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -yaimlog DEBUG "Create the glite-info-service-${SERVICE_LC}.conf file out of the template file" -cp ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -# Note: the configuration file may need to be altered if non standard values have been used. - -yaimlog DEBUG "Delete a previous version of the glite-info-provider-service-${SERVICE_LC}-wrapper if it exists" -rm -rf ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - -yaimlog DEBUG "Create the ${INFO_PROVIDER_PATH} in case it doesn't exist" -mkdir -p ${INFO_PROVIDER_PATH} - -yaimlog DEBUG "Create the glite-info-provider-service-${SERVICE_LC}-wrapper file" -cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper -#!/bin/sh -export PATH=$PATH:${INFO_SERVICE_SCRIPT} -export ${SERVICE}_HOST=${SERVICE_HOST} -${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf $SITE_NAME -EOF - -chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - - -return 0 - -} diff --git a/org.glite.px.myproxy-yaim/config/functions/config_proxy_server b/org.glite.px.myproxy-yaim/config/functions/config_proxy_server deleted file mode 100644 index 74596c2..0000000 --- a/org.glite.px.myproxy-yaim/config/functions/config_proxy_server +++ /dev/null @@ -1,141 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_proxy_server -# -# DESCRIPTION : This function configures the 3.0 proxy server. -# -# AUTHORS : Robert.Harakaly@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# UPDATES: Ulrich.Schwickerath@cern.ch, Steve.Traylen@cern.ch -# -############################################################################## -# -# 21/05/2008 US,ML rewrite to support more configuration options -# - -config_proxy_server_check () { - -requires $1 BDII_USER BDII_GROUP BDII_HOME_DIR X509_HOST_CERT X509_HOST_KEY -return $? - -} - -config_proxy_server_setenv () { - - yaimgridenv_set GLITE_PX_LOCATION "${GLITE_PX_LOCATION}" - yaimgridenv_set GLITE_PX_LOCATION_ETC "${GLITE_PX_LOCATION_ETC}" - yaimgridenv_set GLITE_PX_LOCATION_VAR "${GLITE_PX_LOCATION_VAR}" - - return 0 - -} - -config_proxy_server () { - -# Fix for bug 54094: BDII_USER needs copies of host cert and key -mkdir -p ${BDII_HOME_DIR}/.globus -cp ${X509_HOST_CERT} ${BDII_HOME_DIR}/.globus/usercert.pem -cp ${X509_HOST_KEY} ${BDII_HOME_DIR}/.globus/userkey.pem -chown -R ${BDII_USER}.${BDII_GROUP} ${BDII_HOME_DIR}/.globus - -# copy to the location for MyProxy -cp ${X509_HOST_CERT} /etc/grid-security/myproxy/hostcert.pem -cp ${X509_HOST_KEY} /etc/grid-security/myproxy/hostkey.pem -chown myproxy:myproxy /etc/grid-security/myproxy/hostcert.pem -chown myproxy:myproxy /etc/grid-security/myproxy/hostkey.pem - -MYPROXY_CONF=${GLITE_PX_LOCATION_ETC}/myproxy-server.config -MYPROXY_CONF_NEW=${GLITE_PX_LOCATION_ETC}/myproxy-server.config_NEW - - -# Special case where we are upgrading from the old style configuration. -# with a configuration file myproxy-server.config file. -pgrep -lf myproxy-server.config 2>&1 > /dev/null -if [ $? = "0" ] ; then - yaimlog INFO "MyProxy Running with old style configuration, stopping" - /sbin/service myproxy-server stop -fi - - -yaimlog DEBUG "Creating Minimal myproxy configuration." -cat < $MYPROXY_CONF_NEW -# YAIM generated configuration file for MyProxy -# -# We allow anyone to use this service. They are checked against the -# installed CAs anyway. -# -accepted_credentials "*" - -EOF - -if [ "x$GRID_TRUSTED_BROKERS" != "x" ] ; then - yaimlog WARNING "Use of GRID_TRUSTED_BROKERS is deprecated in YAIM, use GRID_AUTHORIZED_RENEWERS" - echo "# Adding GRID_TRUSTED_BROKERS as authorized_renewers - Deprecated" >> $MYPROXY_CONF_NEW - split_quoted_variable $GRID_TRUSTED_BROKERS | while read x; do - test "x$x" != "x" && echo "authorized_renewers \"$x\"" >> $MYPROXY_CONF_NEW - done - echo "" >> $MYPROXY_CONF_NEW -fi - -for VALUE in GRID_AUTHORIZED_RENEWERS GRID_DEFAULT_RENEWERS \ - GRID_AUTHORIZED_RETRIEVERS GRID_DEFAULT_RETRIEVERS \ - GRID_AUTHORIZED_KEY_RETRIEVERS GRID_DEFAULT_KEY_RETRIEVERS \ - GRID_TRUSTED_RETRIEVERS GRID_DEFAULT_TRUSTED_RETRIEVERS - -do - KEY=`echo $VALUE | sed 's/^GRID_//' | tr "[:upper:]" "[:lower:]"` - echo "#Adding YAIM value $VALUE if any as $KEY values" >> $MYPROXY_CONF_NEW - split_quoted_variable ${!VALUE} | while read x; do - test "x$x" != "x" && echo "$KEY \"$x\"" >> $MYPROXY_CONF_NEW - done - echo "" >> $MYPROXY_CONF_NEW -done - -/sbin/chkconfig --add myproxy-server - -# -# check if the configuration changed and reload/replace only if necessary -# - -[ -f $MYPROXY_CONF ] && diff $MYPROXY_CONF_NEW $MYPROXY_CONF 2>&1 > /dev/null -rc=$? - -if [ $rc == 0 ]; then - yaimlog INFO "MyProxy server configuration unchanged" - rm -f $MYPROXY_CONF_NEW -else - yaimlog INFO "Reloading MyProxy server" - mv $MYPROXY_CONF_NEW $MYPROXY_CONF - /etc/init.d/myproxy-server reload < /dev/null -fi - -/etc/init.d/myproxy-server status 2>&1 > /dev/null -if [ $? != "0" ] ; then - yaimlog INFO "MyProxy server not running so starting" - /etc/init.d/myproxy-server start -fi - - - -return 0 -} diff --git a/org.glite.px.myproxy-yaim/config/functions/emi/config_info_service_px b/org.glite.px.myproxy-yaim/config/functions/emi/config_info_service_px deleted file mode 100644 index 0adb827..0000000 --- a/org.glite.px.myproxy-yaim/config/functions/emi/config_info_service_px +++ /dev/null @@ -1,95 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_info_service_px -# -# DESCRIPTION : This function configures the dynamic service publisher -# for MyProxy (PX) node. -# -# AUTHORS : Maria.Alandes.Pradillo@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -config_info_service_px_check () { - requires $1 SITE_NAME INSTALL_ROOT PX_HOST -} - -config_info_service_px_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_info_service_px () { - -INFO_SERVICE_CONFIG='/etc/glite/info/service' -INFO_SERVICE_SCRIPT='/usr/bin' -INFO_PROVIDER_PATH='/var/lib/bdii/gip/provider' - -SERVICE=MYPROXY -SERVICE_HOST=${PX_HOST} - -SERVICE_LC=`echo ${SERVICE} | tr '[:upper:]' '[:lower:]'` - -if [ ! -x ${INFO_SERVICE_SCRIPT}/glite-info-service ]; then - yaimlog ERROR "The script file for glite-info-service was not found in ${INFO_SERVICE_SCRIPT}." - exit 1 -fi -if [ ! -x ${INFO_SERVICE_SCRIPT}/glite-info-glue2-simple ]; then - yaimlog ERROR "The script file for glite-info-glue2-simple was not found in ${INFO_SERVICE_SCRIPT}." - exit 1 -fi - -yaimlog DEBUG "Delete a previous version of the *.conf if it exists" -rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -yaimlog DEBUG "Create the configuration files out of the template file" -cp ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf -if [ $? != 0 ]; then - yaimlog ERROR "Copying service template failed" - exit 1 -fi -cp ${INFO_SERVICE_CONFIG}/glite-info-glue2-${SERVICE_LC}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-glue2-${SERVICE_LC}.conf -if [ $? != 0 ]; then - yaimlog ERROR "Copying glue2 service template failed" - exit 1 -fi - -# Note: the configuration file may need to be altered if non standard values have been used. - -yaimlog DEBUG "Delete a previous version of the glite-info-provider-service-${SERVICE_LC}-wrapper if it exists" -rm -rf ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - -yaimlog DEBUG "Create the ${INFO_PROVIDER_PATH} in case it doesn't exist" -mkdir -p ${INFO_PROVIDER_PATH} - -yaimlog DEBUG "Create the glite-info-provider-service-${SERVICE_LC}-wrapper file" -cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper -#!/bin/sh -export PATH=$PATH:${INFO_SERVICE_SCRIPT} -export ${SERVICE}_HOST=${SERVICE_HOST} -${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf $SITE_NAME -${INFO_SERVICE_SCRIPT}/glite-info-glue2-simple ${INFO_SERVICE_CONFIG}/glite-info-glue2-${SERVICE_LC}.conf $SITE_NAME -EOF - -chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper -return 0 - -} diff --git a/org.glite.px.myproxy-yaim/config/man/myproxy-yaim.1 b/org.glite.px.myproxy-yaim/config/man/myproxy-yaim.1 deleted file mode 100644 index e8b3824..0000000 --- a/org.glite.px.myproxy-yaim/config/man/myproxy-yaim.1 +++ /dev/null @@ -1,86 +0,0 @@ -.TH "YAIM - Yet Another Installation Manager" 1 -.SH NAME -yaim \- YAIM (YAIM Aint an Installation Manager) is, as the name suggests, a way of configuring Grid Services. -The aim of YAIM is to provide a simple installation and configuration method that can be used to set up a simple Grid Site -but can be easily adapted and extended to meet the need of larger sites. The yaim-myproxy module is configuring the MyProxy server. - -.SH DESCRIPTION -The yaim-myproxy module allows you to configure the MyProxy server. - -.SH CONFIGURATION VARIABLES -This is the list of variables needed to set up in order to configure the MyProxy server. -.TP -For more details, please check: -.TP -.B https://twiki.cern.ch/twiki/bin/view/LCG/PX_configuration_variables -.TP -.B Mandatory Variables: -Site admins must ensure these variables are properly defined according to the features of the site -.TP -site-info.def variables: These variables are defined in /opt/glite/yaim/examples/site-info.def. -.TP -INSTALL_ROOT : Installation root - change if using the re-locatable distribution. -.TP -SITE_NAME : The GIIS of the site where the MyProxy server belongs to. -.TP -GLOBUS_TCP_PORT_RANGE: Port range for Globus IO. It should be specified as "num1,num2". YAIM automatically handles the syntax of this variable depending on the version of VDT. If it's VDT 1.6 it leaves "num1,num2". If it's a version < VDT 1.6 it changes to "num1 num2". -.TP -.TP -node specific variables: These variables are defined in /opt/glite/yaim/examples/services/glite-px. -.TP -GRID_TRUSTED_BROKERS : List of the DNs of the Resource Brokers host certificates which are trusted by the Proxy node. (ex: /O=Grid/O=CERN/OU=cern.ch/CN=host/testbed013.cern.ch). Now deprecated, use GRID_DEFAULT_RENEWERS instead. -.TP -GRID_AUTHORIZED_RENEWERS : List of authorized_renewrs. -.TP -GRID_DEFAULT_RENEWERS : List of default_renewers -.TP -GRID_AUTHORIZED_RETRIEVERS : List of authorized_retrievers. -.TP -GRID_DEFAULT_RETRIEVERS : List of default_retrievers. -.TP -GRID_AUTHORIZED_KEY_RETRIEVERS : List of authorized_key_retrievers. -.TP -GRID_DEFAULT_KEY_RETRIEVERS : List default_key_retrievers. -.TP -GRID_TRUSTED_RETRIEVERS : List of trusted_retrievers. -.TP -GRID_DEFAULT_TRUSTED_RETRIEVERS List of default_trusted_retrievers. -.TP - -.SH EXAMPLES -How to configure the Myproxy node. -.TP -.B ./yaim -c -s /root/site-info.def -n glite-PX -.TP -To debug the configuration process: -.TP -.B ./yaim -c -s /root/site-info.def -n glite-PX -d 6 - -.SH DOCUMENTATION -You can find useful information on these web pages: -.TP -Entry point for YAIM documentation: -.TP -.B https://twiki.cern.ch/twiki/bin/view/EGEE/YAIM -.TP -The Generic Installation and Configuration guides as well as the YAIM guides: -.TP -.B https://twiki.cern.ch/twiki/bin/view/LCG/LcgDocs -.TP -Useful links: -.TP -.B http://lcg.web.cern.ch/LCG/Sites/the-LCG-directory.html - -.SH AUTHORS -YAIM is a collaborative project where different modules are developed and maintened by different -groups. Here are some of the present contributors: -.TP -.B Maria Allandes Pradillo, Gergely Debreczeni, Laurence Field, \ -Di Qing, Andreas Unterkircher, Oliver Keeble, Steve Traylen, Owen Synge, Gavin Mccance , Maarten Litmaath, \ -and we are happy to receive patches from everybody ! - -.SH CONTACT -To contact YAIM people use the -.B yaim-contact@cern.ch -email address. - diff --git a/org.glite.px.myproxy-yaim/config/node-info.d/emi/glite-px b/org.glite.px.myproxy-yaim/config/node-info.d/emi/glite-px deleted file mode 100644 index 7f48931..0000000 --- a/org.glite.px.myproxy-yaim/config/node-info.d/emi/glite-px +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This function contains the function list that configures the 3.1 proxy server. -# -# AUTHORS : Shu-Ting.Liao@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -PX_FUNCTIONS=" -config_crl -config_host_certs -config_edgusers -config_proxy_server -config_bdii_5.2 -config_info_service_px -" - - diff --git a/org.glite.px.myproxy-yaim/config/node-info.d/glite-px b/org.glite.px.myproxy-yaim/config/node-info.d/glite-px deleted file mode 100644 index 8230ef9..0000000 --- a/org.glite.px.myproxy-yaim/config/node-info.d/glite-px +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This function contains the function list that configures the 3.1 proxy server. -# -# AUTHORS : Shu-Ting.Liao@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -PX_FUNCTIONS=" -config_crl -config_host_certs -config_edgusers -config_gip_only -config_gip_px -config_gip_service_release -config_globus_clients -config_proxy_server -config_bdii_only -config_info_service_px -" - - diff --git a/org.glite.px.myproxy-yaim/config/node-info.d/glite-px_30 b/org.glite.px.myproxy-yaim/config/node-info.d/glite-px_30 deleted file mode 100644 index 260ce8f..0000000 --- a/org.glite.px.myproxy-yaim/config/node-info.d/glite-px_30 +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This function contains the function list that configures the 3.0 proxy server. -# -# AUTHORS : Robert.Harakaly@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -BASE1_FUNCTIONS=" -config_ldconf -config_sysconfig_edg -config_sysconfig_globus -config_sysconfig_lcg -config_crl -config_rfio" - -PX_FUNCTIONS="${BASE1_FUNCTIONS} -config_host_certs -config_edgusers -config_java -config_rgma_client -config_gip -config_globus -config_proxy_server" - diff --git a/org.glite.px.myproxy-yaim/config/services/glite-px b/org.glite.px.myproxy-yaim/config/services/glite-px deleted file mode 100644 index cd80a88..0000000 --- a/org.glite.px.myproxy-yaim/config/services/glite-px +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This configuration file contains the list of variables needed -# to configure Myproxy together with site-info.def. -# -# AUTHORS : yaim-contact@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -# GRID_TRUSTED_BROKERS: DNs of services (RBs) allowed to renew/retrives -# credentials from/at the myproxy server. Put single quotes around each trusted DN !!! - -# Deprecated -#GRID_TRUSTED_BROKERS=" -#'broker one' -#'broker two' -#" - - -GRID_AUTHORIZED_RENEWERS=${GRID_AUTHORIZED_RENEWERS:-""} -# WMS has traditionally used this next one. -GRID_DEFAULT_RENEWERS=${GRID_DEFAULT_RENEWERS:-""} -GRID_AUTHORIZED_RETRIEVERS=${GRID_AUTHORIZED_RETRIEVERS:-""} -GRID_DEFAULT_RETRIEVERS=${GRID_DEFAULT_RETRIEVERS:-""} -GRID_AUTHORIZED_KEY_RETRIEVERS=${GRID_AUTHORIZED_KEY_RETRIEVERS:-""} -GRID_DEFAULT_KEY_RETRIEVERS=${GRID_DEFAULT_KEY_RETRIEVERS:-""} - -# This is what NCG nagios solution uses this next one. -GRID_TRUSTED_RETRIEVERS=${GRID_TRUSTED_RETRIEVERS:-""} -GRID_DEFAULT_TRUSTED_RETRIEVERS=${GRID_DEFAULT_TRUSTED_RETRIEVERS:-""} - - diff --git a/org.glite.px.myproxy-yaim/configure b/org.glite.px.myproxy-yaim/configure deleted file mode 100755 index 96cd3e0..0000000 --- a/org.glite.px.myproxy-yaim/configure +++ /dev/null @@ -1,1353 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = '/usr'; -my $stagedir = undef; -my $root = $pwd.'/stage'; -my $sysroot = ''; -my $sysconfdir; -my $localstatedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $branch; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $jobid_tag = ''; -my $libdir = getlibdir(); -my $project = 'glite'; -my (%projects, %project); -my $debug = 0; -my $pkg_config_env = (defined $ENV{PKG_CONFIG_PATH}) ? "$ENV{PKG_CONFIG_PATH}:" : ''; - -my @nodes = qw/client server logger logger-msg utils client-java doc ws-test db jpprimary jpindex jpclient harvester lb px proxyrenewal/; -my @default_nodes = qw/lb px proxyrenewal/; -my %enable_nodes; -my %disable_nodes; -my %default_nodes; @default_nodes{@default_nodes} = (1) x ($#default_nodes + 1); - -# key: internal package name (arguments, ...) -# 'pkg': pkg-config name -# 'prefix': used when pkg-config fails -my %externs = ( - cares => { - prefix => '/opt/c-ares', - pkg => 'libcares' - }, - classads => { - prefix=> '/usr', - pkg => 'classads' - }, - cppunit => { - prefix=> '/usr', - pkg => 'cppunit' - }, - expat => { - prefix=> '/usr', - pkg => 'expat' - }, - globus => { - prefix=> '/opt/globus', - pkg => 'globus-gssapi-gsi' - }, - 'myproxy-devel' => { - prefix=> '/opt/globus', - pkg => 'myproxy' - }, - 'myproxy-server' => { - prefix=> '', - }, - 'myproxy-libs' => { - prefix=> '', - }, - 'myproxy-admin' => { - prefix=> '', - }, - gsoap => { - prefix=> '/usr', - pkg => 'gsoap' - }, - gsoapxx => { - prefix=> '/usr', - pkg => 'gsoap++' - }, - mysql => { - prefix=> '/usr' - }, - 'mysql-devel' => { - prefix=> '' - }, - 'mysql-server' => { - prefix => '' - }, - voms => { - prefix => '/opt/glite', - pkg => 'voms-2.0' - }, - gridsite => { - prefix => '/opt/glite' - }, - lcas => { - prefix => '/opt/glite', - pkg => 'lcas' - }, - trustmanager => { - prefix => '/opt/glite' - }, - trustmanager_axis => { - prefix => '/opt/glite' - }, - utiljava => { - prefix=> '/opt/glite' - }, - ant => { - prefix=> '/usr' - }, - jdk => { - prefix=> '/usr/java/latest' - }, - libtar => { - prefix=> '/usr' - }, - axis => { - prefix=> '/usr' - }, - log4c => { - prefix=> '/usr' - }, - postgresql => { - prefix=> '/usr' - }, - activemq => { - prefix=>'/opt/activemq-cpp-library', - pkg => 'activemq-cpp' - }, - apr => { - prefix=>'/opt/apr', - pkg => 'apr-1' - }, - aprutil => { - prefix=>'/opt/apr-util', - pkg => 'apr-util-1' - }, -); - -my %jar = ( - 'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar', - 'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %buildroot; -my (%etics_externs, %etics_projects); - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim glite-LB logger-msg/], - 'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - 'gridsite' => [ qw/apache shared commands core devel slashgrid services service-clients gsexec/ ], - 'px' => [ qw/proxyrenewal glite-PX myproxy-yaim/ ], - ); - - -my @opts = ( - 'prefix:s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour:s' => \$thrflavour, - 'nothrflavour:s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'branch=s' => \$branch, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'root:s' => \$root, - 'sysroot:s' => \$sysroot, - 'sysconfdir=s' => \$sysconfdir, - 'localstatedir=s' => \$localstatedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, - 'libdir=s' => \$libdir, - 'project=s' => \$project, - 'debug' => \$debug, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$externs{$_}{withprefix} for keys %externs; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; -$prefix=~s/\/$//; -$stagedir=~s/\/$// if ($stagedir); -$root=~s/\/$//; -$sysroot=~s/\/$//; -if (not $sysconfdir) { $sysconfdir = $prefix eq '/usr' ? '/etc' : "$prefix/etc"; } -if (not $localstatedir) { $localstatedir = $prefix eq '/usr' ? '/var' : "$prefix/var"; } -$sysconfdir=~s/\/$//; -$localstatedir=~s/\/$//; - -$externs{'mysql-server'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-server'}{prefix} eq ''; -$externs{'mysql-devel'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-devel'}{prefix} eq ''; -$externs{'gsoapxx'}{prefix}=$externs{gsoap}{prefix} if $externs{'gsoapxx'}{prefix} eq ''; - -%project = %{$projects{$project}}; -for $_ (keys %{$project{etics_externs}}) { - $etics_externs{$_} = $project{etics_externs}{$_}; -} -for $_ (keys %{$project{etics_projects}}) { - $etics_projects{$_} = $project{etics_projects}{$_}; -} -for $_ (keys %{$project{need_externs_aux}}) { - $need_externs_aux{$_} = $project{need_externs_aux}{$_}; -} -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - my ($pkg, $type) =/([^:]*)(?::(.*))?/; - $type = 'BR' unless ($type); - - push @{$need_externs{$ext}},$pkg; - $need_externs_type{$ext}->{$pkg} = $type; - } -} - - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my $name_prefix = ($listmodules eq 'gridsite' and $project eq 'glite') ? 'org' : $project{etics_name}; - my @m = map "$name_prefix.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version, --branch and --output make sense only in --mode=etics\n" - if ($version || $output || $branch) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless ($disable_nodes{$_} or not $default_nodes{$_}); - } -} - -if (!$en && !$dis) { for (@nodes) { $enable_nodes{$_} = 1 if ($default_nodes{$_}) } }; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $root unless $stagedir; - -if ($mode eq 'build') { for my $ext (keys %externs) { - if (defined $externs{$ext} and defined $externs{$ext}{withprefix}) { $externs{$ext}{prefix} = $externs{$ext}{withprefix}; } - elsif (defined $externs{$ext}{pkg}) { - my ($flag, $env, $cmd, $ret); - my $pkg = $externs{$ext}{pkg}; - my $flagname = uc $externs{$ext}{pkg}; - $flagname =~ s/-[0-9\.]*$//; - $flagname =~ y/-\+/_X/; - - print "Checking $pkg ... "; - $env = "PKG_CONFIG_PATH=$pkg_config_env$stagedir$prefix/$libdir/pkgconfig"; - $cmd = "$env pkg-config $pkg --exists >/dev/null"; - `$cmd`; $ret = $?; - print "('$cmd' => $ret)\n" if ($debug); - if ($ret == 0) { - $externs{$ext}{prefix}=`$env pkg-config $pkg --variable=prefix`; - chomp $externs{$ext}{prefix}; - print "$externs{$ext}{prefix}\n"; - - $flag=`$env pkg-config $pkg --cflags`; - $externs{$ext}{flags} .= "${flagname}_CFLAGS=$flag" if ($flag); - $flag=`$env pkg-config $pkg --libs`; - $externs{$ext}{flags} .= "${flagname}_LIBS=$flag" if ($flag); - } else { - print "(using default $externs{$ext}{prefix})\n"; - } - print "\n" if ($debug); - } - elsif ($ext eq 'jdk') { - my $jdk_prefix; - - print "Looking for some caffein ... "; - if (defined $ENV{'JDK_HOME'}) { - $jdk_prefix = $ENV{'JDK_HOME'}; - print "JDK_HOME=$jdk_prefix\n"; - } elsif (defined $ENV{'JAVA_HOME'}) { - $jdk_prefix = $ENV{'JAVA_HOME'}; - print "JAVA_HOME=$jdk_prefix\n"; - } else { - print "(using default $externs{$ext}{prefix}))\n" - } - $externs{$ext}{prefix} = $jdk_prefix if ($jdk_prefix); - } -} } - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - for ('JDK_HOME', 'JAVA_HOME', 'PKG_CONFIG_PATH') { - print CONF "$_=$ENV{$_} " if (defined $ENV{$_}); - } - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - print "Mode: "; print $module ? "single module" : "multiple modules"; print "\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: ".($externs{$_}{prefix}?$externs{$_}{prefix}:'-')."\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - for (@ext) { if (defined($externs{$_}{flags})) { print "$externs{$_}{flags}"; } }; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - if ($module) { - print "Not creating summary Makefile\n" if $debug; - } else { - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean check:\n"; - - for (@modules) { - my $full = full($_); - print MAK "\tcd $full/$buildroot{$_} && \${MAKE} \$@\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $buildroot{$_} eq '' ? - "\tcd $full && \${MAKE} distclean\n" : - "\trm -rf $full/$buildroot{$_}\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $buildroot{$_}; - - print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; - } -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%etics_externs = ( - 'myproxy-devel'=>'myproxy-devel', - 'myproxy-libs'=>'myproxy-libs', - 'myproxy-server'=>'myproxy-server', - 'myproxy-admin'=>'myproxy-admin', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - utiljava=>'org.glite.security.util-java', - gpt=>'gpt', - fetchcrl=>'fetch-crl', - activemq=>'activemq-cpp-library', - apr=>'apr-dev', - aprutil=>'aprutil-dev', -); - -%etics_projects = ( -); - -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads libtool:B/ ], - 'lb.common' => [ qw/expat cares:B cppunit:B classads libtool:B/ ], - 'lb.doc' => [ qw/tetex-latex:B/ ], - 'lb.logger' => [ qw/cppunit:B libtool:B/ ], - 'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B/ ], - 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite bison:B libtool:B/ ], - 'lb.state-machine' => [ qw/classads libtool:B/ ], - 'lb.utils' => [ qw/cppunit:B libtool:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B libtool:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/docbook-utils:B libtool:B/ ], - 'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.log' => [ qw/log4c libtool:B/ ], - 'lbjp-common.maildir' => [ qw/libtool:B/ ], - 'lbjp-common.server-bones' => [ qw/libtool:B/ ], - 'lbjp-common.trio' => [ qw/cppunit:B libtool:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B libtool:B/ ], - 'lbjp-common.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap gsoapxx libtool:B/ ], - 'jobid.api-c' => [ qw/cppunit:B libtool:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], - 'gridsite.core' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2 openssl:B build_common_cpp:B doxygen:B/ ], - 'gridsite.commands' => [ qw/curl:R openssl:R/ ], - 'gridsite.apache' => [ qw/libxml2:R openssl:R curl:R/ ], - 'gridsite.shared' => [ qw/libxml2:R openssl:R/ ], - 'gridsite.devel' => [], - 'gridsite.slashgrid' => [ qw/curl:R fuse-libs:R fuse:R/], - 'gridsite.services' => [ qw/curl:R gsoap:R/ ], - 'gridsite.service-clients' => [ qw/curl:R gsoap:R gsoapxx:R/ ], - 'gridsite.gsexec' => [ qw// ], - 'px.proxyrenewal' => [ qw/globus:B globus_essentials:R myproxy-devel:B myproxy-libs:R voms libtool:R/ ], - 'px.myproxy-config' => [ qw/myproxy-admin:R/ ], # in myproxy-config.spec -); - -%need_jars = ( - 'jobid.api-java' => [ qw/jakarta-commons-codec/ ], - 'lb.client-java' => [ qw/jakarta-commons-lang/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp:B jobid.api-c - lbjp-common.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - lb.ws-interface:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp:B jobid.api-c - lb.types:B lbjp-common.trio lbjp-common.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - lbjp-common.log - jobid.api-c - lb.common - lbjp-common.gss - / ], - 'lb.logger-msg' => [ qw/ - lb.logger - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log - jobid.api-c - lbjp-common.gsoap-plugin lbjp-common.gss - / ], - 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface lbjp-common.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/lbjp-common.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/ - jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client - lbjp-common.gss lbjp-common.log - / ], - 'lb.yaim' => [ qw// ], - 'lb.glite-LB' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - lb.logger-msg:R - / ], - 'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.log' => [ qw// ], - 'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ], - 'lbjp-common.trio' => [ qw// ], - 'lbjp-common.gss' => [ qw// ], - 'lbjp-common.gsoap-plugin' => [ qw/lbjp-common.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - lbjp-common.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], - - 'gridsite.core' => [ qw// ], - 'gridsite.commands' => [ qw/gridsite.shared:R/ ], - 'gridsite.apache' => [ qw/gridsite.shared:R/ ], - 'gridsite.shared' => [ qw// ], - 'gridsite.devel' => [ qw/gridsite.shared:R/ ], - 'gridsite.slashgrid' => [ qw/gridsite.shared:R/], - 'gridsite.services' => [ qw/gridsite.shared:R/ ], - 'gridsite.service-clients' => [ qw/gridsite.shared:R/ ], - 'gridsite.gsexec' => [ qw// ], - - 'px.proxyrenewal' => [ qw// ], - 'px.glite-PX' => [qw/px.myproxy-yaim:R/], - 'px.myproxy-yaim' => [ qw// ], - 'px.myproxy-config' => [], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', - lb => 'lb.glite-LB', - px => 'px.glite-PX', - proxyrenewal => 'px.proxyrenewal' -); - -%obsoletes = ( - 'lb.yaim' => [ qq/glite-yaim-lb/ ], - 'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ], - 'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ], - 'px.myproxy-config' => [ qq/myproxy-config/ ], # in myproxy-config.spec - 'lbjp-common.gss' => [ qq/glite-security-gss/ ], - 'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ], - 'lb.glite-LB' => [ qq/glite-LB/ ], - 'px.glite-PX' => [ qq/glite-PX/ ], -); - -%cvs_prefix = ( - 'lb' => 'org.glite', - 'jp' => 'org.glite', - 'jobid' => 'org.glite', - 'lbjp-common' => 'org.glite', - 'gridsite' => 'org', - 'px' => 'org.glite', -); - -%cvs_tag_prefix = ( - 'lb' => 'glite-', - 'jp' => 'glite-', - 'jobid' => 'glite-', - 'lbjp-common' => 'glite-', - 'gridsite' => '', - 'px' => 'glite-', -); - -# ==== projects specification ==== -# etics_name ........... ETICS project name -# conf_prefix .......... ETICS configurations name prefix -# tag_prefix ........... VCS tag prefix -# local_prefix ......... prefix (relative to stage) -# etics_externs ........ ETICS modules names of externals -# (${NAME.location}, ETICS conf. dependencies) -# etics_projects ....... ETICS project names of externals -# etics_externs_devel .. ETICS modules names of devel versions of externals -# need_externs_aux ..... project-specific external dependencies -# supported_platforms .. platforms supported by the project -%projects = ( - glite => { - etics_name => 'org.glite', - conf_prefix => { %cvs_tag_prefix }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour=${globus.thr.flavor} --nothrflavour=${globus.nothr.flavor}', - local_prefix => '', - etics_externs => { - globus_essentials=>'vdt_globus_essentials', - globus=>'globus', - gridsite=>'org.gridsite.shared', - yaim_core=>'org.glite.yaim.core', - gip_release=>'glite-info-provider-release', - gip_service=>'glite-info-provider-service', - bdii=>'bdii', - glite_version=>'glite-version', - glite_info_templates=>'glite-info-templates', - glue_schema=>'glue-schema', - trustmanager=>'org.glite.security.trustmanager', - axis=>'axis', - lcas=>'org.glite.security.lcas', - gsoapxx=>'-', - build_common_cpp=>'org.glite.build.common-cpp', - }, - etics_externs_devel => { - gridsite=>'org.gridsite.devel', - }, - etics_projects => { - vdt=>[qw/globus globus_essentials gpt/], - 'org.glite'=>[qw/voms gridsite lcas gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R gpt:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R/ ], - }, - }, - - emi => { - etics_name => 'emi', - conf_prefix => { - 'lb' => 'emi-', - 'jp' => 'emi-', - 'jobid' => 'emi-', - 'lbjp-common' => 'emi-', - 'gridsite' => '', - 'px' => 'emi-', - }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour= --nothrflavour=', - local_prefix => '/usr', - etics_externs => { - globus_essentials=>'globus-gssapi-gsi', - globus=>'globus-gssapi-gsi-devel', - gridsite=>'emi.gridsite.shared', - yaim_core=>'emi.yaim.yaim-core', - yaim_bdii=>'emi.bdii.yaim-bdii', - gip_release=>'emi.bdii.glite-info-provider-release', - gip_service=>'emi.bdii.glite-info-provider-service', - bdii=>'emi.bdii.bdii-core', - glite_version=>'emi.misc.glite-version', - glue_schema=>'emi.bdii.glue-schema', - trustmanager=>'emi.java-security.trustmanager', - trustmanager_axis=>'emi.java-security.trustmanager-axis', - axis=>'axis1.4', - lcas=>'emi.sac.lcas', - gsoapxx=>'-', - build_common_cpp=>'emi.misc.glite.build-common-cpp', - }, - etics_externs_devel => { - cares => 'c-ares-devel', - classads => 'classads-devel', - cppunit => 'cppunit-devel', - expat => 'expat-devel', - gsoap => 'gsoap-devel', - voms => 'org.glite.security.voms-api', - libtar => 'libtar-devel', - log4c => 'log4c-devel', - postgresql => 'postgresql-devel', - curl => 'curl-devel', - libxml2 => 'libxml2-devel', - openssl => 'openssl-devel', - gridsite=>'emi.gridsite.devel', - }, - etics_projects => { - 'emi'=>[qw/voms voms-devel gridsite lcas gip_release gip_service bdii glite_version glue_schema yaim_core yaim_bdii trustmanager trustmanager_axis/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager trustmanager_axis libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gip_release:R gip_service:R bdii:R glite_version:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - }, - supported_platforms => { - sl5_x86_64_gcc412EPEL => 1, - sl5_ia32_gcc412EPEL => 1, - }, - }, -); - -%platform_properties = ( - 'gridsite.core' => { - sl5_x86_64_gcc412 => { aprSuffix => '1' }, - sl5_ia32_gcc412 => { aprSuffix => '1' }, - sl5_x86_64_gcc412EPEL => { aprSuffix => '1' }, - sl5_ia32_gcc412EPEL => { aprSuffix => '1' }, - deb5_x86_64_gcc432 => { aprSuffix => '1.0' }, - deb5_ia32_gcc432 => { aprSuffix => '1.0' }, - slc4_x86_64_gcc346 => { aprSuffix => '0' }, - slc4_ia32_gcc346 => { aprSuffix => '0' }, - default => { - } - }, - 'jobid.api-java' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.types' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.doc' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.ws-interface' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.myproxy-config' => { - default => { 'package.buildarch' => 'noarch' }, - }, -); - -my @k = keys %deps_aux; -@buildroot{@k} = ('') x ($#k+1); - -$buildroot{'gridsite.core'} = 'src'; -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.logger-msg lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB -lbjp-common.gss lbjp-common.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface lbjp-common.gss lbjp-common.gsoap-plugin -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $top_srcdir = '.'; - my $build = ''; - - if ($module) { - $top_srcdir = $0; - $top_srcdir =~ s,/?[^/]*$,,; - $top_srcdir =~ s,^$,\.,; - } else { - $build = "$full/"; - unless ($buildroot{$_} eq '') { - $top_srcdir = '..'; - $build .= "$buildroot{$_}/"; - unless (-d "$build") { - mkdir "$build" or die "mkdir $build: $!\n"; - } - } - } - unless ($top_srcdir eq '.') { - unlink $build."Makefile"; - symlink "$top_srcdir/Makefile",$build."Makefile" or die "symlink $top_srcdir/Makefile ".$build."Makefile: $!\n"; - for my $file ('.pre', '.post', '.preun', '.postun changelog') { - my $pfile = "project/$file"; - if (-f "$full/$pfile") { - mkdir "$build/project" unless (-d "$build/project"); - unlink $build.$pfile; - symlink "../$top_srcdir/$pfile", $build.$pfile or die "symlink ../$top_srcdir/$pfile ".$build."$pfile: $!\n"; - } - } - } - - open MKINC,">".$build."Makefile.inc" - or die $build."Makefile.inc: $!\n"; - - print "Creating ".$build."Makefile.inc\n"; - - print MKINC qq{project = $project -PREFIX = $root -prefix = $prefix -stagedir = $stagedir -sysroot = $sysroot -sysconfdir = $sysconfdir -localstatedir = $localstatedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -libdir = $libdir -top_srcdir = $top_srcdir -}; - - for (@{$need_externs{$short}}) { - next unless defined $externs{$_} and defined $externs{$_}{prefix}; - print MKINC "${_}_prefix = $externs{$_}{prefix}\n"; - print MKINC "$externs{$_}{flags}" if defined $externs{$_}{flags}; - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -BEGIN{ -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - my $path = "$cvs_prefix{$subsys}.$subsys.$module/project"; - if ($subsys eq 'gridsite') { - $path = "$cvs_prefix{$subsys}.$subsys.core/project"; - } - open V,"$path/version.properties" - or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{$project{etics_name}}}} = (1) x ($#{$etics_projects{$project{etics_name}}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/ and (defined $externs{$_} or defined $jar{$_})) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - next if ($eext eq '-'); - if ($project ne 'glite') { - if ($ge{$_} and not defined $externs{$_}{pkg}) { - push @copts, "--with-$_=\${stageDir}"; - } - } else { - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - } - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}$jar{$_}" if ($project eq 'glite'); - } - - my $conf; - my $conftag; - my ($confprefix, $nameprefix); - - $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n"; - - $confprefix = $project{conf_prefix}{$subsys}; - $nameprefix = $confprefix; - $nameprefix =~ s/-$//; - $nameprefix =~ s/-/\./g; - - if ($branch) { - $conf = "$confprefix${subsys}-${module}_$branch"; - $conftag = $branch; - # forced low age number - $age = $branch eq 'HEAD' ? '0head' : '0dev'; } - else { - $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - -# XXX: gridsite hack - $conftag = $subsys eq 'gridsite' ? "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : - "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; } - - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"}; - - my $confdir = $buildroot{"$subsys.$module"} eq '' ? '.' : '..'; - - my $package_description = ""; - my $package_summary = ""; - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description"; - $package_description = join ("", ); - close V; - chomp $package_description; - $package_description =~ s/\n/\\n/g; - $package_description = "package.description = $package_description\n"; - } - else { - print STDERR "package.description not found for $subsys.$module!\n"; } - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary"; - $package_summary = join ("", ); - close V; - chomp $package_summary; - $package_summary =~ s/\n/\\n/g; - $package_summary = "package.summary = $package_summary\n"; - } - else { - print STDERR "package.summary not found for $subsys.$module!\n"; } - - my %cmd; - @cmd{qw/configure compile test install packaging clean/} = ('None') x 6; - $cmd{clean} = 'make clean'; - $cmd{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_prefix{$subsys}.$subsys.$module 2>/dev/null"; - #$cmd{checkout} = "(test -d \${moduleName}/.git && (cd \${moduleName}; git pull) || git clone http://scientific.zcu.cz/git/jra1mw.git \${moduleName})"; - #$cmd{checkout} .= " && (cd \${moduleName}; git checkout ${tag})" unless ($conftag =~ /HEAD/); - $cmd{tag} = "cvs -d \${vcsroot} tag -R \${tag} ${moduleName}"; - - if ($subsys eq 'gridsite') { - $cmd{tag} = 'None'; - - if ($module eq 'core') { - my ($flags, $prefix); - - if ($project ne 'glite') { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=`pkg-config gsoap --variable=prefix` OPENSSL_GLOBUS_FLAGS=`pkg-config globus-openssl --cflags` OPENSSL_GLOBUS_LIBS=`pkg-config globus-openssl --libs` FLAVOR_GLOBUS_EXT= HTTPD_FLAGS="-I/usr/include/httpd -I/usr/include/apache2 -I/usr/include/apr-${aprSuffix} -I/usr/include/pcre"'; - $prefix = "prefix=${prefix}/usr"; - } else { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"'; - $prefix = "prefix=${prefix}"; - } - - $cmd{compile} = "echo 'make $flags' > build.sh\n\tmake $flags build"; - $cmd{clean} = "rm -rvf build.sh; $cmd{clean}"; - $cmd{install} = "make $prefix $flags install"; - $cmd{packaging} = "make $prefix $flags rpm"; - } - else { - $cmd{clean} = 'None'; - $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this"; - $cmd{checkout} = "mkdir -v \${moduleName} 2>/dev/null || true"; - } - } - elsif ($subsys eq 'px' and $module eq 'myproxy-config') { - $cmd{configure} = "/usr/bin/perl $confdir/configure --root=\${prefix} --prefix= --stage=\${stageDir} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{packaging} = "make rpm package=".$confprefix."$subsys-myproxy-config"; - } - else { - $cmd{configure} = "/usr/bin/perl $confdir/configure $project{flavours} --root=\${prefix} --prefix=$project{local_prefix} --stage=\${stageDir} --sysroot=\${package.prefix} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{compile} = 'make'; - $cmd{test} = 'make check'; - $cmd{install} = 'make install'; - } - - my $defprops = ''; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) { - $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n"; - } - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = $project{etics_name}.$subsys.$module -displayName = $conf -description = $cvs_prefix{$subsys}.$subsys.$module -projectName = $project{etics_name} -age = $age -deploymentType = None -vcsroot = :pserver:anonymous\@glite.cvs.cern.ch:/cvs/glite -tag = $conftag -version = $major.$minor.$rev -$dwpath -[Platform-default:VcsCommand] -displayName = None -description = None -tag = $cmd{tag} -branch = None -commit = None -checkout = $cmd{checkout} - -[Platform-default:BuildCommand] -postpublish = None -packaging = $cmd{packaging} -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = $cmd{compile} -init = None -install = $cmd{install} -clean = $cmd{clean} -test = $cmd{test} -configure = $cmd{configure} -checkstyle = None - -[Platform-default:Property] -$buildroot -aprSuffix = 0 -package.RPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/SRPMS -package.preserve.libtool = false -$package_description$package_summary$defprops}; - - for (@{$obsoletes{"$subsys.$module"}}) { - print C "package.obsoletes = $_\n"; - print C "package.replaces = $_\n"; - } - - for my $pp (keys %{$platform_properties{"$subsys.$module"}}) { - next if $pp eq 'default'; - next if exists $project{supported_platforms} and not exists $project{supported_platforms}{$pp}; - - print C "[Platform-$pp:Property]\n$buildroot\n"; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) { - print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n"; - } - print C "package.RPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/$cvs_prefix{$subsys}.$subsys.$module/RPMTMP/SRPMS\n"; - print C "$package_description$package_summary\n"; - } - - print C qq{ -[Platform-default:DynamicDependency] -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - my $edev = $project{etics_externs_devel}{$_}; - next if ($eext eq '-'); - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - - if ($edev) { - if ($type eq 'B') { - $eext = $edev; # no runtime - change to devel pkg - } elsif ($type eq 'BR' or $type eq 'RB') { - print C "$proj|$edev = B\n"; # additional devel pkg - } - } - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "$project{etics_name}|$project{etics_name}.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$externs{gsoap}{prefix}/bin/soapcpp2 -v 2>&1 |" or die "$externs{gsoap}{prefix}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - $gsoap_version = $1 if /The gSOAP code generator for C and C\+\+, soapcpp2 release ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - -sub getlibdir { - if ( -e "/etc/debian_version") { # We are on Debian - $lib64="lib"; - $lib32="lib32"; } - else { # Another distribution - $lib64="lib64"; - $lib32="lib"; } - $libdir=$lib32; - - open INP, "uname -s | "; # Check kernel name - $kname= ; - chomp($kname); - close INP; - - if ( $kname eq "Linux") { - $arch = ("x86_64\npowerpc\nppc64\n"); - - open INP, "uname -p | "; # Check processor type - $procname= ; - chomp($procname); - close INP; - - if ($arch =~/^$procname\n/) { - return ($lib64); } - - open INP, "uname -m | "; # Check machine hardware - $machname= ; - chomp($machname); - close INP; - - if ($arch =~/^$machname\n/) { - return ($lib64); } - - # special cases (hyperlink lib64, Debian) - if (-l "/usr/lib64") { - $libdir=$lib32; } - - # if /usr/lib64 doesn't exist at all (AIX) - unless ( -e "/usr/lib64" ) { - $libdir=$lib32; } - } - - if ( $kname eq "SunOS") { - if (-e "/usr/lib/64") { - $libdir="lib/64"; } - } - - return $libdir; -} - -sub usage { - my @ext = keys %externs; - my @myjars = keys %jar; - - print STDERR qq{ -Usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --stage=DIR staging directory [./stage] - --root=DIR installation root (custom relocation root -> sysroot) [./stage] - --sysroot=DIR system root (custom relocation root -> sysroot) [] - --sysconfdir=DIR system configuration directory [PREFIX/etc] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - --version=maj.min.rev-age specify version here instead of reading version.properties - --branch=branch CVS branch/etics name suffix (HEAD, branch_2_1, ...) - --libdir=libdir typically [lib,lib64] postfix - --project=PROJECT build or generate etics for a project (glite/emi) [emi] - --debug print more details - -Mode of operation: - --mode=\{checkout|build|etics\} what to do [build] - -What to build: - --module=module build this module only - --enable-NODE build this "node" (set of modules) only - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies (summary of what will be used is always printed): - --with-EXTERNAL=PATH where to look for an external [autodetect] - --with-JAR=JAR where to look for jars - -Available nodes: - @nodes - -Default nodes: - @default_nodes - -Externals (not all for all modules) are: - @ext - -External jars are: - @myjars - -}; - -} diff --git a/org.glite.px.myproxy-yaim/project/ChangeLog b/org.glite.px.myproxy-yaim/project/ChangeLog deleted file mode 100644 index 44d1dd8..0000000 --- a/org.glite.px.myproxy-yaim/project/ChangeLog +++ /dev/null @@ -1,33 +0,0 @@ -0.0.0-1 -- Initial version - -4.1.0-1 -- First regular tag - -4.1.0-2 -- Module rebuilt - -4.1.1-1 -- Modifications for build with EMI -- Configuration adjusted for EMI - -4.1.2-1 -- product-specific GLITE_*_LOCATION* variables -- distinguish yaim prefix and glite prefix - -4.1.2-2 -- Module rebuilt - -4.1.2-3 -- Module rebuilt - -4.1.3-1 -- BDII setup - -4.1.4-1 -- Relocatable build directory. -- Fixes for BDII - -4.1.4-2 -- Module rebuilt - diff --git a/org.glite.px.myproxy-yaim/project/package.description b/org.glite.px.myproxy-yaim/project/package.description deleted file mode 100644 index 49ff68b..0000000 --- a/org.glite.px.myproxy-yaim/project/package.description +++ /dev/null @@ -1 +0,0 @@ -This package contains the yaim functions necessary to configure myproxy server. diff --git a/org.glite.px.myproxy-yaim/project/package.summary b/org.glite.px.myproxy-yaim/project/package.summary deleted file mode 100644 index 0dc0e7a..0000000 --- a/org.glite.px.myproxy-yaim/project/package.summary +++ /dev/null @@ -1 +0,0 @@ -glite-px-myproxy-yaim module configures myproxy server diff --git a/org.glite.px.myproxy-yaim/project/version.properties b/org.glite.px.myproxy-yaim/project/version.properties deleted file mode 100644 index cc7e70e..0000000 --- a/org.glite.px.myproxy-yaim/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=4.1.4 -module.age=2 diff --git a/org.glite.px.proxyrenewal/LICENSE b/org.glite.px.proxyrenewal/LICENSE deleted file mode 100644 index 4a9c73d..0000000 --- a/org.glite.px.proxyrenewal/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners/ for details on the copyright -holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/org.glite.px.proxyrenewal/Makefile b/org.glite.px.proxyrenewal/Makefile deleted file mode 100644 index f78e778..0000000 --- a/org.glite.px.proxyrenewal/Makefile +++ /dev/null @@ -1,204 +0,0 @@ -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -lbprefix=lb -package=glite-security-proxyrenewal -version=0.0.0 -PREFIX=/opt/glite -libdir=lib -prefix= -sysconfdir=/opt/glite/etc - -glite_location=${PREFIX}${prefix} -globus_prefix=/opt/globus -voms_prefix=${glite_location} - --include Makefile.inc - -VPATH:=${top_srcdir}/src:${top_srcdir}/examples - -GLOBUS_NOTHR_INC:= -I${globus_prefix}/include/${nothrflavour} -GLOBUS_THR_INC:= -I${globus_prefix}/include/${thrflavour} -GLOBUS_NOTHR_LIBS:=-L${globus_prefix}/lib \ - -lglobus_common_${nothrflavour} - -myproxy_prefix=${myproxy-devel_prefix} -myproxy_prefix?=${globus_prefix} - -MYPROXY_NOTHR_INC:= -I${myproxy_prefix}/include/${nothrflavour} -MYPROXY_THR_INC:= -I${myproxy_prefix}/include/${thrflavour} - -MYPROXY_LIB_NOTHR :=-L${myproxy_prefix}/${libdir} -L${myproxy_prefix}/lib -lmyproxy_${nothrflavour} -MYPROXY_LIB_THR:=-L${myproxy_prefix}/${libdir} -L${myproxy_prefix}/lib -lmyproxy_${thrflavour} - -VOMS_CFLAGS?=-I${voms_prefix}/include -I${voms_prefix}/include/glite/security -VOMS_LIBS?=-L${voms_prefix}/${libdir} -lvomsapi -VOMS_LIBS_NOTHR := -L${voms_prefix}/${libdir} -lvomsapi_${nothrflavour} -VOMS_LIBS_THR := -L${voms_prefix}/${libdir} -lvomsapi_${thrflavour} - -GLOBUS_GSSAPI_GSI_CFLAGS?=${GLOBUS_NOTHR_INC} -GLOBUS_GSSAPI_GSI_LIBS?=${GLOBUS_NOTHR_LIBS} - -MYPROXY_CFLAGS?=${MYPROXY_NOTHR_INC} -MYPROXY_LIBS?=${MYPROXY_LIB_NOTHR} - -DEBUG:=-g -O0 - -CFLAGS:= ${CFLAGS} ${DEBUG} \ - ${VOMS_CFLAGS} \ - -I${top_srcdir}/src -I${top_srcdir}/interface \ - -I${glite_location}/include \ - -DLOCAL_PX_COMPILE=1 - -offset=1 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -CC:=gcc -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -INSTALL:=libtool --mode=install install - -DAEMONOBJ:=renewd.o renew.o common.o commands.o api.o voms.o -LIBOBJ:=api.o common.o -LIB_CORE_OBJS := renewal_core.o voms.o -CLIENTOBJ:=client.o -MAN1_GZ:=glite-proxy-renew.1.gz -MAN8_GZ:=glite-proxy-renewd.8.gz -MAN_GZ = ${MAN1_GZ} ${MAN8_GZ} -MAN = $(MAN_GZ:.gz=) - -THRLIBOBJ:=${LIBOBJ:.o=.thr.o} -LIBLOBJ:=${LIBOBJ:.o=.lo} -THRLIBLOBJ:=${LIBOBJ:.o=.thr.lo} - -LIB_CORE_LOBJS := ${LIB_CORE_OBJS:.o=.lo} -LIB_CORE_THR_OBJS := ${LIB_CORE_OBJS:.o=.thr.o} -LIB_CORE_THR_LOBJS := ${LIB_CORE_OBJS:.o=.thr.lo} - -LIB:=libglite_security_proxyrenewal.la -NOTHRLIB:=libglite_security_proxyrenewal_${nothrflavour}.la -THRLIB:=libglite_security_proxyrenewal_${thrflavour}.la -LIB_CORE := libglite_security_proxyrenewal_core.la -LIB_CORE_NOTHR := libglite_security_proxyrenewal_core_${nothrflavour}.la -LIB_CORE_THR := libglite_security_proxyrenewal_core_${thrflavour}.la - -ifeq (${thrflavour},) -lib_LTLIBRARIES=${LIB} ${LIB_CORE} -default_libcore=${LIB_CORE} -default_lib=${LIB} -else -lib_LTLIBRARIES=${NOTHRLIB} ${THRLIB} ${LIB_CORE_NOTHR} -default_libcore=${LIB_CORE_NOTHR} -default_lib=${NOTHRLIB} -endif - -DAEMON:=glite-proxy-renewd -CLIENT:=glite-proxy-renew -EXAMPLES := renew_core - -default: all -compile all: startup ${lib_LTLIBRARIES} ${DAEMON} ${CLIENT} ${MAN_GZ} - -startup: ${top_srcdir}/config/startup - glite_var="${localstatedir}/glite"; \ - if echo "${localstatedir}" | grep 'glite'>/dev/null; then \ - glite_var="${localstatedir}"; \ - fi; \ - sed -e 's:@glite_prefix@:${sysroot}${prefix}:' -e 's:@glite_etc@:${sysconfdir}:' -e "s:@glite_var@:$$glite_var:" $< > $@ - chmod +x $@ - -ifeq (${thrflavour},) -${LIB}: ${LIBOBJ} - ${LINK} ${version_info} -o $@ ${LIBLOBJ} -rpath ${prefix}/${libdir} - -${LIB_CORE}: ${LIB_CORE_OBJS} - ${LINK} ${version_info} -o $@ ${LIB_CORE_LOBJS} -rpath ${prefix}/${libdir} ${MYPROXY_LIBS} ${VOMS_LIBS} -else -${NOTHRLIB}: ${LIBOBJ} - ${LINK} ${version_info} -o $@ ${LIBLOBJ} -rpath ${prefix}/${libdir} - -${THRLIB}: ${THRLIBOBJ} - ${LINK} ${version_info} -o $@ ${THRLIBLOBJ} -rpath ${prefix}/${libdir} - -${LIB_CORE_NOTHR}: ${LIB_CORE_OBJS} - ${LINK} ${version_info} -o $@ ${LIB_CORE_LOBJS} -rpath ${prefix}/${libdir} ${MYPROXY_LIB_NOTHR} ${VOMS_LIBS_NOTHR} - -${LIB_CORE_THR}: ${LIB_CORE_THR_OBJS} - ${LINK} ${version_info} -o $@ ${LIB_CORE_THR_LOBJS} -rpath ${prefix}/${libdir} ${MYPROXY_LIB_THR} ${VOMS_LIBS_THR} -endif - -${DAEMON}: ${DAEMONOBJ} ${default_libcore} - ${LINK} -o $@ ${DAEMONOBJ} ${default_libcore} - -${CLIENT}: ${CLIENTOBJ} ${default_lib} - ${LINK} -o $@ ${CLIENTOBJ} ${default_lib} ${GLOBUS_GSSAPI_GSI_LIBS} - -${THRLIBOBJ} ${LIB_CORE_THR_OBJS}: %.thr.o: %.c - ${COMPILE} ${MYPROXY_THR_INC} ${GLOBUS_THR_INC} -o $@ -c $< - -%.o: %.c - ${COMPILE} ${MYPROXY_CFLAGS} ${GLOBUS_GSSAPI_GSI_CFLAGS} -c $< - -${EXAMPLES}: %: %.o - ${LINK} -o $@ $< ${default_libcore} - -${MAN_GZ}: ${MAN} - cp $? . - gzip -f $(notdir $?) - -stage: compile - $(MAKE) install PREFIX=${stagedir} staging=1 - -check: - echo No unit tests - -examples: ${EXAMPLES} - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir - cd tmpbuilddir && tar -czf ../${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz * - rm -rf tmpbuilddir - -install: - -mkdir -p ${DESTDIR}${PREFIX}${prefix}/bin ${DESTDIR}${PREFIX}${prefix}/${libdir} ${DESTDIR}${PREFIX}${prefix}/include/glite/security/proxyrenewal ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version} ${DESTDIR}${PREFIX}${sysconfdir}/init.d ${DESTDIR}${PREFIX}${prefix}/share/man/man1 ${DESTDIR}${PREFIX}${prefix}/share/man/man8 - ${INSTALL} -m 755 ${lib_LTLIBRARIES} ${DESTDIR}${PREFIX}${prefix}/${libdir} - ${INSTALL} -m 755 ${DAEMON} ${CLIENT} ${DESTDIR}${PREFIX}${prefix}/bin - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${DESTDIR}${PREFIX}${prefix}/share/doc/${package}-${version} - cd ${top_srcdir}/interface && ${INSTALL} -m 644 renewal.h renewal_core.h ${DESTDIR}${PREFIX}${prefix}/include/glite/security/proxyrenewal - ${INSTALL} -m 755 startup ${DESTDIR}${PREFIX}${sysconfdir}/init.d/glite-proxy-renewald - ${INSTALL} -m 644 ${MAN1_GZ} ${DESTDIR}${PREFIX}${prefix}/share/man/man1 - ${INSTALL} -m 644 ${MAN8_GZ} ${DESTDIR}${PREFIX}${prefix}/share/man/man8 - -clean: - $(RM) ${lib_LTLIBRARIES} $(DAEMON) $(CLIENT) $(EXAMPLES) *.o *.lo core startup - -.PHONY: default all compile examples check stage dist distsrc distbin install clean diff --git a/org.glite.px.proxyrenewal/config/startup b/org.glite.px.proxyrenewal/config/startup deleted file mode 100755 index 98f9047..0000000 --- a/org.glite.px.proxyrenewal/config/startup +++ /dev/null @@ -1,97 +0,0 @@ -#!/bin/sh -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -GLITE_PX_LOCATION=${GLITE_PX_LOCATION:-'@glite_prefix@'} -GLITE_PX_LOCATION_ETC=${GLITE_PX_LOCATION_ETC:-'@glite_etc@'} -GLITE_PX_LOCATION_VAR=${GLITE_PX_LOCATION_VAR:-'@glite_var@'} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_PX_LOCATION_ETC/glite-wms.conf ] && . $GLITE_PX_LOCATION_ETC/glite-wms.conf -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -PROXY_REPOSITORY="$GLITE_PX_LOCATION_VAR/spool/glite-renewd" - -unset creds - -start() -{ - if test -z "$GLITE_USER" ;then - echo 'Error: GLITE_USER is not set' - echo FAILED - return 1 - fi - - [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] && - creds="-t $GLITE_HOST_CERT -k $GLITE_HOST_KEY" - - if test -z "$creds"; then - if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then - echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER" - creds="-t /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem" - fi - fi - - [ -z "$creds" ] && - echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2 - - # workaround for VOMS_FindByVO that seems to always require user's own VOMS config file (bug #7511) - user_voms_config=$HOME/.glite/vomses - if [ ! -f "$user_voms_config" ]; then - rm -f /tmp/renewal_vomses - su - $GLITE_USER -c "touch /tmp/renewal_vomses && chmod 644 /tmp/renewal_vomses" - user_voms_config=/tmp/renewal_vomses - fi - - echo -n Starting ProxyRenewal Daemon: glite-proxy-renewd ... - - if [ ! -d "$PROXY_REPOSITORY" ]; then - mkdir -p $PROXY_REPOSITORY || exit 1 - chown $GLITE_USER $PROXY_REPOSITORY - chmod 0700 $PROXY_REPOSITORY - fi - - su - $GLITE_USER -c "VOMS_USERCONF=$user_voms_config \ - $GLITE_PX_LOCATION/bin/glite-proxy-renewd \ - -r $PROXY_REPOSITORY $creds -A" && echo " done" -} - -stop() -{ - echo -n "Stopping ProxyRenewal Daemon: glite-proxy-renewd ..." - killall glite-proxy-renewd - echo " done" -} - -status() -{ - if netstat -an --unix | grep "^unix .* LISTEN.* /tmp/dgpr_renew_" >/dev/null 2>&1 ;then - echo glite-proxy-renewd running - else - echo glite-proxy-renewd not running - return 1 - fi -} - -case x$1 in - xstart) start;; - xstop) stop;; - xrestart) stop; start;; - xstatus) status;; - x*) echo usage: $0 start,stop,restart,status >&2 - exit 1;; -esac diff --git a/org.glite.px.proxyrenewal/configure b/org.glite.px.proxyrenewal/configure deleted file mode 100755 index aace459..0000000 --- a/org.glite.px.proxyrenewal/configure +++ /dev/null @@ -1,1393 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = '/usr'; -my $stagedir = undef; -my $root = $pwd.'/stage'; -my $sysroot = ''; -my $sysconfdir; -my $localstatedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $branch; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $jobid_tag = ''; -my $libdir = getlibdir(); -my $project = 'glite'; -my (%projects, %project); -my $debug = 0; -my $pkg_config_env = (defined $ENV{PKG_CONFIG_PATH}) ? "$ENV{PKG_CONFIG_PATH}:" : ''; - -my @nodes = qw/client server logger logger-msg utils client-java doc ws-test db jpprimary jpindex jpclient harvester lb px proxyrenewal/; -my @default_nodes = qw/lb px proxyrenewal/; -my %enable_nodes; -my %disable_nodes; -my %default_nodes; @default_nodes{@default_nodes} = (1) x ($#default_nodes + 1); - -# key: internal package name (arguments, ...) -# 'pkg': pkg-config name -# 'prefix': used when pkg-config fails -my %externs = ( - cares => { - prefix => '/opt/c-ares', - pkg => 'libcares' - }, - classads => { - prefix=> '/usr', - pkg => 'classads' - }, - cppunit => { - prefix=> '/usr', - pkg => 'cppunit' - }, - expat => { - prefix=> '/usr', - pkg => 'expat' - }, - globus => { - prefix=> '/opt/globus', - pkg => 'globus-gssapi-gsi' - }, - 'myproxy-devel' => { - prefix=> '/opt/globus', - pkg => 'myproxy' - }, - 'myproxy-server' => { - prefix=> '', - }, - 'myproxy-libs' => { - prefix=> '', - }, - 'myproxy-admin' => { - prefix=> '', - }, - gsoap => { - prefix=> '/usr', - pkg => 'gsoap' - }, - gsoapxx => { - prefix=> '/usr', - pkg => 'gsoap++' - }, - mysql => { - prefix=> '/usr' - }, - 'mysql-devel' => { - prefix=> '' - }, - 'mysql-server' => { - prefix => '' - }, - voms => { - prefix => '/opt/glite', - pkg => 'voms-2.0' - }, - gridsite => { - prefix => '/opt/glite' - }, - lcas => { - prefix => '/opt/glite', - pkg => 'lcas' - }, - trustmanager => { - prefix => '/opt/glite' - }, - trustmanager_axis => { - prefix => '/opt/glite' - }, - utiljava => { - prefix=> '/opt/glite' - }, - ant => { - prefix=> '/usr' - }, - jdk => { - prefix=> '/usr/java/latest' - }, - libtar => { - prefix=> '/usr' - }, - axis => { - prefix=> '/usr' - }, - log4c => { - prefix=> '/usr' - }, - postgresql => { - prefix=> '/usr' - }, - activemq => { - prefix=>'/opt/activemq-cpp-library', - pkg => 'activemq-cpp' - }, - apr => { - prefix=>'/opt/apr', - pkg => 'apr-1' - }, - aprutil => { - prefix=>'/opt/apr-util', - pkg => 'apr-util-1' - }, -); - -my %jar = ( - 'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar', - 'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %buildroot; -my (%etics_externs, %etics_projects); - -# -# modules of the subsystems -# -# additional modules from $project{modules} are automatically added -# -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim logger-msg/], - 'lbjp-common' => [qw/db log maildir server-bones trio jp-interface gss gsoap-plugin/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - 'gridsite' => [ qw/apache shared commands core devel slashgrid services service-clients gsexec/ ], - 'px' => [ qw/proxyrenewal myproxy-yaim/ ], - ); - - -my @opts = ( - 'prefix:s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour:s' => \$thrflavour, - 'nothrflavour:s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'branch=s' => \$branch, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'root:s' => \$root, - 'sysroot:s' => \$sysroot, - 'sysconfdir=s' => \$sysconfdir, - 'localstatedir=s' => \$localstatedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, - 'libdir=s' => \$libdir, - 'project=s' => \$project, - 'debug' => \$debug, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$externs{$_}{withprefix} for keys %externs; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; -$prefix=~s/\/$//; -$root=~s/\/$//; -$sysroot=~s/\/$//; -if (not $sysconfdir) { $sysconfdir = $prefix eq '/usr' ? '/etc' : "$prefix/etc"; } -if (not $localstatedir) { $localstatedir = $prefix eq '/usr' ? '/var' : "$prefix/var"; } -$sysconfdir=~s/\/$//; -$localstatedir=~s/\/$//; - -$externs{'mysql-server'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-server'}{prefix} eq ''; -$externs{'mysql-devel'}{prefix}=$externs{mysql}{prefix} if $externs{'mysql-devel'}{prefix} eq ''; -$externs{'gsoapxx'}{prefix}=$externs{gsoap}{prefix} if $externs{'gsoapxx'}{prefix} eq ''; - -%project = %{$projects{$project}}; -for $_ (keys %{$project{etics_externs}}) { - $etics_externs{$_} = $project{etics_externs}{$_}; -} -for $_ (keys %{$project{etics_projects}}) { - $etics_projects{$_} = $project{etics_projects}{$_}; -} -for $_ (keys %{$project{need_externs_aux}}) { - $need_externs_aux{$_} = $project{need_externs_aux}{$_}; -} -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - my ($pkg, $type) =/([^:]*)(?::(.*))?/; - $type = 'BR' unless ($type); - - push @{$need_externs{$ext}},$pkg; - $need_externs_type{$ext}->{$pkg} = $type; - } -} -for $_ (keys %{$project{modules}}) { - push @{$lbmodules{$_}},@{$project{modules}{$_}}; -} - - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my $name_prefix = ($listmodules eq 'gridsite' and $project eq 'glite') ? 'org' : $project{etics_name}; - my @m = map "$name_prefix.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version, --branch and --output make sense only in --mode=etics\n" - if ($version || $output || $branch) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless ($disable_nodes{$_} or not $default_nodes{$_}); - } -} - -if (!$en && !$dis) { for (@nodes) { $enable_nodes{$_} = 1 if ($default_nodes{$_}) } }; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $root unless $stagedir; -$stagedir=~s/\/$// if ($stagedir); - -if ($mode eq 'build') { for my $ext (keys %externs) { - if (defined $externs{$ext} and defined $externs{$ext}{withprefix}) { $externs{$ext}{prefix} = $externs{$ext}{withprefix}; } - elsif (defined $externs{$ext}{pkg}) { - my ($flag, $env, $cmd, $ret); - my $pkg = $externs{$ext}{pkg}; - my $flagname = uc $externs{$ext}{pkg}; - $flagname =~ s/-[0-9\.]*$//; - $flagname =~ y/-\+/_X/; - - print "Checking $pkg ... "; - $env = "PKG_CONFIG_PATH=$pkg_config_env$stagedir$prefix/$libdir/pkgconfig"; - $cmd = "$env pkg-config $pkg --exists >/dev/null"; - `$cmd`; $ret = $?; - print "('$cmd' => $ret)\n" if ($debug); - if ($ret == 0) { - $externs{$ext}{prefix}=`$env pkg-config $pkg --variable=prefix`; - chomp $externs{$ext}{prefix}; - print "$externs{$ext}{prefix}\n"; - - $flag=`$env pkg-config $pkg --cflags`; - $externs{$ext}{flags} .= "${flagname}_CFLAGS=$flag" if ($flag); - $flag=`$env pkg-config $pkg --libs`; - $externs{$ext}{flags} .= "${flagname}_LIBS=$flag" if ($flag); - } else { - print "(using default $externs{$ext}{prefix})\n"; - } - print "\n" if ($debug); - } - elsif ($ext eq 'jdk') { - my $jdk_prefix; - - print "Looking for some caffein ... "; - if (defined $ENV{'JDK_HOME'}) { - $jdk_prefix = $ENV{'JDK_HOME'}; - print "JDK_HOME=$jdk_prefix\n"; - } elsif (defined $ENV{'JAVA_HOME'}) { - $jdk_prefix = $ENV{'JAVA_HOME'}; - print "JAVA_HOME=$jdk_prefix\n"; - } else { - print "(using default $externs{$ext}{prefix}))\n" - } - $externs{$ext}{prefix} = $jdk_prefix if ($jdk_prefix); - } -} } - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - for ('JDK_HOME', 'JAVA_HOME', 'PKG_CONFIG_PATH') { - print CONF "$_=$ENV{$_} " if (defined $ENV{$_}); - } - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - print "Mode: "; print $module ? "single module" : "multiple modules"; print "\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: ".($externs{$_}{prefix}?$externs{$_}{prefix}:'-')."\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - for (@ext) { if (defined($externs{$_}{flags})) { print "$externs{$_}{flags}"; } }; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - if ($module) { - print "Not creating summary Makefile\n" if $debug; - } else { - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\n"; - print MAK "stage: ".(join '-stage ', @modules)."-stage\n\n"; - print MAK "clean check install:\n"; - - for (@modules) { - my $full = full($_); - print MAK "\tcd $full/$buildroot{$_} && \${MAKE} \$@\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $buildroot{$_} eq '' ? - "\tcd $full && \${MAKE} distclean\n" : - "\trm -rf $full/$buildroot{$_}\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - my $snames = $#dnames == -1 ? '' : join('-stage ', @dnames).'-stage'; - - my $full = full($_); - my $build = $buildroot{$_}; - - print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n"; - print MAK "$_-stage: $snames\n\tcd $full/$build && \${MAKE} && \${MAKE} stage\n\n"; - } - - close MAK; - } -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%etics_externs = ( - 'myproxy-devel'=>'myproxy-devel', - 'myproxy-libs'=>'myproxy-libs', - 'myproxy-server'=>'myproxy-server', - 'myproxy-admin'=>'myproxy-admin', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - utiljava=>'org.glite.security.util-java', - gpt=>'gpt', - fetchcrl=>'fetch-crl', - activemq=>'activemq-cpp-library', - apr=>'apr-dev', - aprutil=>'aprutil-dev', -); - -%etics_projects = ( -); - -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads libtool:B/ ], - 'lb.common' => [ qw/expat cares:B cppunit:B classads libtool:B/ ], - 'lb.doc' => [ qw/tetex-latex:B/ ], - 'lb.logger' => [ qw/cppunit:B libtool:B/ ], - 'lb.logger-msg' => [ qw/cppunit:B activemq libtool:B/ ], - 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite bison:B libtool:B libxml2 flex:B/ ], - 'lb.state-machine' => [ qw/classads libtool:B libxslt:B expat:B/ ], - 'lb.utils' => [ qw/cppunit:B libtool:B/ ], - 'lb.ws-interface' => [ qw/libxslt:B/ ], - 'lb.ws-test' => [ qw/gsoap:B libtool:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/docbook-utils:B libtool:B/ ], - 'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.log' => [ qw/log4c libtool:B/ ], - 'lbjp-common.maildir' => [ qw/libtool:B/ ], - 'lbjp-common.server-bones' => [ qw/libtool:B/ ], - 'lbjp-common.trio' => [ qw/cppunit:B libtool:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B libtool:B/ ], - 'lbjp-common.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B libtool:B/ ], - 'lbjp-common.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap gsoapxx libtool:B/ ], - 'jobid.api-c' => [ qw/cppunit:B libtool:B openssl:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B libtool:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], - 'gridsite.core' => [ qw/httpd-devel:B gsoap:B globus:B curl:B doxygen:B fuse-devel:B libxml2 openssl:B build_common_cpp:B doxygen:B/ ], - 'gridsite.commands' => [ qw/curl:R openssl:R/ ], - 'gridsite.apache' => [ qw/libxml2:R openssl:R curl:R/ ], - 'gridsite.shared' => [ qw/libxml2:R openssl:R/ ], - 'gridsite.devel' => [ qw// ], - 'gridsite.slashgrid' => [ qw/curl:R fuse-libs:R fuse:R/], - 'gridsite.services' => [ qw/curl:R gsoap:R/ ], - 'gridsite.service-clients' => [ qw/curl:R gsoap:R gsoapxx:R/ ], - 'gridsite.gsexec' => [ qw// ], - 'px.proxyrenewal' => [ qw/globus:B globus_essentials:R myproxy-devel:B myproxy-libs:R voms libtool:R/ ], - 'px.myproxy-config' => [ qw/myproxy-admin:R/ ], # in myproxy-config.spec -); - -%need_jars = ( - 'jobid.api-java' => [ qw/jakarta-commons-codec/ ], - 'lb.client-java' => [ qw/jakarta-commons-lang/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp:B jobid.api-c - lbjp-common.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - lb.ws-interface:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp:B jobid.api-c - lb.types:B lbjp-common.trio lbjp-common.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - lbjp-common.log - jobid.api-c - lb.common - lbjp-common.gss - / ], - 'lb.logger-msg' => [ qw/ - lb.logger - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log - jobid.api-c - lbjp-common.gsoap-plugin lbjp-common.gss - / ], - 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface lbjp-common.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine lb.types:B - / ], - 'lb.ws-test' => [ qw/lbjp-common.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/ - jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client - lbjp-common.gss lbjp-common.log - / ], - 'lb.yaim' => [ qw// ], - 'lb.glite-LB' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - lb.logger-msg:R - / ], - 'lb.emi-lb' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - lb.logger-msg:R - / ], - 'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.log' => [ qw// ], - 'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ], - 'lbjp-common.trio' => [ qw// ], - 'lbjp-common.gss' => [ qw// ], - 'lbjp-common.gsoap-plugin' => [ qw/lbjp-common.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - lbjp-common.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - lbjp-common.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], - - 'gridsite.core' => [ qw// ], - 'gridsite.commands' => [ qw/gridsite.core:B gridsite.shared:R/ ], - 'gridsite.apache' => [ qw/gridsite.core:B gridsite.shared:R/ ], - 'gridsite.shared' => [ qw/gridsite.core:B / ], - 'gridsite.devel' => [ qw/gridsite.core:B gridsite.shared:R/ ], - 'gridsite.slashgrid' => [ qw/gridsite.core:B gridsite.shared:R/], - 'gridsite.services' => [ qw/gridsite.core:B gridsite.shared:R/ ], - 'gridsite.service-clients' => [ qw/gridsite.core:B gridsite.shared:R/ ], - 'gridsite.gsexec' => [ qw/gridsite.core:B/ ], - - 'px.proxyrenewal' => [ qw// ], - 'px.glite-PX' => [qw/px.myproxy-yaim:R/], - 'px.emi-px' => [qw/px.myproxy-yaim:R/], - 'px.myproxy-yaim' => [ qw// ], - 'px.myproxy-config' => [], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', - lb => 'lb.glite-LB', - px => 'px.glite-PX', - proxyrenewal => 'px.proxyrenewal' -); - -%obsoletes = ( - 'lb.yaim' => [ qq/glite-yaim-lb/ ], - 'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ], - 'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ], - 'px.myproxy-config' => [ qq/myproxy-config/ ], # in myproxy-config.spec - 'lbjp-common.gss' => [ qq/glite-security-gss/ ], - 'lbjp-common.gsoap-plugin' => [ qq/glite-security-gsoap-plugin/ ], -); - -%conflicts = ( - 'lb.glite-LB' => [ qq/emi-lb/ ], - 'px.glite-PX' => [ qq/emi-px/ ], - 'lb.emi-lb' => [ qq/glite-LB/ ], - 'px.emi-px' => [ qq/glite-PX/ ], -); - -%cvs_prefix = ( - 'lb' => 'org.glite', - 'jp' => 'org.glite', - 'jobid' => 'org.glite', - 'lbjp-common' => 'org.glite', - 'gridsite' => 'org', - 'px' => 'org.glite', -); - -%cvs_tag_prefix = ( - 'lb' => 'glite-', - 'jp' => 'glite-', - 'jobid' => 'glite-', - 'lbjp-common' => 'glite-', - 'gridsite' => '', - 'px' => 'glite-', -); - -# ==== projects specification ==== -# etics_name ........... ETICS project name -# conf_prefix .......... ETICS configurations name prefix -# tag_prefix ........... VCS tag prefix -# local_prefix ......... prefix (relative to stage) -# etics_externs ........ ETICS modules names of externals -# (${NAME.location}, ETICS conf. dependencies) -# etics_projects ....... ETICS project names of externals -# etics_externs_devel .. ETICS modules names of devel versions of externals -# need_externs_aux ..... project-specific external dependencies -# supported_platforms .. platforms supported by the project -# modules .............. additional modules in subsystems -%projects = ( - glite => { - etics_name => 'org.glite', - conf_prefix => { %cvs_tag_prefix }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour=${globus.thr.flavor} --nothrflavour=${globus.nothr.flavor}', - local_prefix => '', - etics_externs => { - globus_essentials=>'vdt_globus_essentials', - globus=>'globus', - gridsite=>'org.gridsite.shared', - yaim_core=>'org.glite.yaim.core', - gip_release=>'glite-info-provider-release', - gip_service=>'glite-info-provider-service', - bdii=>'bdii', - glite_version=>'glite-version', - glite_info_templates=>'glite-info-templates', - glue_schema=>'glue-schema', - trustmanager=>'org.glite.security.trustmanager', - axis=>'axis', - lcas=>'org.glite.security.lcas', - gsoapxx=>'-', - build_common_cpp=>'org.glite.build.common-cpp', - }, - etics_externs_devel => { - gridsite=>'org.gridsite.devel', - }, - etics_projects => { - vdt=>[qw/globus globus_essentials gpt/], - 'org.glite'=>[qw/voms gridsite lcas gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R perl-LDAP:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R gpt:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R/ ], - }, - modules => { - 'lb' => [ qw/glite-LB/ ], - 'px' => [ qw/glite-PX/ ], - } - }, - - emi => { - etics_name => 'emi', - conf_prefix => { - 'lb' => 'emi-', - 'jp' => 'emi-', - 'jobid' => 'emi-', - 'lbjp-common' => 'emi-', - 'gridsite' => '', - 'px' => 'emi-', - }, - tag_prefix => { %cvs_tag_prefix }, - flavours => '--thrflavour= --nothrflavour=', - local_prefix => '/usr', - etics_externs => { - globus_essentials=>'globus-gssapi-gsi', - globus=>'globus-gssapi-gsi-devel', - gridsite=>'emi.gridsite.shared', - yaim_core=>'emi.yaim.yaim-core', - yaim_bdii=>'emi.bdii.yaim-bdii', - gip_release=>'emi.bdii.glite-info-provider-release', - gip_service=>'emi.bdii.glite-info-provider-service', - bdii=>'emi.bdii.core', - glite_version=>'emi.misc.glite-version', - glue_schema=>'emi.bdii.glue-schema', - trustmanager=>'emi.java-security.trustmanager', - trustmanager_axis=>'emi.java-security.trustmanager-axis', - axis=>'axis1.4', - lcas=>'emi.sac.lcas', - gsoapxx=>'-', - build_common_cpp=>'emi.misc.glite.build-common-cpp', - jdk=>'java', - }, - etics_externs_devel => { - cares => 'c-ares-devel', - classads => 'classads-devel', - cppunit => 'cppunit-devel', - expat => 'expat-devel', - gsoap => 'gsoap-devel', - voms => 'org.glite.security.voms-api', - libtar => 'libtar-devel', - log4c => 'log4c-devel', - postgresql => 'postgresql-devel', - curl => 'curl-devel', - libxml2 => 'libxml2-devel', - openssl => 'openssl-devel', - gridsite=>'emi.gridsite.devel', - jdk=>'java-devel', - }, - etics_projects => { - 'emi'=>[qw/voms voms-devel gridsite lcas gip_release gip_service bdii glite_version glue_schema yaim_core yaim_bdii trustmanager trustmanager_axis/], - }, - need_externs_aux => { - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager trustmanager_axis libtool:B/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gip_release:R gip_service:R bdii:R glite_version:R glue_schema:R/ ], - 'lb.yaim' => [ qw/yaim_core:R yaim_bdii:R perl-LDAP:R/ ], - 'px.glite-PX' => [qw/myproxy-server:R myproxy-admin:R fetchcrl:R gip_service:R bdii:R glite_version:R glue_schema:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R yaim_bdii:R/ ], - }, - supported_platforms => { - sl5_x86_64_gcc412EPEL => 1, - sl5_ia32_gcc412EPEL => 1, - }, - modules => { - 'lb' => [ qw/emi-lb/ ], - 'px' => [ qw/emi-px/ ], - } - }, -); - -%platform_properties = ( - 'gridsite.core' => { - sl5_x86_64_gcc412 => { aprSuffix => '1' }, - sl5_ia32_gcc412 => { aprSuffix => '1' }, - sl5_x86_64_gcc412EPEL => { aprSuffix => '1' }, - sl5_ia32_gcc412EPEL => { aprSuffix => '1' }, - deb5_x86_64_gcc432 => { aprSuffix => '1.0' }, - deb5_ia32_gcc432 => { aprSuffix => '1.0' }, - slc4_x86_64_gcc346 => { aprSuffix => '0' }, - slc4_ia32_gcc346 => { aprSuffix => '0' }, - default => { - } - }, - 'jobid.api-java' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.types' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.doc' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.ws-interface' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'lb.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.yaim' => { - default => { 'package.buildarch' => 'noarch' }, - }, - 'px.myproxy-config' => { - default => { 'package.buildarch' => 'noarch' }, - }, -); - -my @k = keys %deps_aux; -@buildroot{@k} = ('') x ($#k+1); - -$buildroot{'gridsite.core'} = 'src'; -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.logger-msg lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB -lbjp-common.gss lbjp-common.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface lbjp-common.gss lbjp-common.gsoap-plugin -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -px.proxyrenewal px.myproxy-yaim px.glite-PX px.myproxy-config -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $top_srcdir = '.'; - my $build = ''; - - if ($module) { - $top_srcdir = $0; - $top_srcdir =~ s,/?[^/]*$,,; - $top_srcdir =~ s,^$,\.,; - } else { - $build = "$full/"; - unless ($buildroot{$_} eq '') { - $top_srcdir = '..'; - $build .= "$buildroot{$_}/"; - unless (-d "$build") { - mkdir "$build" or die "mkdir $build: $!\n"; - } - } - } - unless ($top_srcdir eq '.') { - unlink $build."Makefile"; - symlink "$top_srcdir/Makefile",$build."Makefile" or die "symlink $top_srcdir/Makefile ".$build."Makefile: $!\n"; - for my $file ('.pre', '.post', '.preun', '.postun changelog') { - my $pfile = "project/$file"; - if (-f "$full/$pfile") { - mkdir "$build/project" unless (-d "$build/project"); - unlink $build.$pfile; - symlink "../$top_srcdir/$pfile", $build.$pfile or die "symlink ../$top_srcdir/$pfile ".$build."$pfile: $!\n"; - } - } - } - - open MKINC,">".$build."Makefile.inc" - or die $build."Makefile.inc: $!\n"; - - print "Creating ".$build."Makefile.inc\n"; - - print MKINC qq{project = $project -PREFIX = $root -prefix = $prefix -stagedir = $stagedir -sysroot = $sysroot -sysconfdir = $sysconfdir -localstatedir = $localstatedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -libdir = $libdir -top_srcdir = $top_srcdir -}; - - for (@{$need_externs{$short}}) { - next unless defined $externs{$_} and defined $externs{$_}{prefix}; - print MKINC "${_}_prefix = $externs{$_}{prefix}\n"; - print MKINC "$externs{$_}{flags}" if defined $externs{$_}{flags}; - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -BEGIN{ -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - my $path = "$cvs_prefix{$subsys}.$subsys.$module/project"; - if ($subsys eq 'gridsite') { - $path = "$cvs_prefix{$subsys}.$subsys.core/project"; - } - open V,"$path/version.properties" - or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{$project{etics_name}}}} = (1) x ($#{$etics_projects{$project{etics_name}}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/ and (defined $externs{$_} or defined $jar{$_})) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - next if ($eext eq '-'); - if ($project ne 'glite') { - if ($ge{$_} and not defined $externs{$_}{pkg}) { - push @copts, "--with-$_=\${stageDir}"; - } - } else { - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - } - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}$jar{$_}" if ($project eq 'glite'); - } - - my $conf; - my $conftag; - my ($confprefix, $nameprefix); - - $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n"; - - $confprefix = $project{conf_prefix}{$subsys}; - $nameprefix = $confprefix; - $nameprefix =~ s/-$//; - $nameprefix =~ s/-/\./g; - - if ($branch) { - $conf = "$confprefix${subsys}-${module}_$branch"; - $conftag = $branch; - # forced low age number - $age = $branch eq 'HEAD' ? '0head' : '0dev'; } - else { - $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - -# XXX: gridsite hack - $conftag = $subsys eq 'gridsite' ? "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : - "$project{tag_prefix}{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; } - - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"}; - - my $confdir = $buildroot{"$subsys.$module"} eq '' ? '.' : '..'; - - my $package_description = ""; - my $package_summary = ""; - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description"; - $package_description = join ("", ); - close V; - chomp $package_description; - $package_description =~ s/\n/\\n/g; - $package_description = "package.description = $package_description\n"; - } - else { - print STDERR "package.description not found for $subsys.$module!\n"; } - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary"; - $package_summary = join ("", ); - close V; - chomp $package_summary; - $package_summary =~ s/\n/\\n/g; - $package_summary = "package.summary = $package_summary\n"; - } - else { - print STDERR "package.summary not found for $subsys.$module!\n"; } - - my %cmd; - @cmd{qw/configure compile test install packaging clean/} = ('None') x 6; - $cmd{clean} = 'make clean'; - $cmd{checkout} = "cvs -d \${vcsroot} co -d \${moduleName} ".($conftag eq 'HEAD' ? '-A' : '-r ${tag}')." $cvs_prefix{$subsys}.$subsys.$module 2>/dev/null"; - #$cmd{checkout} = "(test -d jra1mw/.git && (cd jra1mw; git pull) || git clone http://scientific.zcu.cz/git/jra1mw.git)"; - #$cmd{checkout} .= " && (cd jra1mw; git checkout \${tag})" unless ($conftag =~ /HEAD/); - #$cmd{checkout} .= " && ln -s jra1mw/$cvs_prefix{$subsys}.$subsys.$module \${moduleName}"; - $cmd{tag} = "cvs -d \${vcsroot} tag -R \${tag} ${moduleName}"; - - if ($subsys eq 'gridsite') { - $cmd{tag} = 'None'; - - if ($module eq 'core') { - my ($flags, $prefix); - - if ($project ne 'glite') { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=`pkg-config gsoap --variable=prefix` OPENSSL_GLOBUS_FLAGS=`pkg-config globus-openssl --cflags` OPENSSL_GLOBUS_LIBS=`pkg-config globus-openssl --libs` FLAVOR_GLOBUS_EXT= HTTPD_FLAGS="-I/usr/include/httpd -I/usr/include/apache2 -I/usr/include/apr-${aprSuffix} -I/usr/include/pcre"'; - $prefix = "prefix=${prefix}/usr"; - } else { - $flags = 'RELEASE_VERSION=${age}.${platformFamily} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"'; - $prefix = "prefix=${prefix}"; - } - - $cmd{compile} = "echo 'make $flags' > build.sh\n\tmake $flags build"; - $cmd{clean} = "rm -rvf build.sh; $cmd{clean}"; - $cmd{install} = "make $prefix $flags install"; - $cmd{packaging} = "mkdir ${moduleDir}/src/tgz - make $prefix $flags rpm && \ - cp ${moduleDir}/RPMTMP/SOURCES/gridsite-${version}.src.tar.gz ${moduleDir}/src/tgz"; - } - else { - $cmd{clean} = 'None'; - $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this"; - $cmd{checkout} = "mkdir -v \${moduleName} 2>/dev/null || true"; - } - } - elsif ($subsys eq 'px' and $module eq 'myproxy-config') { - $cmd{configure} = "/usr/bin/perl $confdir/configure --root=\${prefix} --prefix= --stage=\${stageDir} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{packaging} = "make rpm package=".$confprefix."$subsys-myproxy-config"; - } - else { - $cmd{configure} = "/usr/bin/perl $confdir/configure $project{flavours} --root=\${prefix} --prefix=$project{local_prefix} --stage=\${stageDir} --sysroot=\${package.prefix} --libdir=\${libdir} --project=\${projectName} --module $subsys.$module @copts"; - $cmd{compile} = 'make'; - $cmd{test} = 'make check'; - $cmd{install} = 'make install'; - } - - my $defprops = ''; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) { - $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n"; - } - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = $project{etics_name}.$subsys.$module -displayName = $conf -description = $cvs_prefix{$subsys}.$subsys.$module -projectName = $project{etics_name} -age = $age -deploymentType = None -vcsroot = :pserver:anonymous\@glite.cvs.cern.ch:/cvs/glite -tag = $conftag -version = $major.$minor.$rev -$dwpath -[Platform-default:VcsCommand] -displayName = None -description = None -tag = $cmd{tag} -branch = None -commit = None -checkout = $cmd{checkout} - -[Platform-default:BuildCommand] -postpublish = None -packaging = $cmd{packaging} -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = $cmd{compile} -init = None -install = $cmd{install} -clean = $cmd{clean} -test = $cmd{test} -configure = $cmd{configure} -checkstyle = None - -[Platform-default:Property] -$buildroot -aprSuffix = 0 -package.RPMSLocation = \${moduleDir}/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/RPMTMP/SRPMS -package.preserve.libtool = false -$package_description$package_summary$defprops}; - - for (@{$obsoletes{"$subsys.$module"}}) { - print C "package.obsoletes = $_\n"; - print C "package.replaces = $_\n"; - } - for (@{$conflicts{"$subsys.$module"}}) { - print C "package.conflicts = $_\n"; - } - - for my $pp (keys %{$platform_properties{"$subsys.$module"}}) { - next if $pp eq 'default'; - next if exists $project{supported_platforms} and not exists $project{supported_platforms}{$pp}; - - print C "[Platform-$pp:Property]\n$buildroot\n"; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) { - print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n"; - } - print C "package.RPMSLocation = \${moduleDir}/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/RPMTMP/SRPMS\n"; - print C "$package_description$package_summary\n"; - } - - print C qq{ -[Platform-default:DynamicDependency] -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - my $edev = $project{etics_externs_devel}{$_}; - next if ($eext eq '-'); - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - - if ($edev) { - if ($type eq 'B') { - $eext = $edev; # no runtime - change to devel pkg - } elsif ($type eq 'BR' or $type eq 'RB') { - print C "$proj|$edev = B\n"; # additional devel pkg - } - } - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "$project{etics_name}|$project{etics_name}.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$externs{gsoap}{prefix}/bin/soapcpp2 -v 2>&1 |" or die "$externs{gsoap}{prefix}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - $gsoap_version = $1 if /The gSOAP code generator for C and C\+\+, soapcpp2 release ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - -sub getlibdir { - if ( -e "/etc/debian_version") { # We are on Debian - $lib64="lib"; - $lib32="lib32"; } - else { # Another distribution - $lib64="lib64"; - $lib32="lib"; } - $libdir=$lib32; - - open INP, "uname -s | "; # Check kernel name - $kname= ; - chomp($kname); - close INP; - - if ( $kname eq "Linux") { - $arch = ("x86_64\npowerpc\nppc64\n"); - - open INP, "uname -p | "; # Check processor type - $procname= ; - chomp($procname); - close INP; - - if ($arch =~/^$procname\n/) { - return ($lib64); } - - open INP, "uname -m | "; # Check machine hardware - $machname= ; - chomp($machname); - close INP; - - if ($arch =~/^$machname\n/) { - return ($lib64); } - - # special cases (hyperlink lib64, Debian) - if (-l "/usr/lib64") { - $libdir=$lib32; } - - # if /usr/lib64 doesn't exist at all (AIX) - unless ( -e "/usr/lib64" ) { - $libdir=$lib32; } - } - - if ( $kname eq "SunOS") { - if (-e "/usr/lib/64") { - $libdir="lib/64"; } - } - - return $libdir; -} - -sub usage { - my @ext = keys %externs; - my @myjars = keys %jar; - - print STDERR qq{ -Usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --stage=DIR staging directory [./stage] - --root=DIR installation root (custom relocation root -> sysroot) [./stage] - --sysroot=DIR system root (custom relocation root -> sysroot) [] - --sysconfdir=DIR system configuration directory [PREFIX/etc] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - --version=maj.min.rev-age specify version here instead of reading version.properties - --branch=branch CVS branch/etics name suffix (HEAD, branch_2_1, ...) - --libdir=libdir typically [lib,lib64] postfix - --project=PROJECT build or generate etics for a project (glite/emi) [emi] - --debug print more details - -Mode of operation: - --mode=\{checkout|build|etics\} what to do [build] - -What to build: - --module=module build this module only - --enable-NODE build this "node" (set of modules) only - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies (summary of what will be used is always printed): - --with-EXTERNAL=PATH where to look for an external [autodetect] - --with-JAR=JAR where to look for jars - -Available nodes: - @nodes - -Default nodes: - @default_nodes - -Externals (not all for all modules) are: - @ext - -External jars are: - @myjars - -}; - -} diff --git a/org.glite.px.proxyrenewal/examples/renew_core.c b/org.glite.px.proxyrenewal/examples/renew_core.c deleted file mode 100644 index a446830..0000000 --- a/org.glite.px.proxyrenewal/examples/renew_core.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#ifdef LOCAL_PX_COMPILE -#include "renewal_core.h" -#else -#include -#endif - -static struct option const long_options[] = { - { "server", required_argument, 0, 's' }, - { "proxy", required_argument, 0, 'p' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, NULL, 0} -}; - -static char short_options[] = "s:p:h"; - -int -main(int argc, char *argv[]) -{ - char *server = NULL; - char *proxy = NULL; - char *new_proxy = NULL; - extern int optind; - char arg; - glite_renewal_core_context ctx = NULL; - int ret; - - while ((arg = getopt_long(argc, argv, short_options, long_options, NULL)) != EOF) { - switch(arg) { - case 's': - server = optarg; break; - case 'p': - proxy = optarg; break; - case 'h': - fprintf(stdout, "Usage: %s --server --proxy \n", argv[0]); - exit(1); - } - } - - if (server == NULL || proxy == NULL) { - fprintf(stderr, "both server and proxy parameters must be given\n"); - exit(1); - } - - ret = glite_renewal_core_init_ctx(&ctx); - if (ret) { - fprintf(stderr, "glite_renewal_core_init_ctx() failed\n"); - exit(1); - } - - ctx->log_dst = GLITE_RENEWAL_LOG_NONE; - - ret = glite_renewal_core_renew(ctx, server, 0, proxy, &new_proxy); - if (ret) { - fprintf(stderr, "%s: glite_renewal_core_renew() failed: %s", - argv[0], ctx->err_message); - exit(1); - } - - ret = glite_renewal_core_destroy_ctx(ctx); - - printf("%s\n", new_proxy); - - return 0; -} diff --git a/org.glite.px.proxyrenewal/interface/renewal.h b/org.glite.px.proxyrenewal/interface/renewal.h deleted file mode 100644 index e494134..0000000 --- a/org.glite.px.proxyrenewal/interface/renewal.h +++ /dev/null @@ -1,181 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RENEWAL_H -#define RENEWAL_H - -#ident "$Header$" - -#ifdef RENEWAL_HAVE_JOBID -#include "glite/wmsutils/jobid/cjobid.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define EDG_WLPR_FLAG_UNIQUE 1 -#define EDG_WLPR_FLAG_UPDATE 2 - -typedef enum _edg_wlpr_ErrorCode { -/** - * Base for proxy renewal specific code. - * Start sufficently high not to collide with standard errno. */ - /* XXX see common/exception_codes.h */ - EDG_WLPR_ERROR_BASE = 1900, - EDG_WLPR_ERROR_UNEXPECTED_EOF, - EDG_WLPR_ERROR_GENERIC, - EDG_WLPR_ERROR_PROTO_PARSE_ERROR, - EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND, - EDG_WLPR_ERROR_UNKNOWN_COMMAND, - EDG_WLPR_ERROR_SSL, - EDG_WLPR_ERROR_MYPROXY, - EDG_WLPR_PROXY_NOT_REGISTERED, - EDG_WLPR_PROXY_EXPIRED, - EDG_WLPR_ERROR_VOMS, - EDG_WLPR_ERROR_TIMEOUT, - EDG_WLPR_ERROR_ERRNO, -} edg_wlpr_ErrorCode; - -/** - * Return a human readable string containg description of the errorcode - * \retval char* pointer to a error description - */ -const char * -edg_wlpr_GetErrorText(int err_code); - -/** - * This function contacts the renewal daemon and registers the specified proxy - * for periodic renewal. - * \param filename IN: specification of the proxy to register. - * \param jdl IN: JDL of the job owing the proxy. The JDL is looked for a - * myproxy server contact. - * \param flags IN: one of EDG_WLPR_FLAG_UNIQUE or EDG_WLPR_FLAG_UPDATE, or - * their bitwise OR. - * \param repository_filename OUT: filename of registered proxy in repository. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -int -edg_wlpr_RegisterProxy( - const char * filename, - const char *jdl, - int flags, - char ** repository_filename -); - -/** - * The same function as edg_wlpr_RegisterProxy() but information about the - * myproxy server and jobid are passed as parameters instead of in JDL. - */ -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_RegisterProxyExt( - const char * filename, - const char * server, - unsigned int port, - edg_wlc_JobId jobid, - int flags, - char ** repository_filename -); -#endif - -int -glite_renewal_RegisterProxy( - const char * filename, - const char * server, - unsigned int port, - const char *jobid, - int flags, - char ** repository_filename -); - -/** - * Unregister proxy from the renewal daemon. - * \param jobid IN: specification of job whose proxy shall be unregistered - * \param filename IN: (optional) specification of the proxy to unregister. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_UnregisterProxy( - edg_wlc_JobId jobid, - const char * repository_filename -); -#endif - -int -glite_renewal_UnregisterProxy( - const char * jobid, - const char * repository_filename -); - -/** - * Get a list of registered proxies maintained by the renewal daemon. - * \param count OUT: number of proxies - * \param list OUT: a list of filenames separated by '\n' - * specifying the registered proxies. - * \warning The caller is responsible for freeing the data. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -int -edg_wlpr_GetList(int *count, char **list); - -/** - * Get a status message about a proxy. - * The function contacts the renewal daemon and retrieve information it - * maintains about the proxy. - * \param filename IN: specification of the proxy to query - * \param info OUT: status message. - * \warning The caller is responsible for freeing the data. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -int -edg_wlpr_GetStatus(const char *repository_filename, char **info); - -/** - * For given jobid return registered proxy filename from repository - * \param jobid IN: specification of jobid - * \param repository_filename OUT: proxy regitered for given jobid - * \warning The caller is responsible for freeing the data. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_GetProxy(edg_wlc_JobId jobid, char **repository_filename); -#endif - -int -glite_renewal_GetProxy( - const char * jobid, - char **repository_filename); - -#ifdef __cplusplus -} -#endif - -#endif /* RENEWAL_H */ diff --git a/org.glite.px.proxyrenewal/interface/renewal_core.h b/org.glite.px.proxyrenewal/interface/renewal_core.h deleted file mode 100644 index 20f174a..0000000 --- a/org.glite.px.proxyrenewal/interface/renewal_core.h +++ /dev/null @@ -1,93 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RENEWAL_CORE_H -#define RENEWAL_CORE_H - -#ident "$Id$" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - GLITE_RENEWAL_LOG_NONE, - GLITE_RENEWAL_LOG_STDOUT, - GLITE_RENEWAL_LOG_SYSLOG, -} glite_renewal_log_dst; - -typedef struct glite_renewal_core_context_data { - int log_level; - glite_renewal_log_dst log_dst; - char *err_message; - char *voms_conf; - int order_attributes; -} glite_renewal_core_context_data; - -typedef struct glite_renewal_core_context_data *glite_renewal_core_context; - -/** - * This cal initializes the context and sets default values - */ -int -glite_renewal_core_init_ctx(glite_renewal_core_context *context); - -/** - * This call frees the context and all memory used by the context - */ -int -glite_renewal_core_destroy_ctx(glite_renewal_core_context context); - -/** - * This call tries to renew the proxy certificate using the MyProxy - * repository. If VOMS attributes are present in the proxy they are renewed - * as well. - * \param context IN: context with authentication information - * \param myproxy_server IN: hostname of the myproxy repository - * \param myproxy_port IN: TCP port of the myproxy repository, if 0 the - * default value will be used - * \param current_proxy IN: filename with the proxy to renew - * \param new_proxy OUT: filename with the renewed proxy, the caller is - * responsible for removing the file when it's not needed. - */ -int -glite_renewal_core_renew(glite_renewal_core_context context, - const char *myproxy_server, - unsigned int myproxy_port, - const char *current_proxy, - char **new_proxy); - -void -glite_renewal_core_set_err(glite_renewal_core_context ctx, const char *format, ...); - -void -glite_renewal_core_update_err(glite_renewal_core_context ctx, const char *format, ...); - -char * -glite_renewal_core_get_err(glite_renewal_core_context ctx); - -void -glite_renewal_core_reset_err(glite_renewal_core_context ctx); - -#ifdef __cplusplus -} -#endif - -#endif /* RENEWAL_CORE_H */ diff --git a/org.glite.px.proxyrenewal/project/.post b/org.glite.px.proxyrenewal/project/.post deleted file mode 100644 index 8b0c822..0000000 --- a/org.glite.px.proxyrenewal/project/.post +++ /dev/null @@ -1 +0,0 @@ -/sbin/ldconfig diff --git a/org.glite.px.proxyrenewal/project/.postun b/org.glite.px.proxyrenewal/project/.postun deleted file mode 100644 index 8b0c822..0000000 --- a/org.glite.px.proxyrenewal/project/.postun +++ /dev/null @@ -1 +0,0 @@ -/sbin/ldconfig diff --git a/org.glite.px.proxyrenewal/project/ChangeLog b/org.glite.px.proxyrenewal/project/ChangeLog deleted file mode 100644 index 7f050dc..0000000 --- a/org.glite.px.proxyrenewal/project/ChangeLog +++ /dev/null @@ -1,38 +0,0 @@ -1.3.11-5 -- Module rebuilt and moved - -1.3.12-1 -- Alternative org.glite/emi builds enabled -- VOMS headers moved for EMI/EPEL - -1.3.12-2 -- Module rebuilt - -1.3.13-1 -- Fixes for build in EMI - -1.3.14-1 -- Transfer of changes that were not taken over from glite-security-proxyrenewal by mistake -- Fixes in build -- Proper build-time defines for threaded routines - -1.3.15-1 -- Proper flavour fix of the lb.common in EMI, build fixes. - -1.3.16-1 -- Build problems with VOMS fixed - -1.3.16-2 -- Module rebuilt - -1.3.17-1 -- Build system cleanup -- removing obsolete files - -1.3.17-2 -- Module rebuilt - -1.3.18-1 -- New man pages. - -1.3.19-1 -- using rpath only as $prefix/$libdir (fixes rpmlint rpath check in mock environment) diff --git a/org.glite.px.proxyrenewal/project/package.description b/org.glite.px.proxyrenewal/project/package.description deleted file mode 100644 index dfbae4d..0000000 --- a/org.glite.px.proxyrenewal/project/package.description +++ /dev/null @@ -1 +0,0 @@ -The daemon is responsible for secure and controlled way of periodical renewal of user proxy certificates. Its primary goal is to support long-time jobs running on the grid. Package also contains C/C++ library and headers. diff --git a/org.glite.px.proxyrenewal/project/package.summary b/org.glite.px.proxyrenewal/project/package.summary deleted file mode 100644 index 1c789ae..0000000 --- a/org.glite.px.proxyrenewal/project/package.summary +++ /dev/null @@ -1 +0,0 @@ -glite-px-proxyrenewal renews existing proxy certificates for grid users diff --git a/org.glite.px.proxyrenewal/project/version.properties b/org.glite.px.proxyrenewal/project/version.properties deleted file mode 100644 index 77f3274..0000000 --- a/org.glite.px.proxyrenewal/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.3.19 -module.age=1 diff --git a/org.glite.px.proxyrenewal/src/api.c b/org.glite.px.proxyrenewal/src/api.c deleted file mode 100644 index ac092c8..0000000 --- a/org.glite.px.proxyrenewal/src/api.c +++ /dev/null @@ -1,568 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "renewal.h" -#include "renewal_locl.h" - -#ident "$Header$" - -#define SEPARATORS "\n" - -/* prototypes of static routines */ -static int -encode_request(edg_wlpr_Request *request, char **msg); - -static int -decode_response(const char *msg, const size_t msg_len, edg_wlpr_Response *response); - -static int -do_connect(char *socket_name, struct timeval *timeout, int *sock); - -static int -send_request(int sock, struct timeval *timeout, edg_wlpr_Request *request, edg_wlpr_Response *response); - -static int -encode_request(edg_wlpr_Request *request, char **msg) -{ - char *buf; - size_t buf_len; - int ret; - - buf_len = EDG_WLPR_BUF_SIZE; - buf = malloc(buf_len); - if (buf == NULL) - return ENOMEM; - buf[0] = '\0'; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_VERSION, - EDG_WLPR_VERSION, SEPARATORS); - if (ret) - goto err; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_COMMAND, - edg_wlpr_EncodeInt(request->command), - SEPARATORS); - if (ret) - goto err; - - if (request->myproxy_server) { - char host[1024]; - -#if 0 - snprintf(host, sizeof(host), "%s:%d", request->myproxy_server, - (request->myproxy_port) ? request->myproxy_port : EDG_WLPR_MYPROXY_PORT); /* XXX let server decide ? */ -#else - snprintf(host, sizeof(host), "%s", request->myproxy_server); -#endif - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - host, SEPARATORS); - if (ret) - goto err; - } - - if (request->proxy_filename) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_PROXY, - request->proxy_filename, SEPARATORS); - if (ret) - goto err; - } - - if (request->jobid) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_JOBID, - request->jobid, SEPARATORS); - if (ret) - goto err; - } - - if (request->entries) { - char **p = request->entries; - while (*p) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_ENTRY, - *p, SEPARATORS); - if (ret) - goto err; - p++; - } - } - - buf[strlen(buf)] = '\0'; - *msg = buf; - return 0; - -err: - free(buf); - *msg = NULL; - return ret; -} - -static int -decode_response(const char *msg, const size_t msg_len, edg_wlpr_Response *response) -{ - int ret; - char *value = NULL; - /* char *p; */ - int i; - int current_size = 0; - - /* XXX add an ending zero '\0' */ - - assert(msg != NULL); - assert(response != NULL); - - memset(response, 0, sizeof(*response)); - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_VERSION, SEPARATORS, - 0, &response->version); - if (ret) - goto err; - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_RESPONSE, SEPARATORS, - 0, &value); - if (ret) - goto err; - - ret = edg_wlpr_DecodeInt(value, (int *)(&response->response_code)); - free(value); - if (ret) - goto err; - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - SEPARATORS, 0, &response->myproxy_server); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - -#if 0 - response->myproxy_port = EDG_WLPR_MYPROXY_PORT; /* ??? */ - if (response->myproxy_server && (p = strchr(response->myproxy_server, ':'))) { - int port; - *p = '\0'; - port = atol(p+1); /* XXX */ - response->myproxy_port = port; - } -#endif - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_START_TIME, SEPARATORS, - 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (ret == 0) { - ret = edg_wlpr_DecodeInt(value, (int *)(&response->start_time)); - free(value); - if (ret) - goto err; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_END_TIME, SEPARATORS, - 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (ret == 0) { - ret = edg_wlpr_DecodeInt(value, (int *)(&response->end_time)); - free(value); - if (ret) - goto err; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_RENEWAL_TIME, - SEPARATORS, 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (ret == 0) { - ret = edg_wlpr_DecodeInt(value, (int *)(&response->next_renewal_time)); - free(value); - if (ret) - goto err; - } - - /* XXX Counter */ - - i = 0; - while ((ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_PROXY, - SEPARATORS, i, &value)) == 0) { - if (i >= current_size) { - char **tmp; - - tmp = realloc(response->filenames, - (current_size + 16 + 1) * sizeof(*tmp)); - if (tmp == NULL) { - ret = ENOMEM; - goto err; - } - response->filenames = tmp; - current_size += 16; - } - response->filenames[i] = value; - i++; - } - if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (response->filenames) - response->filenames[i] = NULL; - - return 0; - -err: - edg_wlpr_CleanResponse(response); - - return ret; -} - -static int -do_connect(char *socket_name, struct timeval *timeout, int *sock) -{ - struct sockaddr_un my_addr; - int s; - int ret; - struct timeval before,after; - int sock_err; - socklen_t err_len; - - assert(sock != NULL); - memset(&my_addr, 0, sizeof(my_addr)); - - s = socket(AF_UNIX, SOCK_STREAM, 0); - if (s == -1) { - return errno; - } - - if (timeout) { - int flags = fcntl(s, F_GETFL, 0); - if (fcntl(s, F_SETFL, flags | O_NONBLOCK) < 0) - return errno; - } - - my_addr.sun_family = AF_UNIX; - strncpy(my_addr.sun_path, socket_name, sizeof(my_addr.sun_path)); - - ret = connect(s, (struct sockaddr *) &my_addr, sizeof(my_addr)); - if (ret == -1) { - if (errno == EINPROGRESS) { - struct pollfd pollfds[1]; - - pollfds[0].fd = s; - pollfds[0].events = POLLOUT; - - gettimeofday(&before,NULL); - switch (poll(pollfds, 1, timeout->tv_sec*1000+timeout->tv_usec/1000)) { - case -1: close(s); - return errno; - case 0: close(s); - return EDG_WLPR_ERROR_TIMEOUT; - } - gettimeofday(&after,NULL); - if (edg_wlpr_DecrementTimeout(timeout, before, after)) { - close (s); - return EDG_WLPR_ERROR_TIMEOUT; - } - - err_len = sizeof sock_err; - if (getsockopt(s,SOL_SOCKET,SO_ERROR,&sock_err,&err_len)) { - close(s); - return errno; - } - if (sock_err) { - close(s); - errno = sock_err; - return errno; - } - } else { - close(s); - return errno; - } - } - - *sock = s; - return 0; -} - -static int -send_request(int sock, struct timeval *timeout, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - int ret; - char *buf = NULL; - size_t buf_len; - - /* timeouts ?? */ - - ret = encode_request(request, &buf); - if (ret) - return ret; - - ret = edg_wlpr_Write(sock, timeout, buf, strlen(buf) + 1); - free(buf); - if (ret) - return ret; - - ret = edg_wlpr_Read(sock, timeout, &buf, &buf_len); - if (ret) - return ret; - - ret = decode_response(buf, buf_len, response); - free(buf); - if (ret) - return ret; - - return 0; -} - -int -edg_wlpr_RequestSend(edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - char sockname[1024]; - int ret; - int sock; - struct timeval timeout; - const char *s = NULL; - double d; - - s = getenv("GLITE_PR_TIMEOUT"); - d = s ? atof(s) : GLITE_PR_TIMEOUT_DEFAULT; - timeout.tv_sec = (long) d; - timeout.tv_usec = (long) ((d-timeout.tv_sec) * 1e6); - - snprintf(sockname, sizeof(sockname), "%s%d", - DGPR_REG_SOCKET_NAME_ROOT, getuid()); - ret = do_connect(sockname, &timeout, &sock); - if (ret) - return ret; - - ret = send_request(sock, &timeout, request, response); - - close(sock); - return ret; -} - -int -glite_renewal_RegisterProxy(const char *filename, const char * server, - unsigned int port, - const char *jobid, int flags, - char **repository_filename) -{ - edg_wlpr_Request request; - edg_wlpr_Response response; - int ret; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - if (jobid == NULL) - return EINVAL; - - request.command = EDG_WLPR_COMMAND_REG; - request.myproxy_server = server; - request.proxy_filename = filename; - request.jobid = strdup(jobid); - if (request.jobid == NULL) - return ENOMEM; - - ret = edg_wlpr_RequestSend(&request, &response); - free(request.jobid); - if (ret == 0 && response.response_code == 0 && repository_filename && - response.filenames && response.filenames[0] ) - *repository_filename = strdup(response.filenames[0]); - - if (ret == 0) - ret = response.response_code; - - edg_wlpr_CleanResponse(&response); - - return ret; -} - -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_RegisterProxyExt(const char *filename, const char * server, - unsigned int port, - edg_wlc_JobId jobid, int flags, - char **repository_filename) -{ - char *ji; - int ret; - - ji = edg_wlc_JobIdUnparse(jobid); - if (ji == NULL) - return EINVAL; - - ret = glite_renewal_RegisterProxy(filename, server, port, ji, flags, - repository_filename); - free(ji); - return ret; -} -#endif /* RENEWAL_HAVE_JOBID */ - -#if 0 -int -edg_wlpr_RegisterProxy(const char *filename, const char *jdl, - int flags, char **repository_filename) -{ - char server[1024]; - size_t server_len; - unsigned int port = 0; - char *p, *q; - - memset(server, 0, sizeof(server)); - - /* parse JDL and find information about myproxy server */ - p = strstr(jdl, JDL_MYPROXY); - if (p == NULL) - return 0; /* XXX */ - q = strchr(p, '\n'); /* XXX */ - if (q) - server_len = q - p; - else - server_len = jdl + strlen(jdl) - p; - if (server_len >= sizeof(server)) - return EINVAL; /* XXX */ - strncmp(server, p, sizeof(server)); - - return (edg_wlpr_RegisterProxyExt(filename, server, port, NULL, flags, - repository_filename)); -} -#endif - -int -glite_renewal_UnregisterProxy(const char *jobid, const char *repository_filename) -{ - edg_wlpr_Request request; - edg_wlpr_Response response; - int ret; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - if (jobid == NULL) - return EINVAL; - - request.command = EDG_WLPR_COMMAND_UNREG; - request.proxy_filename = repository_filename; - request.jobid = strdup(jobid); - if (request.jobid == NULL) - return ENOMEM; - - ret = edg_wlpr_RequestSend(&request, &response); - free(request.jobid); - - if (ret == 0) - ret = response.response_code; - edg_wlpr_CleanResponse(&response); - - return ret; -} - -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_UnregisterProxy(edg_wlc_JobId jobid, const char *repository_filename) -{ - char *ji; - int ret; - - ji = edg_wlc_JobIdUnparse(jobid); - if (ji == NULL) - return EINVAL; - ret = glite_renewal_UnregisterProxy(ji, repository_filename); - free(ji); - return ret; -} -#endif /* RENEWAL_HAVE_JOBID */ - -int -edg_wlpr_GetList(int *count, char **list) -{ - return ENOSYS; /* XXX */ -} - -int -edg_wlpr_GetStatus(const char *filename, char **info) -{ - return ENOSYS; /* XXX */ -} - -static const char* const errTexts[] = { - "Unexpected EOF from peer", - "Generic error", - "Protocol parse error", - "Compulsory element not found in message", - "Unknown protocol command", - "SSL error", - "Error from Myproxy server", - "Proxy not registered", - "Proxy expired", - "VOMS error", - "Operation timed out", - "System error" -}; - -const char * -edg_wlpr_GetErrorText(int code) -{ - return code ? - (code <= EDG_WLPR_ERROR_BASE ? - strerror(code) : - errTexts[code - EDG_WLPR_ERROR_BASE - 1] - ) : - NULL; -} - -int -glite_renewal_GetProxy(const char *jobid, char **repository_filename) -{ - edg_wlpr_Request request; - edg_wlpr_Response response; - int ret; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - if (jobid == NULL) - return EINVAL; - - request.command = EDG_WLPR_COMMAND_GET; - request.jobid = strdup(jobid); - if (request.jobid == NULL) - return ENOMEM; - - ret = edg_wlpr_RequestSend(&request, &response); - free(request.jobid); - - if (ret == 0 && response.response_code == 0 && repository_filename && - response.filenames && response.filenames[0] ) - *repository_filename = strdup(response.filenames[0]); - - if (ret == 0) - ret = response.response_code; - edg_wlpr_CleanResponse(&response); - - return ret; -} - -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_GetProxy(edg_wlc_JobId jobid, char **repository_filename) -{ - char *ji; - int ret; - - ji = edg_wlc_JobIdUnparse(jobid); - if (ji == NULL) - return EINVAL; - - ret = glite_renewal_GetProxy(ji, repository_filename); - free(ji); - return ret; -} -#endif /* RENEWAL_HAVE_JOBID */ diff --git a/org.glite.px.proxyrenewal/src/client.c b/org.glite.px.proxyrenewal/src/client.c deleted file mode 100644 index 4ef0984..0000000 --- a/org.glite.px.proxyrenewal/src/client.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include -#include "renewal.h" - -static const char rcsid[] = "$Header$"; - -static struct option const long_options[] = { - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'v' }, - { "server", required_argument, 0, 's' }, - { "port", required_argument, 0, 'p' }, - { "file", required_argument, 0, 'f' }, - { "jobid", required_argument, 0, 'j' }, - { NULL, 0, NULL, 0} -}; - -static char short_options[] = "hvs:p:f:j:"; - -static void -usage(exit_code) -{ - fprintf(stdout, "Usage: edg-wl-renew [option] operation\n" - "\t-s myproxy_server [-p port] -f filename -j jobid start |\n" - "\t-j jobid [-f filename] stop |\n" - "\t-j jobid get\n" - "-h, --help display this help and exit\n" - "-v, --version output version information and exit\n" - "-s, --server address of myproxy server\n" - "-p, --port port of myproxy server\n" - "-f, --file filename with proxy\n" - "-j, --jobid datagrid jobid\n"); - exit(exit_code); -} - -int -main(int argc, char *argv[]) -{ - char *server = NULL; - int port = 0; - char *proxyfile = NULL; - char *jobid_str = NULL; - char *repository_filename = NULL; - int ret; - int arg; - extern int optind; - - while ((arg = getopt_long(argc, argv, - short_options, long_options, (int *) 0)) != EOF) - switch(arg) { - case 'h': - usage(0); break; - case 'v': - fprintf(stdout, "%s:\t%s\n", argv[0], rcsid); exit(0); - case 's': - server = strdup(optarg); break; - case 'p': - port = atoi(optarg); break; - case 'f': - proxyfile = strdup(optarg); break; - case 'j': - jobid_str = strdup(optarg); break; - default: - usage(1); break; - } - - if (optind >= argc) - usage(1); - - if (strcmp(argv[optind], "start") == 0) { - if (proxyfile == NULL || server == NULL || jobid_str == NULL) - usage(1); - ret = glite_renewal_RegisterProxy(proxyfile, server, port, jobid_str, 0, - &repository_filename); - if (ret) { - fprintf(stderr, "Registering proxy failed: %s\n", - edg_wlpr_GetErrorText(ret)); - exit(1); - } - printf("%s\n", repository_filename); - free(repository_filename); - exit(0); - } - else if (strcmp(argv[optind], "stop") == 0) { - if (jobid_str == NULL) - usage(1); - ret = glite_renewal_UnregisterProxy(jobid_str, proxyfile); - if (ret) { - fprintf(stderr, "Unregistering proxy failed: %s\n", - edg_wlpr_GetErrorText(ret)); - exit(1); - } - } - else if (strcmp(argv[optind], "get") == 0) { - if (jobid_str == NULL) - usage(1); - ret = glite_renewal_GetProxy(jobid_str, &proxyfile); - if (ret) { - fprintf(stderr, "GET request failed: %s\n", - edg_wlpr_GetErrorText(ret)); - exit(1); - } - printf("%s\n", proxyfile); - free(proxyfile); - } - else - usage(1); - - return 0; -} diff --git a/org.glite.px.proxyrenewal/src/commands.c b/org.glite.px.proxyrenewal/src/commands.c deleted file mode 100644 index 43e6d2e..0000000 --- a/org.glite.px.proxyrenewal/src/commands.c +++ /dev/null @@ -1,1345 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "renewal_locl.h" -#include "renewd_locl.h" - -#include "voms/voms_apic.h" - -#ident "$Header$" - -#define SEPARATORS ",\n" -#define RENEWAL_START_FRACTION 0.75 /* XXX */ -#define RENEWAL_MIN_LIFETIME (15 * 60) - -extern char *repository; -extern time_t condor_limit; -extern int voms_enabled; - -static char * -strmd5(glite_renewal_core_context ctx, const char *s, unsigned char *digest); - -static int -get_record_ext(glite_renewal_core_context ctx, FILE *fd, const char *basename, proxy_record *record, int *last_used_suffix); - -static int -get_record(glite_renewal_core_context ctx, FILE *fd, const char *basename, proxy_record *record); - -static int -store_record(glite_renewal_core_context ctx, char *basename, proxy_record *record); - -static int -copy_file_content(glite_renewal_core_context ctx, FILE *in, FILE *out); - -static int -copy_file(glite_renewal_core_context ctx, char *src, char *dst); - -static int -get_base_filename(glite_renewal_core_context ctx, char *proxy_file, char **basefilename); - -int -encode_record(glite_renewal_core_context ctx, proxy_record *record, char **line); - -static int -open_metafile(glite_renewal_core_context ctx, char *proxy_file, FILE **fd); - -void -free_record(glite_renewal_core_context ctx, proxy_record *record); - -static int -realloc_prd_list(glite_renewal_core_context ctx, prd_list *list); - -/* make public: */ -static int -edg_wlpr_GetTokenInt(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, int *value); - -static void -record_to_response(glite_renewal_core_context ctx, int status_code, proxy_record *record, - edg_wlpr_Response *response); - -static int -filename_to_response(glite_renewal_core_context ctx, char *filename, edg_wlpr_Response *response); - -static char * -strmd5(glite_renewal_core_context ctx, const char *s, unsigned char *digest) -{ - MD5_CTX md5; - unsigned char d[16]; - int i; - static char mbuf[33]; - - MD5_Init(&md5); - MD5_Update(&md5,s,strlen(s)); - MD5_Final(d,&md5); - - if (digest) - memcpy(digest,d,sizeof(d)); - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - mbuf[32] = 0; - return mbuf; -} - -static int -get_base_filename(glite_renewal_core_context ctx, char *proxy_file, char **basefilename) -{ - char *subject = NULL; - char file[FILENAME_MAX]; - int ret; - - assert(basefilename != NULL); - - ret = get_proxy_base_name(ctx, proxy_file, &subject); - if (ret) - goto end; - - snprintf(file, sizeof(file), "%s/%s", repository, strmd5(ctx, subject, NULL)); - *basefilename = strdup(file); /* XXX test ENOMEM */ - ret = 0; - -end: - if (subject) - free(subject); - return ret; -} - -static int -copy_file_content(glite_renewal_core_context ctx, FILE *in, FILE *out) -{ - char buf[1024]; - size_t num; - int ret; - - while (1) { - num = fread(buf, sizeof(*buf), sizeof(buf), in); - if ((ret = ferror(in))) { - glite_renewal_core_set_err(ctx, "Reading failed: %s", strerror(errno)); - return ret; - } - num = fwrite(buf, sizeof(*buf), num, out); - if ((ret = ferror(in))) { - glite_renewal_core_set_err(ctx, "Writing failed: %s", strerror(errno)); - return ret; - } - if (feof(in)) - return 0; - } -} - -/* return the time interval, after which the renewal should be started */ -static time_t -get_delta(glite_renewal_core_context ctx, time_t current_time, time_t end_time) -{ - time_t remaining_life; - time_t life_to_lose; - time_t limit; - time_t delta; - - if (RENEWAL_MIN_LIFETIME > condor_limit) { - limit = RENEWAL_MIN_LIFETIME; - } else { - limit = condor_limit; - } - - limit += RENEWAL_CLOCK_SKEW; - - /* if the proxy is too short, renew it as soon as possible */ - if (current_time + limit >= end_time) - return 0; - - remaining_life = end_time - current_time; - - /* renewal should gain the jobs an extra lifetime of - RENEWAL_START_FRACTION (default 3/4) of the new proxy's - lifetime. If the time remaining on the current proxy is already - small then the jobs may gain an extra lifetime of more than that. - - In any case, a renewal will be scheduled to happen before the - lifetime limit. - - 'life_to_lose' is the lifetime that will be lost, ie the time that - will still remain on the current proxy when it is renewed - */ - - life_to_lose = (1.0-RENEWAL_START_FRACTION)*60*60*DGPR_RETRIEVE_DEFAULT_HOURS; - - if (life_to_lose < limit) { - life_to_lose = limit; - } - - delta = life_to_lose - limit; - - while( remaining_life < (limit + delta) ) { - delta *= (1.0-RENEWAL_START_FRACTION); - } - - life_to_lose = limit + delta; - - return (remaining_life - life_to_lose); -} - -int -get_times(glite_renewal_core_context ctx, char *proxy_file, proxy_record *record) -{ - X509 *cert = NULL; - STACK_OF(X509) *chain = NULL; - int ret, i; - time_t now, end_time, end_time_x509; - struct vomsdata *voms_data = NULL; - struct voms **voms_cert = NULL; - ASN1_UTCTIME *t; - time_t delta; - char *s, *c; - - ret = load_proxy(ctx, proxy_file, &cert, NULL, &chain, NULL); - if (ret) - return ret; - - ret = get_voms_cert(ctx, cert, chain, &voms_data); - if (ret) - goto end; - - end_time = 0; - if (voms_data != NULL) { - for (voms_cert = voms_data->data; voms_cert && *voms_cert; voms_cert++) { - t = ASN1_UTCTIME_new(); - if (t == NULL) { - glite_renewal_core_set_err(ctx, "ASN1_UTCTIME_new() failed"); - ret = 1; - goto end; - } - - /* date2 contains a GENERALIZEDTIME format (YYYYMMDDHHSS[.fff]Z) - * value, which must be converted to the UTC (YYMMDDHHSSZ) format */ - s = strdup((*voms_cert)->date2 + 2); - if (s == NULL) { - glite_renewal_core_set_err(ctx, "Not enough memory"); - ret = ENOMEM; - goto end; - } - c = strchr(s, '.'); - if (c) { - *c++ = 'Z'; - *c = '\0'; - } - ret = ASN1_UTCTIME_set_string(t, s); - if (ret == 0) { - glite_renewal_core_set_err(ctx, "ASN1_UTCTIME_set_string() failed\n"); - ret = 1; - free(s); - goto end; - } - - if (end_time == 0 || ASN1_UTCTIME_cmp_time_t(t, end_time) < 0) - globus_gsi_cert_utils_make_time(t, &end_time); - - ASN1_UTCTIME_free(t); - free(s); - } - s = ctime(&end_time); - if ((c = strchr(s, '\n'))) - *c = '\0'; - edg_wlpr_Log(ctx, LOG_DEBUG, - "The shortest VOMS cert expires on %s", s); - } - - globus_gsi_cert_utils_make_time(X509_get_notAfter(cert), &end_time_x509); - if (end_time_x509 < end_time || end_time == 0) - end_time = end_time_x509; - - s = ctime(&end_time_x509); - if ((c = strchr(s, '\n'))) - *c = '\0'; - edg_wlpr_Log(ctx, LOG_DEBUG, "X.509 proxy credential expires on %s", s); - - now = time(NULL); - if (end_time_x509 + RENEWAL_CLOCK_SKEW < now) { - glite_renewal_core_set_err(ctx, "Expired proxy in %s", proxy_file); - ret = EDG_WLPR_PROXY_EXPIRED; - goto end; - } - - /* Myproxy seems not to do check on expiration and return expired proxies - if credentials in repository are expired */ - for (i = 0; i < sk_X509_num(chain); i++) { - t = X509_get_notAfter(sk_X509_value(chain, i)); - if (ASN1_UTCTIME_cmp_time_t(t, now - RENEWAL_CLOCK_SKEW) < 0) { - glite_renewal_core_set_err(ctx, "Expired proxy in %s", proxy_file); - ret = EDG_WLPR_PROXY_EXPIRED; - goto end; - } - } - - if (now + condor_limit > end_time_x509) { - edg_wlpr_Log(ctx, LOG_WARNING, "Remaining proxy lifetime fell below the value of the Condor limit!"); - delta = 0; - } else - delta = get_delta(ctx, now, end_time); - - record->next_renewal = now + delta; - record->end_time = end_time_x509; - ret = 0; - - s = ctime(&record->next_renewal); - if ((c = strchr(s, '\n'))) - *c = '\0'; - edg_wlpr_Log(ctx, LOG_DEBUG, "Next renewal will be attempted on %s", s); - -end: - if (voms_data) - VOMS_Destroy(voms_data); - if (chain) - sk_X509_pop_free(chain, X509_free); - if (cert) - X509_free(cert); - - return ret; -} - -static int -copy_file(glite_renewal_core_context ctx, char *src, char *dst) -{ - FILE *from = NULL; - FILE *tmp_to = NULL; - int tmp_fd; - char tmpfile[FILENAME_MAX]; - int ret; - - if (strcmp(src, dst) == 0) - return 0; - - from = fopen(src, "r"); - if (from == NULL) { - glite_renewal_core_set_err(ctx, "Cannot open file %s for reading (%s)", - src, strerror(errno)); - return errno; - } - - snprintf(tmpfile, sizeof(tmpfile), "%s.XXXXXX", dst); - tmp_fd = mkstemp(tmpfile); - if (tmp_fd == -1) { - glite_renewal_core_set_err(ctx, "Cannot create temporary file (%s)", - strerror(errno)); - ret = errno; - goto end; - } - - - tmp_to = fdopen(tmp_fd, "w"); - if (tmp_to == NULL) { - glite_renewal_core_set_err(ctx, "Cannot associate stream with temporary file (%s)", - strerror(errno)); - unlink(tmpfile); - ret = errno; - goto end; - } - - ret = copy_file_content(ctx, from, tmp_to); - fclose(tmp_to); - if (ret) { - goto end; - } - - ret = rename(tmpfile, dst); - if (ret) { - glite_renewal_core_set_err(ctx, "Cannot replace repository file %s with temporary file (%s)", - strerror(errno)); - unlink(tmpfile); - ret = errno; - goto end; - } - tmp_to = NULL; - -end: - fclose(from); - close(tmp_fd); - unlink(tmpfile); - - return ret; -} - -void -free_prd_list(glite_renewal_core_context ctx, prd_list *list) -{ - int i; - - if (list == NULL || list->val == NULL) - return; - for (i = 0; i < list->len; i++) - free(list->val[i]); - free(list->val); - list->val = NULL; - list->len = 0; -} - -void -free_record(glite_renewal_core_context ctx, proxy_record *record) -{ - int i; - - if (record == NULL) - return; - if (record->myproxy_server) - free(record->myproxy_server); - if (record->fqans) - free(record->fqans); - free_prd_list(ctx, &record->jobids); - memset(record, 0, sizeof(*record)); -} - -static int -realloc_prd_list(glite_renewal_core_context ctx, prd_list *list) -{ - char **tmp; - - tmp = realloc(list->val, (list->len + 1) * sizeof(*list->val)); - if (tmp == NULL) - return ENOMEM; - list->val = tmp; - list->len++; - return 0; -} - -static int -load_jobids(glite_renewal_core_context ctx, const char *basename, proxy_record *record) -{ - char file[FILENAME_MAX]; - char line[512], *p; - FILE *f; - int ret; - - snprintf(file, sizeof(file), "%s.%u.jobs", basename, record->suffix); - f = fopen(file, "r"); - if (f == NULL) - return -1; - - free_prd_list(ctx, &record->jobids); - - while (fgets(line, sizeof(line), f) != NULL) { - p = strchr(line, '\n'); - if (p == NULL) { - free_prd_list(ctx, &record->jobids); - fclose(f); - return -1; - } - *p = '\0'; - - ret = realloc_prd_list(ctx, &record->jobids); - if (ret) { - free_prd_list(ctx, &record->jobids); - fclose(f); - return -1; - } - record->jobids.val[record->jobids.len - 1] = strdup(line); - } - - fclose(f); - return 0; -} - -static int -save_jobids(glite_renewal_core_context ctx, const char *basename, proxy_record *record) -{ - FILE *f; - char file[FILENAME_MAX]; - int i; - - snprintf(file, sizeof(file), "%s.%u.jobs", basename, record->suffix); - f = fopen(file, "w"); - if (f == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Failed to open jobids index (%s)", strerror(errno)); - return -1; - } - for (i = 0; i < record->jobids.len; i++) { - fputs(record->jobids.val[i], f); - fputc('\n', f); - } - fclose(f); -} - - -static int -get_jobids(glite_renewal_core_context ctx, const char *basename, const char *msg, const size_t msg_len, proxy_record *record) -{ - int index = 0; - int ret; - char *value; - char **tmp; - - memset(&record->jobids, 0, sizeof(record->jobids)); - - ret = load_jobids(ctx, basename, record); - if (ret == 0) - return 0; - - while ((ret = edg_wlpr_GetToken(msg, msg_len, "jobid=", SEPARATORS, - index, &value)) == 0) { - tmp = realloc(record->jobids.val, (record->jobids.len + 1) * sizeof(*tmp)); - if (tmp == NULL) { - ret = ENOMEM; - break; - } - record->jobids.val = tmp; - record->jobids.val[index] = value; - record->jobids.len++; - index++; - } - if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - if (record->jobids.len) - free(record->jobids.val); - record->jobids.len = 0; - record->jobids.val = NULL; - return ret; - } - - return 0; -} - -static int -edg_wlpr_GetTokenInt(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, int *value) -{ - int ret; - char *str_value = NULL; - - ret = edg_wlpr_GetToken(msg, msg_len, key, separators, req_index, &str_value); - if (ret) - return ret; - - ret = edg_wlpr_DecodeInt(str_value, value); - free(str_value); - return ret; -} - -int -decode_record(glite_renewal_core_context ctx, const char *basename, char *line, proxy_record *record) -{ - /* line must be ended with '\0' */ - int ret; - size_t len; - - assert(line != NULL); - assert(record != NULL); - - memset(record, 0, sizeof(*record)); - - len = strlen(line) + 1; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "suffix=", SEPARATORS, 0, - &record->suffix); - if (ret) - return ret; - -#if 0 - ret = edg_wlpr_GetTokenInt(ctx, line, len, "counter=", SEPARATORS, 0, - &record->counter); - if (ret) - goto end; -#endif - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "unique=", SEPARATORS, 0, - &record->unique); - if (ret) - goto end; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "voms_exts=", SEPARATORS, 0, - &record->voms_exts); - - edg_wlpr_GetToken(line, len, "fqans=", SEPARATORS, 0, &record->fqans); - - ret = edg_wlpr_GetToken(line, len, "server=", SEPARATORS, 0, - &record->myproxy_server); - if (ret) - goto end; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "next_renewal=", SEPARATORS, 0, - (int *)&record->next_renewal); - if (ret) - goto end; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "end_time=", SEPARATORS, 0, - (int *)&record->end_time); - if (ret) - goto end; - - ret = get_jobids(ctx, basename, line, len, record); - if (ret) - goto end; - -end: - if (ret) - free_record(ctx, record); - - return ret; -} - -int -encode_record(glite_renewal_core_context ctx, proxy_record *record, char **line) -{ - char tmp_line[1024]; - size_t jobids_len = 0; - int i; - - snprintf(tmp_line, sizeof(tmp_line), "suffix=%d, unique=%d, voms_exts=%d, server=%s, next_renewal=%ld, end_time=%ld", - record->suffix, record->unique, record->voms_exts, - (record->myproxy_server) ? record->myproxy_server : "", - record->next_renewal, record->end_time); - if (record->fqans) { - strncat(tmp_line, ", fqans=", sizeof(tmp_line)); - strncat(tmp_line, record->fqans, sizeof(tmp_line)); - } - *line = strdup(tmp_line); - - return 0; -} - -/* Get proxy record from the index file. If no suffix is defined return a free - record with the smallest index */ -static int -get_record_ext(glite_renewal_core_context ctx, FILE *fd, const char *basename, proxy_record *record, int *last_used_suffix) -{ - char line[EDG_WLPR_SIZE]; - int last_suffix = -1; - int first_unused = -1; - int ret; - char *p; - proxy_record tmp_record; - time_t current_time; - int line_num = 0; - - assert(record != NULL); - memset(&tmp_record, 0, sizeof(tmp_record)); - - current_time = time(NULL); - while (fgets(line, sizeof(line), fd) != NULL) { - line_num++; - free_record(ctx, &tmp_record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, basename, line, &tmp_record); - if (ret) { - edg_wlpr_Log(ctx, LOG_WARNING, "Skipping invalid entry at line %d", line_num); - continue; - } - if (record->suffix >= 0) { - if (record->suffix == tmp_record.suffix) { - free_record(ctx, record); - *record = tmp_record; - return 0; - } else - continue; - } - if (tmp_record.suffix > last_suffix) - last_suffix = tmp_record.suffix; - - /* if no particular suffix was specified get the first free record - available */ - if (tmp_record.jobids.len >= MAX_PROXIES || tmp_record.unique) - continue; - - if (tmp_record.jobids.len == 0) { - if (first_unused == -1) - first_unused = tmp_record.suffix; - continue; - } - - if (record->unique) - continue; - - if (tmp_record.jobids.len > 0) { - if (record->myproxy_server && - strcmp(record->myproxy_server, tmp_record.myproxy_server) != 0) - continue; - - if (record->fqans == NULL || tmp_record.fqans == NULL) { - if (record->fqans != tmp_record.fqans) - continue; - } else - if (strcmp(record->fqans, tmp_record.fqans) != 0) - continue; - } - - if (tmp_record.jobids.len > 0 && - current_time + condor_limit + RENEWAL_CLOCK_SKEW > tmp_record.end_time) { - - /* skip expired proxy (or ones that are going to expire soon), - leaving it untouched (it will be removed after next run of the - renewal process) */ - - continue; - } - - free_record(ctx, record); - *record = tmp_record; - return 0; - } - - if (last_used_suffix) - *last_used_suffix = last_suffix; - - if (record->suffix >= 0) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Requested suffix %d not found in meta file", - record->suffix); - } else { - record->suffix = first_unused; - record->next_renewal = record->end_time = 0; - } - - free_record(ctx, &tmp_record); - - return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND; -} - -static int -get_record(glite_renewal_core_context ctx, FILE *fd, const char *basename, proxy_record *record) -{ - return get_record_ext(ctx, fd, basename, record, NULL); -} - -static int -store_record(glite_renewal_core_context ctx, char *basename, proxy_record *record) -{ - int stored = 0; - FILE *fd = NULL; - int temp; - char line[EDG_WLPR_SIZE]; - char *new_line = NULL; - int ret, i; - char *p; - proxy_record tmp_record; - char tmp_file[FILENAME_MAX]; - char meta_file[FILENAME_MAX]; - int line_num = 0; - - assert (record != NULL); - - memset(&tmp_record, 0, sizeof(tmp_record)); - - snprintf(meta_file, sizeof(meta_file), "%s.data", basename); - snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", meta_file); - - temp = mkstemp(tmp_file); - if (temp < 0) - return errno; - - fd = fopen(meta_file, "r"); - if (fd == NULL) { - ret = errno; - goto end; - } - while (fgets(line, sizeof(line), fd) != NULL) { - line_num++; - free_record(ctx, &tmp_record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, basename, line, &tmp_record); - if (ret) { - edg_wlpr_Log(ctx, LOG_WARNING, "Removing invalid entry at line %d in %s", line_num, basename); - continue; - } - if (record->suffix == tmp_record.suffix && - record->unique == tmp_record.unique) { - free_record(ctx, &tmp_record); - tmp_record = *record; - tmp_record.myproxy_server = strdup(record->myproxy_server); - tmp_record.jobids.len = 0; - tmp_record.jobids.val = NULL; - for (i = 0; i < record->jobids.len; i++) { - realloc_prd_list(ctx, &tmp_record.jobids); - tmp_record.jobids.val[tmp_record.jobids.len - 1] = - strdup(record->jobids.val[i]); - } - if (record->fqans) - tmp_record.fqans = strdup(record->fqans); - stored = 1; - } - ret = encode_record(ctx, &tmp_record, &new_line); - if (ret) - goto end; - dprintf(temp, "%s\n", new_line); - save_jobids(ctx, basename, &tmp_record); - free(new_line); - new_line = NULL; - } - if (! stored) { - ret = encode_record(ctx, record, &new_line); - if (ret) - goto end; - ret = dprintf(temp, "%s\n", new_line); - save_jobids(ctx, basename, record); - free(new_line); - new_line = NULL; - } - fclose(fd); fd = NULL; - close(temp); - - ret = rename(tmp_file, meta_file); - if (ret) - ret = errno; - -end: - free_record(ctx, &tmp_record); - if (fd) - fclose(fd); - close(temp); - return ret; -} - -static int -open_metafile(glite_renewal_core_context ctx, char *basename, FILE **fd) -{ - FILE *meta_fd; - char meta_filename[FILENAME_MAX]; - - snprintf(meta_filename, sizeof(meta_filename), "%s.data", basename); - meta_fd = fopen(meta_filename, "a+"); - if (meta_fd == NULL) { - glite_renewal_core_set_err(ctx, "Opening meta file %s failed (%s)", - meta_filename, strerror(errno)); - return errno; - } - rewind(meta_fd); - *fd = meta_fd; - return 0; -} - -static int -filename_to_response(glite_renewal_core_context ctx, char *filename, edg_wlpr_Response *response) -{ - response->filenames = malloc(2 * sizeof(*response->filenames)); - if (response->filenames == NULL) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Not enough memory"); - return errno; - } - response->filenames[0] = strdup(filename); - if (response->filenames[0] == NULL) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Not enough memory"); - free(response->filenames); - return errno; - } - response->filenames[1] = NULL; - return 0; -} - -static void -record_to_response(glite_renewal_core_context ctx, int status_code, proxy_record *record, - edg_wlpr_Response *response) -{ - /* XXX Neni struktrura proxy_record zbytecna? Mohla by se pouzivat primo - edg_wlpr_Response? */ - response->response_code = status_code; /* XXX chyba parsovatelna pres API */ - if (status_code) - return; - - if (response->myproxy_server) { - response->myproxy_server = strdup(record->myproxy_server); - if (response->myproxy_server == NULL) { - response->response_code = ENOMEM; /* XXX */ - return; - } - } - response->end_time = record->end_time; - response->next_renewal_time = record->next_renewal; - /* XXX use jobid response->counter = record->counter; */ -} - -int -check_proxyname(glite_renewal_core_context ctx, char *datafile, char *jobid, char **filename) -{ - proxy_record record; - FILE *meta_fd = NULL; - char line[EDG_WLPR_SIZE]; - char proxy[FILENAME_MAX]; - char *p; - int ret, i; - char *basename; - - memset(&record, 0, sizeof(record)); - - meta_fd = fopen(datafile, "r"); - if (meta_fd == NULL) { - glite_renewal_core_set_err(ctx, "Cannot open meta file %s (%s)", - datafile, strerror(errno)); - return errno; - } - - basename = strdup(datafile); - p = basename + strlen(basename) - strlen(".data"); - *p = '\0'; - while (fgets(line, sizeof(line), meta_fd) != NULL) { - free_record(ctx, &record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, basename, line, &record); - if (ret) - continue; /* XXX exit? */ - for (i = 0; i < record.jobids.len; i++) { - if (strcmp(jobid, record.jobids.val[i]) == 0) { - snprintf(proxy, sizeof(proxy), "%s/%s", repository, datafile); - p = strrchr(proxy, '.'); - sprintf(p, ".%d", record.suffix); - *filename = strdup(proxy); - free_record(ctx, &record); - fclose(meta_fd); - free(basename); - return 0; - } - } - } - free_record(ctx, &record); - fclose(meta_fd); - free(basename); - return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND; -} - -int -find_proxyname(glite_renewal_core_context ctx, char *jobid, char **filename) -{ - DIR *dir = NULL; - struct dirent *file; - int ret; - - chdir(repository); - - dir = opendir(repository); - if (dir == NULL) { - glite_renewal_core_set_err(ctx, "Cannot open repository directory %s (%s)", - repository, strerror(errno)); - return errno; - } - - while ((file = readdir(dir))) { - /* read files of format `md5sum`.data, where md5sum() is of fixed length - 32 chars */ - if (file->d_name == NULL || strlen(file->d_name) != 37 || - strcmp(file->d_name + 32, ".data") != 0) - continue; - ret = check_proxyname(ctx, file->d_name, jobid, filename); - if (ret == 0) { - closedir(dir); - return 0; - } - } - closedir(dir); - glite_renewal_core_set_err(ctx, "Requested proxy is not registered"); - return EDG_WLPR_PROXY_NOT_REGISTERED; -} - -void -register_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - proxy_record record; - int ret; - FILE *meta_fd = NULL; - int last_suffix; - char *basename = NULL; - char filename[FILENAME_MAX]; - - assert(request != NULL); - assert(response != NULL); - - memset(&record, 0, sizeof(record)); - memset(response, 0, sizeof(*response)); - - if (request->proxy_filename == NULL || request->jobid == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Registration request doesn't contain registration information"); - return; /* EINVAL; */ - } - - edg_wlpr_Log(ctx, LOG_DEBUG, - "Registering proxy from %s belonging to job %s", - request->proxy_filename, request->jobid); - - ret = get_base_filename(ctx, request->proxy_filename, &basename); - if (ret) - goto end; - - ret = open_metafile(ctx, basename, &meta_fd); - if (ret) - goto end; - - if (voms_enabled) { - record.fqans = get_voms_fqans(ctx, request->proxy_filename); - record.voms_exts = (record.fqans != NULL); - } - - /* Find first free record */ - record.suffix = -1; - record.myproxy_server = strdup(request->myproxy_server); - ret = get_record_ext(ctx, meta_fd, basename, &record, &last_suffix); - fclose(meta_fd); meta_fd = NULL; - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto end; - - if (ret == EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND || record.jobids.len == 0 || request->unique) { - /* create a new proxy file in the repository */ - int suffix; - - suffix = (record.jobids.len == 0 && record.suffix >= 0) ? - record.suffix : last_suffix + 1; - snprintf(filename, sizeof(filename), "%s.%d", basename, suffix); - ret = copy_file(ctx, request->proxy_filename, filename); - if (ret) - goto end; - ret = get_times(ctx, filename, &record); - if (ret) - goto end; - record.suffix = suffix; - ret = realloc_prd_list(ctx, &record.jobids); - if (ret) - goto end; - record.jobids.val[record.jobids.len - 1] = strdup(request->jobid); - record.unique = request->unique; - edg_wlpr_Log(ctx, LOG_DEBUG, "Created a new proxy file in repository (%s)", - filename); - } else { - ret = realloc_prd_list(ctx, &record.jobids); - if (ret) - goto end; - record.jobids.val[record.jobids.len - 1] = strdup(request->jobid); - snprintf(filename, sizeof(filename), "%s.%d", basename, record.suffix); - edg_wlpr_Log(ctx, LOG_DEBUG, "Incremented counter on %s", filename); - } - - ret = store_record(ctx, basename, &record); - -end: - if (meta_fd) { - fclose(meta_fd); - } - - if (basename) - free(basename); - - if (ret == 0) { - ret = filename_to_response(ctx, filename, response); - edg_wlpr_Log(ctx, LOG_INFO, - "Proxy %s of job %s has been registered as %s", - request->proxy_filename, request->jobid, filename); - } else - edg_wlpr_Log(ctx, LOG_ERR, "Failed to register proxy %s: %s", - request->proxy_filename, - glite_renewal_core_get_err(ctx)); - - record_to_response(ctx, ret, &record, response); - free_record(ctx, &record); -} - -void -unregister_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - proxy_record record; - int ret, i, index; - FILE *meta_fd = NULL; - char *basename = NULL; - char *p; - struct stat stat_buf; - - memset(&record, 0, sizeof(record)); - - if (request->jobid == NULL) { - glite_renewal_core_set_err(ctx, "Request doesn't specify jobid"); - ret = EINVAL; - goto end; - } - - edg_wlpr_Log(ctx, LOG_DEBUG, "Unregistrating proxy of job %s", - request->jobid); - - if (request->proxy_filename == NULL) { - ret = find_proxyname(ctx, request->jobid, &request->proxy_filename); - if (ret) - goto end; - } - - ret = get_base_filename(ctx, request->proxy_filename, &basename); - if (ret) { - goto end; - } - - if (strncmp(request->proxy_filename, basename, strlen(basename) != 0)) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Requested proxy %s is not from repository", - request->proxy_filename); - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - goto end; - } - - p = strrchr(request->proxy_filename, '.'); - if (p == NULL) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Requested proxy %s is not from repository", - request->proxy_filename); - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - goto end; - } - - ret = edg_wlpr_DecodeInt(p+1, &record.suffix); - if (ret) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Requested proxy %s is not from repository", - request->proxy_filename); - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - goto end; - } - - ret = open_metafile(ctx, basename, &meta_fd); - if (ret) { - /* fill in error response */ - return; - } - - ret = get_record(ctx, meta_fd, basename, &record); - if (ret) - goto end; - - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - for (i = 0; i < record.jobids.len; i++) - if (strcmp(request->jobid, record.jobids.val[i]) == 0) { - ret = 0; - break; - } - if (ret) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Requested proxy %s is not registered", - request->proxy_filename); - goto end; - } - - /* remove jobid from the list */ - index = i; - free(record.jobids.val[i]); - record.jobids.len--; - for (i = index; i < record.jobids.len; i++) - record.jobids.val[i] = record.jobids.val[i+1]; - - if (record.jobids.len == 0) { - record.unique = 0; - record.voms_exts = 0; - record.end_time = 0; - record.next_renewal = 0; - if (record.fqans) { - free(record.fqans); - record.fqans = NULL; - } - } - - ret = stat(request->proxy_filename, &stat_buf); - if (ret) { - edg_wlpr_Log(ctx, LOG_DEBUG, "Cannot stat file %s: (%s)", - request->proxy_filename, strerror(errno)); - ret = errno; - goto end; - } - - ret = store_record(ctx, basename, &record); - if (ret) - goto end; - - if (record.jobids.len == 0) - unlink(request->proxy_filename); - -end: - if (meta_fd) { - fclose(meta_fd); - } - if (basename) - free(basename); - - if (ret == 0) { - ret = filename_to_response(ctx, request->proxy_filename, response); - edg_wlpr_Log(ctx, LOG_INFO, - "Proxy %s of job %s has been unregistered", - request->proxy_filename, request->jobid); - } - else - edg_wlpr_Log(ctx, LOG_ERR, - "Failed to unregister proxy %s of job %s: %s", - (request->proxy_filename) ? request->proxy_filename : "'(null)'", - (request->jobid) ? request->jobid : "'(null)'", - glite_renewal_core_get_err(ctx)); - - record_to_response(ctx, ret, &record, response); - free_record(ctx, &record); -} - -void -get_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - char *filename = NULL; - int ret; - - memset(response, 0, sizeof(*response)); - - edg_wlpr_Log(ctx, LOG_DEBUG, "GET request for %s", request->jobid); - - if (request->jobid == NULL) { - glite_renewal_core_set_err(ctx, "Request doesn't contain jobid specification"); - ret = EINVAL; - goto end; - } - - ret = find_proxyname(ctx, request->jobid, &filename); - -end: - if (ret == 0) - ret = filename_to_response(ctx, filename, response); - else - edg_wlpr_Log(ctx, LOG_ERR, "Failed to return proxy for %s: %s", - request->jobid, - glite_renewal_core_get_err(ctx)); - if (filename) - free(filename); - response->response_code = ret; -} - -void -update_db(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - FILE *fd = NULL; - int tmp_fd = -1; - int suffix = -1; - char tmp_file[FILENAME_MAX]; - char cur_proxy[FILENAME_MAX]; - char datafile[FILENAME_MAX]; - char line[EDG_WLPR_SIZE]; - char *new_line = NULL; - char *basename, *proxy = NULL; - char **entry; - proxy_record record; - int ret; - char *p; - time_t current_time; - - memset(&record, 0, sizeof(record)); - - edg_wlpr_Log(ctx, LOG_DEBUG, "UPDATE_DB request for %s", request->proxy_filename); - - chdir(repository); - basename = request->proxy_filename; - - snprintf(datafile, sizeof(datafile), "%s.data", basename); - fd = fopen(datafile, "r"); - if (fd == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - datafile, strerror(errno)); - ret = errno; - return; - } - - snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", datafile); - tmp_fd = mkstemp(tmp_file); - if (tmp_fd < 0) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot create temporary file (%s)", - strerror(errno)); - ret = errno; - goto end; - } - - entry = request->entries; - if (entry) { - p = strchr(*entry, ':'); - *p = '\0'; - suffix = atoi(*entry); - proxy = p+1; - } - - current_time = time(NULL); - - while (fgets(line, sizeof(line), fd) != NULL) { - free_record(ctx, &record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, basename, line, &record); - if (ret) - goto end; - - if (record.suffix > suffix && entry && *entry) { - do { - entry++; - if (entry == NULL || *entry == NULL) { - suffix = -1; - break; - } - - p = strchr(*entry, ':'); - suffix = atoi(*entry); - proxy = p+1; - } while (record.suffix > suffix); - } - - if (record.suffix == suffix) { - snprintf(cur_proxy, sizeof(cur_proxy), "%s.%d", basename, suffix); - if (proxy == NULL || *proxy == '\0') { - /* if proxy isn't specified use file registered currently and - * reschedule renewal */ - if (record.end_time < current_time) { - char *server; - char jobids[FILENAME_MAX]; - /* remove file with expired proxy and clean the record in db */ - unlink(cur_proxy); - server = strdup(record.myproxy_server); - snprintf(jobids, sizeof(jobids), "%s.%u.jobs", basename, record.suffix); - unlink(jobids); - free_record(ctx, &record); - record.suffix = suffix; - record.myproxy_server = server; - edg_wlpr_Log(ctx, LOG_WARNING, "Removed expired proxy %s", cur_proxy); - } else - get_times(ctx, cur_proxy, &record); - } else { - ret = get_times(ctx, proxy, &record); - (ret == 0) ? rename(proxy, cur_proxy) : unlink(proxy); - } - } - glite_renewal_core_reset_err(ctx); - - ret = encode_record(ctx, &record, &new_line); - if (ret) - goto end; - - dprintf(tmp_fd, "%s\n", new_line); - free(new_line); - new_line = NULL; - } - free_record(ctx, &record); - - close(tmp_fd); - fclose(fd); - - rename(tmp_file, datafile); - - return; - -end: - if (fd) - fclose(fd); - unlink(tmp_file); - if (tmp_fd > 0) - close(tmp_fd); - free_record(ctx, &record); - - return; -} diff --git a/org.glite.px.proxyrenewal/src/common.c b/org.glite.px.proxyrenewal/src/common.c deleted file mode 100644 index 70daeb0..0000000 --- a/org.glite.px.proxyrenewal/src/common.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "renewal_locl.h" - -#ident "$Header$" - -/* nread() and nwrite() never return partial data */ -static int -nread(int sock, struct timeval *to, char *buf, size_t buf_len, size_t *read_len) -{ - int count; - size_t remain = buf_len; - char *cbuf = buf; - struct pollfd pollfds[1]; - struct timeval before,after; - int ret; - - if (to) { - gettimeofday(&before,NULL); - } - - while (remain > 0) { - pollfds[0].fd = sock; - pollfds[0].events = POLLIN; - switch (poll(pollfds, 1, to ? (to->tv_sec*1000+to->tv_usec/1000) : INFTIM)) { - case 0: - ret = EDG_WLPR_ERROR_TIMEOUT; - goto end; - case -1: - ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - - count = read(sock, cbuf, remain); - if (count < 0) { - if (errno == EINTR) - continue; - else { - ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - } else - if (count == 0) { - *read_len = 0; - return 0; - } - cbuf += count; - remain -= count; - } - *read_len = buf_len; - ret = 0; - -end: - if (to) { - gettimeofday(&after,NULL); - edg_wlpr_DecrementTimeout(to, before, after); - if (to->tv_sec < 0) { - to->tv_sec = 0; - to->tv_usec = 0; - } - } - - return ret; -} - -static int -nwrite(int sock, struct timeval *to, const char *buf, size_t buf_len) -{ - const char *cbuf = buf; - int count; - size_t remain = buf_len; - struct pollfd pollfds[1]; - struct timeval before,after; - int ret; - - if (to) { - gettimeofday(&before,NULL); - } - - while (remain > 0) { - pollfds[0].fd = sock; - pollfds[0].events = POLLOUT; - switch (poll(pollfds, 1, to ? (to->tv_sec*1000+to->tv_usec/1000) : INFTIM)) { - case 0: ret = EDG_WLPR_ERROR_TIMEOUT; - goto end; - case -1: ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - - count = write(sock, cbuf, remain); - if (count < 0) { - if (errno == EINTR) - continue; - else { - ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - } - cbuf += count; - remain -= count; - } - ret = 0; - -end: - if (to) { - gettimeofday(&after,NULL); - edg_wlpr_DecrementTimeout(to, before, after); - if (to->tv_sec < 0) { - to->tv_sec = 0; - to->tv_usec = 0; - } - } - - return ret; -} - -int -edg_wlpr_Read(int sock, struct timeval *timeout, char **buf, size_t *buf_len) -{ - int ret; - unsigned char length[4]; - size_t len; - - ret = nread(sock, timeout, length, 4, &len); - if (ret) { - *buf_len = 0; - return ret; - } - if (len != 4) { - *buf_len = 0; - return EDG_WLPR_ERROR_UNEXPECTED_EOF; /* XXX vraci i kdyz peer spadne a zavre trubku */ - } - *buf_len = (length[0] << 24) | - (length[1] << 16) | - (length[2] << 8 ) | - (length[3] << 0); - - *buf = malloc(*buf_len); - if (*buf == NULL) - return ENOMEM; - - ret = nread(sock, timeout, *buf, *buf_len, &len); - if (ret) - return ret; - - if (len != *buf_len) { - free(*buf); - *buf_len = 0; - return EDG_WLPR_ERROR_UNEXPECTED_EOF; /* XXX */ - } - - return 0; -} - -int -edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len) -{ - unsigned char length[4]; - int ret; - - length[0] = (buf_len >> 24) & 0xFF; - length[1] = (buf_len >> 16) & 0xFF; - length[2] = (buf_len >> 8) & 0xFF; - length[3] = (buf_len >> 0) & 0xFF; - - if ((ret = nwrite(sock, timeout, length, 4)) != 0 || - (ret = nwrite(sock, timeout, buf, buf_len)) != 0) - return ret; - - return 0; -} - -int -edg_wlpr_GetToken(const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, char **value) -{ - char *p; - size_t len; - int index; - - assert(separators != NULL); - - /* Add ending zero ? */ - - index = 0; - p = (char *)msg; - while (p && (p = strstr(p, key))) { - if (index == req_index) - break; - index++; - p += strlen(key); - } - if (p == NULL) - return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND; - - p = strchr(p, '='); - if (p == NULL) - return EDG_WLPR_ERROR_PROTO_PARSE_ERROR; - - len = strcspn(p+1, separators); - if (len == 0) - return EDG_WLPR_ERROR_PROTO_PARSE_ERROR; - - *value = malloc(len + 1); - if (*value == NULL) - return ENOMEM; - - memcpy(*value, p+1, len); - (*value)[len] = '\0'; - - return 0; -} - -int -edg_wlpr_StoreToken(char **buf, size_t *buf_len, char *command, - char *value, const char *separator) -{ - char line[2048]; - char *tmp; - - assert(buf != NULL); - assert(separator != NULL); - - if (strlen(command) + 1 + strlen(value) + 2 > sizeof(line)) - return ERANGE; /* XXX */ - - snprintf(line, sizeof(line), "%s%s%s", command, value, separator); - - while (strlen(*buf) + strlen(line) + 1 > *buf_len) { - tmp = realloc(*buf, *buf_len + EDG_WLPR_BUF_SIZE); - if (tmp == NULL) - return ENOMEM; - *buf = tmp; - *buf_len += EDG_WLPR_BUF_SIZE; - } - strcat(*buf, line); - - return 0; -} - -void -edg_wlpr_CleanRequest(edg_wlpr_Request *request) -{ - assert(request != NULL); - if (request->version) - free(request->version); - if (request->proxy_filename) - free(request->proxy_filename); - if (request->myproxy_server) - free(request->myproxy_server); - if (request->jobid) - free(request->jobid); - if (request->entries) { - char **p = request->entries; - char **next; - while (*p) { - next = p+1; - free(*p); - p = next; - } - free(request->entries); - } - - memset(request, 0, sizeof(request)); -} - -void -edg_wlpr_CleanResponse(edg_wlpr_Response *response) -{ - assert(response != NULL); - if (response->version) - free(response->version); - if (response->myproxy_server) - free(response->myproxy_server); - if (response->filenames) { - char **p = response->filenames; - char **next; - - while (*p) { - next = p+1; - free(*p); - p = next; - } - free(response->filenames); - } - memset(response, 0, sizeof(*response)); -} - -const char * -edg_wlpr_GetErrorString(int code) -{ - return (code == 0) ? "OK" : "Error"; -} - -char * -edg_wlpr_EncodeInt(int num) /* long? time */ -{ - static char ret[64]; - - snprintf(ret, sizeof(ret), "%d", num); - return ret; -} - -int -edg_wlpr_DecodeInt(char *str, int *num) -{ - *num = atol(str); /* XXX */ - return 0; -} - -int -edg_wlpr_DecrementTimeout(struct timeval *timeout, struct timeval before, struct timeval after) -{ - (*timeout).tv_sec = (*timeout).tv_sec - (after.tv_sec - before.tv_sec); - (*timeout).tv_usec = (*timeout).tv_usec - (after.tv_usec - before.tv_usec); - while ( (*timeout).tv_usec < 0) { - (*timeout).tv_sec--; - (*timeout).tv_usec += 1000000; - } - - if ( ((*timeout).tv_sec < 0) || (((*timeout).tv_sec == 0) && ((*timeout).tv_usec == 0)) ) return(1); - else return(0); -} diff --git a/org.glite.px.proxyrenewal/src/glite-proxy-renew.1 b/org.glite.px.proxyrenewal/src/glite-proxy-renew.1 deleted file mode 100644 index 44bc829..0000000 --- a/org.glite.px.proxyrenewal/src/glite-proxy-renew.1 +++ /dev/null @@ -1,85 +0,0 @@ -.TH GLITE-PROXY-RENEW 1 "April 2011" "EU EMI Project" "Proxy renewal" - -.SH NAME -glite-proxy-renew - simple client for the proxy renewal daemon. - -.SH SYNOPSIS -.B glite-proxy-renew -.RI -j " " [ options ] " command" -.br - -.SH DESCRIPTION -.B glite-proxy-renew -communicates with the proxy renewal daemon and allows administrators to -check it functions correctly. It is not meant to be used regularly or by -regular users. - -.SH COMMANDS -.TP -.BI "start " -Register a proxy -with the renewal daemon to keep it renewed. The name of the -file from the repository is returned as the result. The -.BI \-f " FILE" "\fR,\fP --file " FILE -option must be given. - -.TP -.BI "stop " -Unregisters a proxy from the renewal repository. The proxy file will be removed. - -.TP -.BI get -Lookup the renewal repository to find whether a proxy for the jobid is -registered. If found, the command returns the filename from the -repository. - -.SH OPTIONS -.TP -.BI \-f " FILE" "\fR,\fP --file " FILE -Specifies the filename containing the proxy certificate that should be -renewed. - -.TP -.BI \-h "\fR,\fP --help " -Display a list of valid options. - -.TP -.BI \-j " JOBID" "\fR,\fP --jobid " JOBID -Specifies the job id that is uniquely tied with the proxy. -This option is obligatory and is required for all commands. - -.TP -.BI \-p " PORT" "\fR,\fP --port " PORT -Specifies port of the MyProxy server, which should be used to renew the -proxy. - -.TP -.BI \-s " SERVER" "\fR,\fP --server " SERVER -Specifies the name of the MyProxy server, which should be used to renew the -proxy. - -.TP -.BI \-v "\fR,\fP --version " -Display the version of the proxy renewal daemon. - -.SH FILES -.TP -.I /tmp/dgpr_renew_ -A unix socket used to talk to the daemon. It is created the daemon upon its -start - -.SH ENVIRONMENT -.TP -.B GLITE_PR_TIMEOUT -Sets the maximum number of seconds that the daemon is given to answer a -request done over the unix socket. The default value is 120 seconds. - -.SH BUGS -Please report all bugs to the gLite bug tracking system available at -.I https://savannah.cern.ch - -.SH SEE ALSO -.B glite-proxy-renewd\fR(8)\fP - -.SH AUTHOR -EU EGEE, EU EMI diff --git a/org.glite.px.proxyrenewal/src/glite-proxy-renewd.8 b/org.glite.px.proxyrenewal/src/glite-proxy-renewd.8 deleted file mode 100644 index 6b60712..0000000 --- a/org.glite.px.proxyrenewal/src/glite-proxy-renewd.8 +++ /dev/null @@ -1,133 +0,0 @@ -.TH GLITE-PROXY-RENEWD 8 "April 2011" "EU EMI Project" "Proxy renewal" - -.SH NAME -glite-proxy-renewd - proxy renewal daemon - -.SH SYNOPSIS -.B glite-proxy-renewd -.RI [ options ] -.br - -.SH DESCRIPTION -.B glite-proxy-renewd -registers X.509 proxy certificates and periodicaly renews them -using a MyProxy repository. - -.SH OPTIONS -.TP -.BI \-A " DIR" "\fR,\fP --VOMSdir " DIR -Renew also VOMS attributes if they are embeded in the renewed proxy. If the -option is given, the renewal daemon will retrieve a fresh copy of the VOMS -attributes and place it inside the new proxy. - -.TP -.BI \-C " DIR" "\fR,\fP --CAdir " DIR -An alternative directory with trusted root anchors. This option overrides the -.B \fR$\fPX509_USER_DIR -environment variable. - -.TP -.BI \-c " NUM" "\fR,\fP --condor-limit " NUM -Specifies how many -.I NUM -seconds before expiration of a proxy should the renewal process be started. It defaults to 1800 seconds. - -.TP -.BI \-d "\fR,\fP --debug " -Don't daemonize and start logging to stdout. Increased level of debugging is enabled, too. - -.TP -.BI \-G " FILE" "\fR,\fP --voms-config " FILE -An alternative location of the VOMS configuration. - -.TP -.BI \-h "\fR,\fP --help " -Display a list of valid options. - -.TP -.BI \-k " FILE" "\fR,\fP --key " FILE -Get certificate from -.I FILE\fR.\fP -This option overrides the -.B \fR$\fPX509_USER_CERT -environment variable. - -.TP -.BI \-O "\fR,\fP --order-attributes " -Make sure that the order of renewed VOMS attributes is retained. Enabling -this option may cause crashes of old VOMS servers (older than -1.8.12). - -.TP -.BI \-r " DIR" "\fR,\fP --repository " DIR -All registered proxies and corresponding metadata will be stored in -.I repository\fR.\fP -The directory must exist and be writeable by the proxy renewal daemon. - -.TP -.BI \-t " FILE" "\fR,\fP --cert " FILE -Get private key from -.I FILE\fR.\fP -This option overrides the -.B \fR$\fPX509_USER_KEY -environment variable. - -.TP -.BI \-V " DIR" "\fR,\fP --VOMSdir " DIR -An alternative directory with trusted VOMS certificates - -.TP -.BI \-v "\fR,\fP --version " -Display the version of the proxy renewal daemon. - -.SH FILES -.TP -.I /tmp/dgpr_renew_ -A unix socket used to talk to the daemon. It is created the daemon upon its -start - -.TP -.I proxy repository -A directory containing all the registered proxy certificates and additional -meta-data. - -.TP -There is no configuration file used the proxy renewal daemon. - -.SH ENVIRONMENT -.TP -.B GLITE_PR_TIMEOUT -Sets the maximum number of seconds that the daemon can spend on serving -the client over the unix socket. The default value is 120 seconds. - -.TP -Also, standard globus variables are honoured: - -.TP -.B X509_USER_KEY -If -.B \fR$\fPX509_USER_KEY -is set, it is used to locate the private key file. - -.TP -.B X509_USER_CERT -If -.B \fR$\fPX509_USER_CERT -is set, it is used to locate the certificate file. - -.TP -.B X509_CERT_DIR -If -.B \fR$\fPX509_CERT_DIR -is set, it is used to locate trusted CA's certificates and ca-signing-policy -files. - -.SH BUGS -Please report all bugs to the gLite bug tracking system available at -.I https://savannah.cern.ch - -.SH SEE ALSO -.B glite-proxy-renew\fR(1)\fP - -.SH AUTHOR -EU EGEE, EU EMI diff --git a/org.glite.px.proxyrenewal/src/renew.c b/org.glite.px.proxyrenewal/src/renew.c deleted file mode 100644 index 908a3ae..0000000 --- a/org.glite.px.proxyrenewal/src/renew.c +++ /dev/null @@ -1,278 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "renewal_locl.h" -#include "renewd_locl.h" - -#include "voms/voms_apic.h" - -#ident "$Header$" - -#define RENEWAL_COUNTS_MAX 1000 /* the slave daemon exits after that many attemtps */ - -extern char *repository; -extern char *cadir; -extern char *vomsdir; -extern int voms_enabled; -static int received_signal = -1, die = 0; - -static void -check_renewal(glite_renewal_core_context ctx, char *datafile, int force_renew, int *num_renewed); - -static int -renew_proxy(glite_renewal_core_context ctx, proxy_record *record, char *basename, char **new_proxy); - -static void -register_signal(int signal); - -static void -register_signal(int signal) -{ - received_signal = signal; - switch ((received_signal = signal)) { - case SIGINT: - case SIGTERM: - case SIGQUIT: - die = signal; - break; - default: - break; - } -} - -static int -renew_proxy(glite_renewal_core_context ctx, proxy_record *record, char *basename, char **new_proxy) -{ - char repository_file[FILENAME_MAX]; - int ret = -1; - char *p = NULL; - char *server = NULL; - unsigned int port = 0; - - snprintf(repository_file, sizeof(repository_file),"%s.%d", - basename, record->suffix); - - if (record->myproxy_server) - server = strdup(record->myproxy_server); - - if (server && (p = strchr(server, ':'))) { - *p++ = '\0'; - ret = edg_wlpr_DecodeInt(p, &port); - } - - ret = glite_renewal_core_renew(ctx, server, port, repository_file, new_proxy); - if (ret) { - edg_wlpr_Log(ctx, LOG_ERR, "Failed to renew proxy %s: %s", - repository_file, - glite_renewal_core_get_err(ctx)); - goto end; - } - - edg_wlpr_Log(ctx, LOG_DEBUG, "Proxy %s succesfully renewed", repository_file); - ret = 0; - -end: - if (server) - free(server); - - return ret; -} - -static void -check_renewal(glite_renewal_core_context ctx, char *datafile, int force_renew, int *num_renewed) -{ - char line[EDG_WLPR_SIZE]; - proxy_record record; - char *p; - int ret, i; - time_t current_time; - FILE *meta_fd = NULL; - char basename[FILENAME_MAX]; - edg_wlpr_Request request; - edg_wlpr_Response response; - char *new_proxy = NULL; - char *entry = NULL; - char **tmp; - int num = 0; - - assert(datafile != NULL); - - *num_renewed = 0; - - memset(&record, 0, sizeof(record)); - memset(basename, 0, sizeof(basename)); - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - strncpy(basename, datafile, sizeof(basename) - 1); - p = basename + strlen(basename) - strlen(".data"); - if (strcmp(p, ".data") != 0) { - edg_wlpr_Log(ctx, LOG_ERR, "Meta filename doesn't end with '.data'"); - return; - } - *p = '\0'; - - request.command = EDG_WLPR_COMMAND_UPDATE_DB; - request.proxy_filename = strdup(basename); - - meta_fd = fopen(datafile, "r"); - if (meta_fd == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - datafile, strerror(errno)); - return; - } - - current_time = time(NULL); - - while (fgets(line, sizeof(line), meta_fd) != NULL) { - glite_renewal_core_reset_err(ctx); - free_record(ctx, &record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, basename, line, &record); - if (ret) - continue; /* XXX exit? */ - if (record.jobids.len == 0) /* no jobid registered for this proxy */ - continue; - if (current_time + RENEWAL_CLOCK_SKEW >= record.end_time || - record.next_renewal <= current_time || - force_renew) { - ret = EDG_WLPR_PROXY_EXPIRED; - if ( record.end_time + RENEWAL_CLOCK_SKEW >= current_time) { - /* only try renewal if the proxy hasn't already expired */ - ret = renew_proxy(ctx, &record, basename, &new_proxy); - } - - /* if the proxy wasn't renewed have the daemon planned another renewal */ - asprintf(&entry, "%d:%s", record.suffix, (ret == 0) ? new_proxy : ""); - if (new_proxy) { - free(new_proxy); new_proxy = NULL; - } - - tmp = realloc(request.entries, (num + 2) * sizeof(*tmp)); - if (tmp == NULL) { - free_record(ctx, &record); - return; - } - request.entries = tmp; - request.entries[num] = entry; - request.entries[num+1] = NULL; - num++; - } - } - free_record(ctx, &record); - - if (num > 0) { - ret = edg_wlpr_RequestSend(&request, &response); - if (ret != 0) - edg_wlpr_Log(ctx, LOG_ERR, - "Failed to send update request to master (%d)", ret); - else if (response.response_code != 0) - edg_wlpr_Log(ctx, LOG_ERR, - "Master failed to update database (%d)", response.response_code); - - /* delete all tmp proxy files which may survive */ - for (i = 0; i < num; i++) { - p = strchr(request.entries[i], ':'); - if (p+1) - unlink(p+1); - } - } - fclose(meta_fd); - - edg_wlpr_CleanResponse(&response); - edg_wlpr_CleanRequest(&request); - - *num_renewed = num; - - return; -} - -int renewal(glite_renewal_core_context ctx, int force_renew, int *num_renewed) -{ - DIR *dir = NULL; - struct dirent *file; - FILE *fd; - int num = 0; - - *num_renewed = 0; - - if (chdir(repository)) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot access repository directory %s (%s)", - repository, strerror(errno)); - return errno; - } - - dir = opendir(repository); - if (dir == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot open repository directory %s (%s)", - repository, strerror(errno)); - return errno; - } - - while ((file = readdir(dir))) { - /* read files of format `md5sum`.data, where md5sum() is of fixed length - 32 chars */ - if (file->d_name == NULL || strlen(file->d_name) != 37 || - strcmp(file->d_name + 32, ".data") != 0) - continue; - fd = fopen(file->d_name, "r"); - if (fd == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - file->d_name, strerror(errno)); - continue; - } - check_renewal(ctx, file->d_name, force_renew, &num); - *num_renewed += num; - fclose(fd); - } - closedir(dir); - edg_wlpr_Log(ctx, LOG_DEBUG, - "Renewal attempt finished, %u attempts performed", *num_renewed); - return 0; -} - -void -watchdog_start(glite_renewal_core_context ctx) -{ - struct sigaction sa; - int force_renewal; - int count = 0, num; - - memset(&sa,0,sizeof(sa)); - sa.sa_handler = register_signal; - sigaction(SIGUSR1, &sa, NULL); - sigaction(SIGINT,&sa,NULL); - sigaction(SIGQUIT,&sa,NULL); - sigaction(SIGTERM,&sa,NULL); - sigaction(SIGPIPE,&sa,NULL); - - while (count < RENEWAL_COUNTS_MAX && !die) { - received_signal = -1; - sleep(60 * 5); - force_renewal = (received_signal == SIGUSR1) ? 1 : 0; - if (die) - break; - /* XXX uninstall signal handler ? */ - renewal(ctx, force_renewal, &num); - count += num; - } - edg_wlpr_Log(ctx, LOG_DEBUG, "Terminating after %d renewal attempts", count); - exit(0); -} diff --git a/org.glite.px.proxyrenewal/src/renewal_core.c b/org.glite.px.proxyrenewal/src/renewal_core.c deleted file mode 100644 index 7852b14..0000000 --- a/org.glite.px.proxyrenewal/src/renewal_core.c +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include - -#include "renewal_core.h" -#include "renewal_locl.h" -#include "renewd_locl.h" - -static const char rcsid[] = "$Id$"; - -int -load_proxy(glite_renewal_core_context ctx, const char *cur_file, X509 **cert, EVP_PKEY **priv_key, - STACK_OF(X509) **chain, globus_gsi_cred_handle_t *cur_proxy) -{ - globus_result_t result; - globus_gsi_cred_handle_t proxy = NULL; - int ret; - - result = globus_gsi_cred_handle_init(&proxy, NULL); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_handle_init() failed"); - goto end; - } - - result = globus_gsi_cred_read_proxy(proxy, (char *) cur_file); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_read_proxy() failed"); - goto end; - } - - if (cert) { - result = globus_gsi_cred_get_cert(proxy, cert); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_get_cert() failed"); - goto end; - } - } - - if (priv_key) { - result = globus_gsi_cred_get_key(proxy, priv_key); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_get_key() failed"); - goto end; - } - } - - if (chain) { - result = globus_gsi_cred_get_cert_chain(proxy, chain); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_get_cert_chain() failed"); - goto end; - } - } - - if (cur_proxy) { - *cur_proxy = proxy; - proxy = NULL; - } - - ret = 0; - -end: - if (proxy) - globus_gsi_cred_handle_destroy(proxy); - if (result) - ret = EDG_WLPR_ERROR_GENERIC; - - return ret; -} - -int -get_proxy_base_name(glite_renewal_core_context ctx, const char *file, char **name) -{ - X509 *cert = NULL; - EVP_PKEY *key = NULL; - STACK_OF(X509) *chain = NULL; - X509_NAME *subject = NULL; - int ret; - globus_result_t result; - - ret = load_proxy(ctx, file, &cert, &key, &chain, NULL); - if (ret) - return ret; - - subject = X509_NAME_dup(X509_get_subject_name(cert)); - - sk_X509_insert(chain, cert, 0); - cert = NULL; - - result = globus_gsi_cert_utils_get_base_name(subject, chain); - if (result) { - glite_renewal_core_set_err(ctx, "Cannot get subject name from proxy %s", file); - ret = EDG_WLPR_ERROR_SSL; /* XXX ??? */ - goto end; - } - - *name = X509_NAME_oneline(subject, NULL, 0); - ret = 0; - -end: - if (cert) - X509_free(cert); - if (key) - EVP_PKEY_free(key); - if (chain) - sk_X509_pop_free(chain, X509_free); - if (subject) - X509_NAME_free(subject); - - return ret; -} - -int -glite_renewal_core_renew(glite_renewal_core_context ctx, - const char * myproxy_server, - unsigned int myproxy_port, - const char *current_proxy, - char **new_proxy) -{ - char tmp_proxy[FILENAME_MAX]; - int tmp_fd; - int ret = -1; - const char *server = NULL; - myproxy_socket_attrs_t *socket_attrs; - myproxy_request_t *client_request; - myproxy_response_t *server_response; - char *renewed_proxy; - int voms_exts; - - socket_attrs = malloc(sizeof(*socket_attrs)); - memset(socket_attrs, 0, sizeof(*socket_attrs)); - - client_request = malloc(sizeof(*client_request)); - memset(client_request, 0, sizeof(*client_request)); - - server_response = malloc(sizeof(*server_response)); - memset(server_response, 0, sizeof(*server_response)); - - myproxy_set_delegation_defaults(socket_attrs, client_request); - - edg_wlpr_Log(ctx, LOG_DEBUG, "Trying to renew proxy in %s", current_proxy); - - snprintf(tmp_proxy, sizeof(tmp_proxy), "%s.myproxy.XXXXXX", current_proxy); - tmp_fd = mkstemp(tmp_proxy); - if (tmp_fd == -1) { - glite_renewal_core_set_err(ctx, "Cannot create temporary file (%s)", - strerror(errno)); - return errno; - } - - ret = get_proxy_base_name(ctx, current_proxy, &client_request->username); - if (ret) - goto end; - - is_voms_cert(ctx, current_proxy, &voms_exts); - - client_request->proxy_lifetime = 60 * 60 * DGPR_RETRIEVE_DEFAULT_HOURS; - - server = (myproxy_server) ? myproxy_server : socket_attrs->pshost; - if (server == NULL) { - glite_renewal_core_set_err(ctx, "No myproxy server specified"); - ret = EINVAL; - goto end; - } - socket_attrs->pshost = strdup(server); - - socket_attrs->psport = (myproxy_port) ? myproxy_port : MYPROXY_SERVER_PORT; - - verror_clear(); - ret = myproxy_get_delegation(socket_attrs, client_request, (char *) current_proxy, - server_response, tmp_proxy); - if (ret == 1) { - ret = EDG_WLPR_ERROR_MYPROXY; - glite_renewal_core_set_err(ctx, "Error contacting MyProxy server for proxy %s: %s", - current_proxy, verror_get_string()); - verror_clear(); - goto end; - } - - renewed_proxy = tmp_proxy; - - if (voms_exts) { - char tmp_voms_proxy[FILENAME_MAX]; - int tmp_voms_fd; - - snprintf(tmp_voms_proxy, sizeof(tmp_voms_proxy), "%s.voms.XXXXXX", - current_proxy); - tmp_voms_fd = mkstemp(tmp_voms_proxy); - if (tmp_voms_fd == -1) { - glite_renewal_core_set_err(ctx, "Cannot create temporary file (%s)", - strerror(errno)); - ret = errno; - goto end; - } - - ret = renew_voms_creds(ctx, current_proxy, renewed_proxy, tmp_voms_proxy); - close(tmp_voms_fd); - if (ret) { - glite_renewal_core_update_err(ctx, - "Failed to renew VOMS attributes"); - unlink(tmp_voms_proxy); - goto end; - } - - renewed_proxy = tmp_voms_proxy; - unlink(tmp_proxy); - } - - if (new_proxy) - *new_proxy = strdup(renewed_proxy); - - ret = 0; - -end: - if (socket_attrs->socket_fd) - close(socket_attrs->socket_fd); - close(tmp_fd); - if (ret) - unlink(tmp_proxy); - myproxy_free(socket_attrs, client_request, server_response); - - return ret; -} - -int -glite_renewal_core_init_ctx(glite_renewal_core_context *context) -{ - glite_renewal_core_context p = NULL; - - *context = NULL; - - p = calloc(1, sizeof(*p)); - if (p == NULL) - return ENOMEM; - - p->log_level = LOG_ERR; - p->log_dst = GLITE_RENEWAL_LOG_SYSLOG; - - *context = p; - return 0; -} - -int -glite_renewal_core_destroy_ctx(glite_renewal_core_context context) -{ - if (context == NULL) - return 0; - if (context->err_message); - free(context->err_message); - free(context); - return 0; -} - -void -glite_renewal_core_set_err(glite_renewal_core_context ctx, const char *format, ...) -{ - va_list ap; - - glite_renewal_core_reset_err(ctx); - va_start(ap, format); - vasprintf(&ctx->err_message, format, ap); - va_end(ap); -} - -void -glite_renewal_core_update_err(glite_renewal_core_context ctx, const char *format, ...) -{ - va_list ap; - char *msg, *err; - - va_start(ap, format); - vasprintf(&msg, format, ap); - va_end(ap); - - if (ctx->err_message == NULL) { - ctx->err_message = msg; - return; - } - - asprintf(&err, "%s; %s", ctx->err_message, msg); - free(ctx->err_message); - free(msg); - ctx->err_message = err; -} - -char * -glite_renewal_core_get_err(glite_renewal_core_context ctx) -{ - return (ctx->err_message) ? ctx->err_message : "No error"; -} - -void -glite_renewal_core_reset_err(glite_renewal_core_context ctx) -{ - if (ctx->err_message) - free(ctx->err_message); - ctx->err_message = NULL; -} - -void -edg_wlpr_Log(glite_renewal_core_context context, int dbg_level, const char *format, ...) -{ - va_list ap; - char *msg = NULL, *date, *p; - time_t now = time(NULL); - - - if (dbg_level > context->log_level) - return; - - /* cannot handle the %m format argument specific for syslog() */ - va_start(ap, format); - /* XXX can hardly log ENOMEM errors */ - vasprintf(&msg, format, ap); - va_end(ap); - - switch (context->log_dst) { - case GLITE_RENEWAL_LOG_STDOUT: - date = ctime(&now); - if ((p = strchr(date, '\n'))) - *p = '\0'; - printf("%s [renewd %u]: %s\n", date, getpid(), msg); - break; - case GLITE_RENEWAL_LOG_SYSLOG: - syslog(dbg_level, "%s", msg); - break; - case GLITE_RENEWAL_LOG_NONE: - default: - break; - } - - free(msg); - - return; -} diff --git a/org.glite.px.proxyrenewal/src/renewal_locl.h b/org.glite.px.proxyrenewal/src/renewal_locl.h deleted file mode 100644 index dc910e8..0000000 --- a/org.glite.px.proxyrenewal/src/renewal_locl.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RENEWAL_LOCL_H -#define RENEWAL_LOCL_H - -#ident "$Header$" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef INFTIM -#define INFTIM (-1) -#endif - -#include -#include -#include -#include - -#include "renewal.h" - -#define JDL_MYPROXY "Myproxy_server=" - -typedef enum { - EDG_WLPR_COMMAND_NONE = 0, - EDG_WLPR_COMMAND_REG = 1, - EDG_WLPR_COMMAND_UNREG, - EDG_WLPR_COMMAND_GET, - EDG_WLPR_COMMAND_LIST, - EDG_WLPR_COMMAND_STATUS, - EDG_WLPR_COMMAND_UPDATE_DB, -} edg_wlpr_Command; - -/* prefix neni nutny */ -#define EDG_WLPR_PROTO_VERSION "Version=" -#define EDG_WLPR_PROTO_COMMAND "Command=" -#define EDG_WLPR_PROTO_MYPROXY_SERVER "Myproxy_server=" -#define EDG_WLPR_PROTO_PROXY "Proxy_name=" -#define EDG_WLPR_PROTO_UNIQUE_PROXY "Unique=" /* XXX */ -#define EDG_WLPR_PROTO_JOBID "Jobid=" -#define EDG_WLPR_PROTO_ENTRY "Entry=" - -#define EDG_WLPR_PROTO_RESPONSE "Response=" /* XXX result ?? */ -#define EDG_WLPR_PROTO_START_TIME "Start_time=" -#define EDG_WLPR_PROTO_END_TIME "End_time=" -#define EDG_WLPR_PROTO_RENEWAL_TIME "Renewal_time=" /* XXX Next renewal ?? */ - -#define EDG_WLPR_MYPROXY_PORT 7512 - -#define EDG_WLPR_REPOSITORY_ROOT "/var/spool/edg-wl-renewd" - -#define EDG_WLPR_BUF_SIZE 4096 - -#define EDG_WLPR_VERSION "EDG Proxy Renewal 1.0" - -#define MAX_PROXIES 10000 /* max. number of jobids sharing one proxy */ -#define EDG_WLPR_SIZE 2000000 - -#define RENEWAL_CLOCK_SKEW (5 * 60) - -#define DGPR_RETRIEVE_DEFAULT_HOURS 10 - -#define GLITE_PR_TIMEOUT_DEFAULT 120 - -typedef struct { - char *version; - edg_wlpr_Command command; - char *myproxy_server; - char *proxy_filename; - int unique; - char *jobid; - char **entries; /* for updates from the renewal part (renew.c) */ -} edg_wlpr_Request; - -typedef struct { - char *version; - int response_code; - time_t start_time; - time_t end_time; - time_t next_renewal_time; - int counter; - char *myproxy_server; - char **filenames; -} edg_wlpr_Response; - -#define DGPR_REG_SOCKET_NAME_ROOT "/tmp/dgpr_renew_" - -#if 0 -/* Errors: */ -/* XXX enum */ -#define EDG_WLPR_ERROR_EOF 1 -#define EDG_WLPR_ERROR_PARSE_NOT_FOUND 2 -#define EDG_WLPR_ERROR_PARSE_ERROR 3 -#define EDG_WLPR_ERROR_UNKNOWN_COMMAND 4 -#define EDG_WLPR_ERROR_NOTFOUND 5 -#endif - -int -edg_wlpr_GetToken(const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, char **value); - -int -edg_wlpr_StoreToken(char **buf, size_t *buf_len, char *command, - char *value, const char *separator); - -int -edg_wlpr_Read(int sock, struct timeval *timeout, char **buf, size_t *buf_len); - -int -edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len); - -void -edg_wlpr_CleanRequest(edg_wlpr_Request *request); - -void -edg_wlpr_CleanResponse(edg_wlpr_Response *response); - -const char * -edg_wlpr_GetErrorString(int err); - -char * -edg_wlpr_EncodeInt(int num); /* long? time */ - -int -edg_wlpr_DecodeInt(char *str, int *num); - -int -edg_wlpr_RequestSend(edg_wlpr_Request *request, edg_wlpr_Response *response); - -int -edg_wlpr_DecrementTimeout(struct timeval *timeout, struct timeval before, struct timeval after); - -#endif /* RENEWAL_LOCL_H */ diff --git a/org.glite.px.proxyrenewal/src/renewd.c b/org.glite.px.proxyrenewal/src/renewd.c deleted file mode 100644 index d52ee1d..0000000 --- a/org.glite.px.proxyrenewal/src/renewd.c +++ /dev/null @@ -1,619 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include "renewal_locl.h" -#include "renewd_locl.h" - -static const char rcsid[] = "$Header$"; - -#define SEPARATORS "\n" -/* GRIDMANAGER_CHECKPROXY_INTERVAL + GRIDMANAGER_MINIMUM_PROXY_TIME */ -#define CONDOR_MINIMUM_PROXY_TIME (1800) - -int debug = 0; -char *repository = NULL; -time_t condor_limit = CONDOR_MINIMUM_PROXY_TIME; -char *cadir = NULL; -char *vomsdir = NULL; -int voms_enabled = 0; -char *cert = NULL; -char *key = NULL; - -static volatile int die = 0, child_died = 0; -double default_timeout = 0; - -static struct option opts[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, - { "debug", no_argument, NULL, 'd' }, - { "repository", required_argument, NULL, 'r' }, - { "condor-limit", required_argument, NULL, 'c' }, - { "CAdir", required_argument, NULL, 'C' }, - { "VOMSdir", required_argument, NULL, 'V' }, - { "enable-voms", no_argument, NULL, 'A' }, - { "voms-config", required_argument, NULL, 'G' }, - { "cert", required_argument, NULL, 't' }, - { "key", required_argument, NULL, 'k' }, - { "order-attributes", no_argument, NULL, 'O' }, - { NULL, 0, NULL, 0 } -}; - -typedef struct { - edg_wlpr_Command code; - void (*handler) (glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); -} command_table; - -static command_table commands[] = { - { EDG_WLPR_COMMAND_REG, register_proxy, }, - { EDG_WLPR_COMMAND_UNREG, unregister_proxy, }, - { EDG_WLPR_COMMAND_GET, get_proxy, }, -#if 0 - { EDG_WLPR_COMMAND_LIST, list_proxies, }, - { EDG_WLPR_COMMAND_STATUS, status_proxy, }, -#endif - { EDG_WLPR_COMMAND_UPDATE_DB, update_db, }, - { 0, NULL }, -}; - -/* static prototypes */ -static void -usage(glite_renewal_core_context ctx, char *progname); - -static int -do_listen(glite_renewal_core_context ctx, char *socket_name, int *sock); - -static int -encode_response(glite_renewal_core_context ctx, edg_wlpr_Response *response, char **msg); - -static command_table * -find_command(glite_renewal_core_context ctx, edg_wlpr_Command code); - -static int -proto(glite_renewal_core_context ctx, int sock); - -static int -doit(glite_renewal_core_context ctx, int sock); - -static int -decode_request(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, edg_wlpr_Request *request); - -int -start_watchdog(glite_renewal_core_context ctx, pid_t *pid); - -static void -catchsig(int sig) -{ - switch (sig) { - case SIGINT: - case SIGTERM: - case SIGQUIT: - die = sig; - break; - case SIGCHLD: - child_died = 1; - break; - default: - break; - } -} - -static command_table * -find_command(glite_renewal_core_context ctx, edg_wlpr_Command code) -{ - command_table *c; - - for (c = commands; c->code; c++) { - if (c->code == code) - return c; - } - return NULL; -} - -static int -proto(glite_renewal_core_context ctx, int sock) -{ - char *buf = NULL; - size_t buf_len; - int ret; - edg_wlpr_Response response; - edg_wlpr_Request request; - command_table *command; - struct timeval timeout; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - timeout.tv_sec = (long) default_timeout; - timeout.tv_usec = (long) ((default_timeout - timeout.tv_sec) * 1e6); - - ret = edg_wlpr_Read(sock, &timeout, &buf, &buf_len); - if (ret) { - edg_wlpr_Log(ctx, LOG_ERR, "Error reading from client: %s", - edg_wlpr_GetErrorString(ret)); - return ret; - } - - ret = decode_request(ctx, buf, buf_len, &request); - free(buf); - if (ret) - goto end; - - /* XXX check request (protocol version, ...) */ - - command = find_command(ctx, request.command); - if (command == NULL) { - ret = EDG_WLPR_ERROR_UNKNOWN_COMMAND; - edg_wlpr_Log(ctx, LOG_ERR, "Received unknown command (%d)", request.command); - goto end; - } - - command->handler(ctx, &request, &response); - - ret = encode_response(ctx, &response, &buf); - if (ret) - goto end; - - ret = edg_wlpr_Write(sock, &timeout, buf, strlen(buf) + 1); - free(buf); - if (ret) { - edg_wlpr_Log(ctx, LOG_ERR, "Error sending response to client: %s", - edg_wlpr_GetErrorString(ret)); - goto end; - } - -end: - edg_wlpr_CleanRequest(&request); - edg_wlpr_CleanResponse(&response); - - return ret; -} - -static int -doit(glite_renewal_core_context ctx, int sock) -{ - int newsock; - struct sockaddr_un client_addr; - int client_addr_len = sizeof(client_addr); - int flags; - - while (!die) { - glite_renewal_core_reset_err(ctx); - - if (child_died) { - int pid, newpid, ret; - - while ((pid=waitpid(-1,NULL,WNOHANG))>0) - ; - ret = start_watchdog(ctx, &newpid); - if (ret) - return ret; - edg_wlpr_Log(ctx, LOG_DEBUG, "Renewal slave process re-started"); - child_died = 0; - continue; - } - - newsock = accept(sock, (struct sockaddr *) &client_addr, &client_addr_len); - if (newsock == -1) { - if (errno != EINTR) - edg_wlpr_Log(ctx, LOG_ERR, "accept() failed: %s", strerror(errno)); - continue; - } - - flags = fcntl(newsock, F_GETFL, 0); - if (fcntl(newsock, F_SETFL, flags | O_NONBLOCK) < 0) { - edg_wlpr_Log(ctx, LOG_ERR, "Can't set O_NONBLOCK mode (%s), closing.\n", - strerror(errno)); - close(newsock); - continue; - } - - proto(ctx, newsock); - - close(newsock); - } - edg_wlpr_Log(ctx, LOG_DEBUG, "Terminating on signal %d\n",die); - return 0; -} - -static int -decode_request(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, edg_wlpr_Request *request) -{ - char *value = NULL; -#if 0 - char *p; - int port; -#endif - int ret; - int index; - - /* XXX add an ending zero '\0' */ - - assert(msg != NULL); - assert(request != NULL); - - memset(request, 0, sizeof(*request)); - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_VERSION, SEPARATORS, - 0, &request->version); - if (ret) { - edg_wlpr_Log(ctx, LOG_ERR, "Protocol error reading protocol specification: %s", - edg_wlpr_GetErrorString(ret)); - return ret; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_COMMAND, SEPARATORS, - 0, &value); - if (ret) { - edg_wlpr_Log(ctx, LOG_ERR, "Protocol error reading command specification: %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - - ret = edg_wlpr_DecodeInt(value, (int *)(&request->command)); - if (ret) { - edg_wlpr_Log(ctx, LOG_ERR, "Received non-numeric command specification (%s)", - value); - free(value); - goto err; - } - free(value); - - if (find_command(ctx, request->command) == NULL) { - edg_wlpr_Log(ctx, LOG_ERR, "Received unknown command (%d)", request->command); - ret = EDG_WLPR_ERROR_UNKNOWN_COMMAND; - goto err; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - SEPARATORS, 0, &request->myproxy_server); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - edg_wlpr_Log(ctx, LOG_ERR, "Protocol error reading myproxy server specification: %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - -#if 0 - request->myproxy_port = EDG_WLPR_MYPROXY_PORT; /* ??? */ - if (request->myproxy_server && (p = strchr(request->myproxy_server, ':'))) { - *p = '\0'; - port = atol(p+1); /* XXX see myproxy for err check */ - request->myproxy_port = port; - } -#endif - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_PROXY, SEPARATORS, - 0, &request->proxy_filename); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - edg_wlpr_Log(ctx, LOG_ERR, "Protocol error reading proxy specification: %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - -#if 0 - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_UNIQUE_PROXY, - SEPARATORS, 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PARSE_NOT_FOUND) - goto err; - if (ret == 0 && strcasecmp(value, "yes") == 0) - request->unique = 1; - free(value); -#endif - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_JOBID, SEPARATORS, - 0, &request->jobid); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - edg_wlpr_Log(ctx, LOG_ERR, "Protocol error reading JobId : %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - - index = 0; - while ((ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_ENTRY, - SEPARATORS, index, &value)) == 0) { - char **tmp; - - tmp = realloc(request->entries, (index + 2) * sizeof(*tmp)); - if (tmp == NULL) { - ret = ENOMEM; - goto err; - } - request->entries = tmp; - request->entries[index] = value; - index++; - } - if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (request->entries) - request->entries[index] = NULL; - - return 0; - -err: - edg_wlpr_CleanRequest(request); - return ret; -} - -static int -encode_response(glite_renewal_core_context ctx, edg_wlpr_Response *response, char **msg) -{ - char *buf; - size_t buf_len; - int ret; - - buf_len = EDG_WLPR_BUF_SIZE; - buf = malloc(buf_len); - if (buf == NULL) - return ENOMEM; - buf[0] = '\0'; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_VERSION, - EDG_WLPR_VERSION, SEPARATORS); - if (ret) - goto err; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_RESPONSE, - edg_wlpr_EncodeInt(response->response_code), - SEPARATORS); - if (ret) - goto err; - - if (response->myproxy_server) { - char host[1024]; - -#if 0 - snprintf(host, sizeof(host), "%s:%d", response->myproxy_server, - (response->myproxy_port) ? response->myproxy_port : EDG_WLPR_MYPROXY_PORT); -#endif - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - host, SEPARATORS); - if (ret) - goto err; - } - - if (response->start_time) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_START_TIME, - edg_wlpr_EncodeInt(response->start_time), - SEPARATORS); - if (ret) - goto err; - } - - if (response->end_time) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_END_TIME, - edg_wlpr_EncodeInt(response->end_time), - SEPARATORS); - if (ret) - goto err; - } - - if (response->next_renewal_time) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_RENEWAL_TIME, - edg_wlpr_EncodeInt(response->next_renewal_time), - SEPARATORS); - if (ret) - goto err; - } - - if (response->filenames) { - char **p = response->filenames; - while (*p) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_PROXY, *p, - SEPARATORS); - if (ret) - goto err; - p++; - } - } - - buf[strlen(buf)] = '\0'; - *msg = buf; - return 0; - -err: - free(buf); - *msg = NULL; - return ret; -} - - -static void -usage(glite_renewal_core_context ctx, char *progname) -{ - fprintf(stderr,"usage: %s [option]\n" - "\t-h, --help display this help and exit\n" - "\t-v, --version output version information and exit\n" - "\t-d, --debug don't fork, print out debugging information\n" - "\t-r, --repository repository directory\n" - "\t-c, --condor-limit how long before expiration the proxy must be renewed\n" - "\t-C, --CAdir trusted certificates directory\n" - "\t-V, --VOMSdir trusted VOMS servers certificates directory\n" - "\t-A, --enable-voms renew also VOMS certificates in proxies\n" - "\t-G, --voms-config location of the vomses configuration file\n" - "\t-O, --order-attributes retain VOMS attributes ordering\n", - progname); -} - -static int -do_listen(glite_renewal_core_context ctx, char *socket_name, int *sock) -{ - struct sockaddr_un my_addr; - int s; - int ret; - - assert(sock != NULL); - - memset(&my_addr, 0, sizeof(my_addr)); - my_addr.sun_family = AF_UNIX; - strncpy(my_addr.sun_path, socket_name, sizeof(my_addr.sun_path)); - unlink(socket_name); - - s = socket(AF_UNIX, SOCK_STREAM, 0); - if (s == -1) { - edg_wlpr_Log(ctx, LOG_ERR, "socket(): %s", strerror(errno)); - return errno; - } - - ret = bind(s, (struct sockaddr *)&my_addr, sizeof(my_addr)); - if (ret == -1) { - edg_wlpr_Log(ctx, LOG_ERR, "bind(): %s", strerror(errno)); - close(s); - return errno; - } - - ret = listen(s, 50); - if (ret == -1) { - edg_wlpr_Log(ctx, LOG_ERR, "listen(): %s", strerror(errno)); - close(s); - return errno; - } - - *sock = s; - return 0; -} - -int -start_watchdog(glite_renewal_core_context ctx, pid_t *pid) -{ - pid_t p; - - switch ((p = fork())) { - case -1: - edg_wlpr_Log(ctx, LOG_ERR, "fork() failed: %s", - strerror(errno)); - return errno; - case 0: - watchdog_start(ctx); - exit(0); - break; - default: - *pid = p; - return 0; - } - /* not reachable */ - exit(0); -} - -int main(int argc, char *argv[]) -{ - int sock; - char *progname; - int opt; - int fd; - char sockname[PATH_MAX]; - int ret; - pid_t pid; - struct sigaction sa; - const char *s = NULL; - glite_renewal_core_context ctx = NULL; - - progname = strrchr(argv[0],'/'); - if (progname) progname++; - else progname = argv[0]; - - ret = glite_renewal_core_init_ctx(&ctx); - if (ret) { - fprintf(stderr, "Cannot initialize context\n"); - exit(1); - } - - repository = EDG_WLPR_REPOSITORY_ROOT; - debug = 0; - - while ((opt = getopt_long(argc, argv, "hvdr:c:C:V:AG:t:k:O", opts, NULL)) != EOF) - switch (opt) { - case 'h': usage(ctx, progname); exit(0); - case 'v': fprintf(stdout, "%s:\t%s\n", progname, rcsid); exit(0); - case 'd': debug = 1; break; - case 'r': repository = optarg; break; - case 'c': condor_limit = atoi(optarg); break; - case 'C': cadir = optarg; break; - case 'V': vomsdir = optarg; break; - case 'A': voms_enabled = 1; break; - case 'G': ctx->voms_conf = optarg; break; - case 't': cert = optarg; break; - case 'k': key = optarg; break; - case 'O': ctx->order_attributes = 1; break; - case '?': usage(ctx, progname); return 1; - } - - if (optind < argc) { - usage(ctx, progname); - exit(1); - } - - if (debug) { - ctx->log_level = LOG_DEBUG; - ctx->log_dst = GLITE_RENEWAL_LOG_STDOUT; - } - - if (chdir(repository)) { - edg_wlpr_Log(ctx, LOG_ERR, "Cannot access repository directory %s (%s)", - repository, strerror(errno)); - exit(1); - } - - globus_module_activate(GLOBUS_GSI_CERT_UTILS_MODULE); - globus_module_activate(GLOBUS_GSI_PROXY_MODULE); - - if (!debug) { - /* chdir ? */ - if (daemon(1,0) == -1) { - perror("deamon()"); - exit(1); - } - openlog(progname, LOG_PID, LOG_DAEMON); - } - - if (cert) - setenv("X509_USER_CERT", cert, 1); - - if (key) - setenv("X509_USER_KEY", key, 1); - - if (cadir) - setenv("X509_CERT_DIR", cadir, 1); - - s = getenv("GLITE_PR_TIMEOUT"); - default_timeout = s ? atof(s) : GLITE_PR_TIMEOUT_DEFAULT; - - memset(&sa,0,sizeof(sa)); - sa.sa_handler = catchsig; - sigaction(SIGINT,&sa,NULL); - sigaction(SIGQUIT,&sa,NULL); - sigaction(SIGTERM,&sa,NULL); - sigaction(SIGCHLD,&sa,NULL); - sigaction(SIGPIPE,&sa,NULL); - - ret = start_watchdog(ctx, &pid); - if (ret) - return 1; - - umask(0177); - snprintf(sockname, sizeof(sockname), "%s%d", - DGPR_REG_SOCKET_NAME_ROOT, getuid()); - /* XXX check that the socket is not already active */ - ret = do_listen(ctx, sockname, &sock); - if (ret) - return 1; - edg_wlpr_Log(ctx, LOG_DEBUG, "Listening at %s", sockname); - - ret = doit(ctx, sock); - - close(sock); - return ret; -} diff --git a/org.glite.px.proxyrenewal/src/renewd_locl.h b/org.glite.px.proxyrenewal/src/renewd_locl.h deleted file mode 100644 index f9ce31e..0000000 --- a/org.glite.px.proxyrenewal/src/renewd_locl.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#ifndef RENEWALD_LOCL_H -#define RENEWALD_LOCL_H - -#ident "$Header$" - -#include -#include -#include - -#include - -#include "renewal.h" -#include "renewal_core.h" - -#ifdef HAVE_DMALLOC_H -#include -#endif - -/* XXX */ -#if 0 -#define EDG_WLPR_ERROR_PARSE_NOT_FOUND EDG_WLPR_ERROR_PROTO_PARSE_ERROR -#define EDG_WLPR_ERROR_NOTFOUND EDG_WLPR_PROXY_NOT_REGISTERED -#endif - -typedef struct { - unsigned int len; - char **val; -} prd_list; - -typedef struct { - int suffix; - prd_list jobids; - int unique; - int voms_exts; - char *myproxy_server; - time_t end_time; - time_t next_renewal; - char *fqans; -} proxy_record; - -/* commands */ -void -register_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -void -unregister_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -void -get_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -void -update_db(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -int -get_times(glite_renewal_core_context ctx, char *proxy_file, proxy_record *record); - -void -watchdog_start(glite_renewal_core_context ctx); - -void -edg_wlpr_Log(glite_renewal_core_context ctx, int dbg_level, const char *format, ...); - -int -decode_record(glite_renewal_core_context ctx, const char *basename, char *line, proxy_record *record); - -int -encode_record(glite_renewal_core_context ctx, proxy_record *record, char **line); - -void -free_record(glite_renewal_core_context ctx, proxy_record *record); - -int -load_proxy(glite_renewal_core_context ctx, const char *filename, X509 **cert, EVP_PKEY **privkey, - STACK_OF(X509) **chain, globus_gsi_cred_handle_t *proxy); - -int -get_proxy_base_name(glite_renewal_core_context ctx, const char *file, char **subject); - -int -renew_voms_creds(glite_renewal_core_context ctx, const char *cur_file, const char *renewed_file, const char *new_file); - -int -is_voms_cert(glite_renewal_core_context ctx, const char *proxy, int *present); - -int -get_voms_cert(glite_renewal_core_context ctx, - X509 *cert, STACK_OF(X509) *chain, struct vomsdata **vd); - -char * -get_voms_fqans(glite_renewal_core_context ctx, const char *file); - -#endif /* RENEWALD_LOCL_H */ diff --git a/org.glite.px.proxyrenewal/src/voms.c b/org.glite.px.proxyrenewal/src/voms.c deleted file mode 100644 index 5a775b0..0000000 --- a/org.glite.px.proxyrenewal/src/voms.c +++ /dev/null @@ -1,478 +0,0 @@ -/* - * Copyright (c) Members of the EGEE Collaboration. 2004-2010. - * See http://www.eu-egee.org/partners/ for details on the copyright - * holders. - * - * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -static const char rcsid[] = "$Id$"; - -#include "renewal_locl.h" -#include "renewd_locl.h" - -#include -#include - -#include "voms/voms_apic.h" - -#include "voms/newformat.h" - -char * Decode(const char *, int, int *); -char **listadd(char **, char *, int); - -static int -generate_proxy(glite_renewal_core_context ctx, globus_gsi_cred_handle_t cur_proxy, - X509_EXTENSION *voms_extension, const char *new_file) -{ - globus_result_t result; - globus_gsi_proxy_handle_t proxy_handle = NULL; - globus_gsi_cred_handle_t proxy = NULL; - EVP_PKEY *cur_proxy_priv_key = NULL; - X509 *new_cert = NULL; - X509 *voms_cert = NULL; - globus_gsi_cert_utils_cert_type_t proxy_type; - - result = globus_gsi_proxy_handle_init(&proxy_handle, NULL); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_proxy_handle_init() failed"); - goto end; - } - - result = globus_gsi_cred_get_key(cur_proxy, &cur_proxy_priv_key); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_get_key() failed"); - goto end; - } - - /* Create and sign a new proxy */ - result = globus_gsi_cred_get_cert_type(cur_proxy, &proxy_type); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_get_cert_type() failed"); - goto end; - } - - result = globus_gsi_proxy_handle_set_type(proxy_handle, proxy_type); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_proxy_handle_set_type() failed"); - goto end; - } - - result = globus_gsi_proxy_create_signed(proxy_handle, cur_proxy, &proxy); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_proxy_handle_init() failed"); - goto end; - } - - /* Get the new proxy */ - result = globus_gsi_cred_get_cert(proxy, &new_cert); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_get_cert() failed"); - goto end; - } - - /* The Globus API doesn't allow to store custom X.509 extensions */ - voms_cert = X509_dup(new_cert); - if (voms_cert->cert_info->extensions == NULL) - voms_cert->cert_info->extensions = sk_X509_EXTENSION_new_null(); - sk_X509_EXTENSION_push(voms_cert->cert_info->extensions, voms_extension); - - /* Openssl ensures that memory containing old signature structures is unallocated */ -#if 0 - X509_sign(voms_cert, cur_proxy_priv_key, proxy_handle->attrs->signing_algorithm); -#else - X509_sign(voms_cert, cur_proxy_priv_key, EVP_md5()); -#endif - - /* And put the cert back, older one is unallocated by the function */ - result = globus_gsi_cred_set_cert(proxy, voms_cert); - if (result) { - glite_renewal_core_set_err(ctx, "globus_gsi_cred_set_cert() failed"); - goto end; - } - - result = globus_gsi_cred_write_proxy(proxy, (char *)new_file); - -end: - - return 0; -} - -static int -my_VOMS_Export(glite_renewal_core_context ctx, void *buf, int buf_len, X509_EXTENSION **extension) -{ - AC *ac = NULL; - unsigned char *p, *pp; - AC **voms_attrs = NULL; - - p = pp = buf; - ac = d2i_AC(NULL, &p, buf_len+1); - if (ac == NULL) { - glite_renewal_core_set_err(ctx, "d2i_AC() failed"); - return 1; - } - - voms_attrs = (AC **)listadd((char **)voms_attrs, (char *)ac, sizeof(AC *)); - - *extension = X509V3_EXT_conf_nid(NULL, NULL, OBJ_txt2nid("acseq"), - (char*)voms_attrs); - return 0; -} - -static int -create_voms_command(glite_renewal_core_context ctx, struct vomsdata *vd, struct voms **voms_cert, char **command) -{ - int ret, voms_err, i; - struct data **attribs; - char *str = NULL; - char *role, *cmd = NULL, *tmp = NULL; - - if (voms_cert == NULL || *voms_cert == NULL || (*voms_cert)->std == NULL) { - glite_renewal_core_set_err(ctx, "Invalid VOMS certificate"); - return 1; - } - - VOMS_ResetOrder(vd, &voms_err); - attribs = (*voms_cert)->std; - i = 0; - while (attribs && attribs[i]) { - role = NULL; - if ((attribs[i])->role && strcmp ((attribs[i])->role, "NULL") != 0 && - strcmp((attribs[i])->role, "") != 0) - role = (attribs[i])->role; - - asprintf(&str, "%s%s%s", - (attribs[i])->group, - (role) ? ":" : "", - (role) ? role : ""); - - if (ctx->order_attributes) - VOMS_Ordering(str, vd, &voms_err); - - asprintf(&tmp, "%s%s%s%s", - (cmd) ? cmd : "", - (cmd) ? "," : "", - (role) ? "B" : "G", - str); - cmd = tmp; - - free(str); - str = NULL; - i++; - } - - *command = cmd; - return 0; -} - -static int -renew_voms_cert(glite_renewal_core_context ctx, struct vomsdata *vd, struct voms **voms_cert, - char **buf, size_t *buf_len) -{ - int voms_error = 0, ret, voms_version, port = -1; - struct contactdata **voms_contacts = NULL; - struct contactdata **c; - char *command = NULL; - char *err_msg, *voms_server = NULL, *p; - - ret = create_voms_command(ctx, vd, voms_cert, &command); - if (ret) - return ret; - - /* XXX the lifetime should be taken from the older proxy */ - VOMS_SetLifetime(60*60*12, vd, &voms_error); - - if ((*voms_cert)->uri != NULL) { - voms_server = strdup((*voms_cert)->uri); - if (voms_server == NULL) { - glite_renewal_core_set_err(ctx, "Not enough memory"); - ret = 1; - goto end; - } - - p = strchr(voms_server, ':'); - if (p) { - *p++ = '\0'; - port = atoi(p); - } - } - - /* first try to contact the VOMS server that issued the original AC */ - if (voms_server && port != -1 && (*voms_cert)->server != NULL) { - ret = VOMS_ContactRaw(voms_server, port, (*voms_cert)->server, - command, (void**) buf, buf_len, &voms_version, - vd, &voms_error); - if (ret != 0) { - /* success, let's finish */ - ret = 0; - goto end; - } - err_msg = VOMS_ErrorMessage(vd, voms_error, NULL, 0); - glite_renewal_core_set_err(ctx, - "Failed to contact VOMS server %s of VO %s: %s", - voms_server, (*voms_cert)->voname, err_msg); - free(err_msg); - } - - /* if the original URI doesn't work, try VOMS servers given in local - configuration */ - voms_contacts = VOMS_FindByVO(vd, (*voms_cert)->voname, ctx->voms_conf, NULL, &voms_error); - if (voms_contacts == NULL) { - err_msg = VOMS_ErrorMessage(vd, voms_error, NULL, 0); - glite_renewal_core_set_err(ctx, "Can't find configuration for VO %s: %s", - (*voms_cert)->voname, err_msg); - free(err_msg); - ret = 1; - goto end; - } - - ret = 0; - for (c = voms_contacts; c && *c; c++) { - ret = VOMS_ContactRaw((*c)->host, (*c)->port, (*c)->contact, - command, (void**) buf, buf_len, &voms_version, - vd, &voms_error); - if (ret != 0) { - /* success, let's finish */ - break; - } - err_msg = VOMS_ErrorMessage(vd, voms_error, NULL, 0); - glite_renewal_core_set_err(ctx, - "Failed to contact VOMS server %s of VO %s: %s", - (*c)->host, (*voms_cert)->voname, err_msg); - free(err_msg); - } - ret = (ret == 0) ? -1 : 0; - -end: - VOMS_DeleteContacts(voms_contacts); - - if (command) - free(command); - - return ret; -} - -static int -renew_voms_certs(glite_renewal_core_context ctx, const char *cur_file, const char *renewed_file, const char *new_file) -{ - globus_gsi_cred_handle_t cur_proxy = NULL; - globus_gsi_cred_handle_t new_proxy = NULL; - struct vomsdata *vd = NULL; - struct voms **voms_cert = NULL; - int ret; - X509 *cert = NULL; - STACK_OF(X509) *chain = NULL; - char *buf = NULL; - size_t buf_len = 0; - X509_EXTENSION *extension = NULL; - char *old_env_proxy = getenv("X509_USER_PROXY"); - char *old_env_cert = getenv("X509_USER_CERT"); - char *old_env_key = getenv("X509_USER_KEY"); - - setenv("X509_USER_PROXY", cur_file, 1); - setenv("X509_USER_CERT", renewed_file, 1); - setenv("X509_USER_KEY", renewed_file, 1); - - ret = load_proxy(ctx, cur_file, &cert, NULL, &chain, &cur_proxy); - if (ret) - goto end; - - ret = get_voms_cert(ctx, cert, chain, &vd); - if (ret || vd == NULL) - goto end; - - for (voms_cert = vd->data; voms_cert && *voms_cert; voms_cert++) { - char *tmp, *ptr; - size_t tmp_len; - - ret = renew_voms_cert(ctx, vd, voms_cert, &tmp, &tmp_len); - if (ret) - goto end; - ptr = realloc(buf, buf_len + tmp_len); - if (ptr == NULL) { - ret = ENOMEM; - goto end; - } - buf = ptr; - memcpy(buf + buf_len, tmp, tmp_len); - buf_len += tmp_len; - } - - if (buf == NULL) { - /* no extension renewed, return */ - ret = 0; - goto end; - } - - ret = my_VOMS_Export(ctx, buf, buf_len, &extension); - if (ret) - goto end; - - ret = load_proxy(ctx, renewed_file, NULL, NULL, NULL, &new_proxy); - if (ret) - goto end; - - ret = generate_proxy(ctx, new_proxy, extension, new_file); - -end: - (old_env_proxy) ? setenv("X509_USER_PROXY", old_env_proxy, 1) : - unsetenv("X509_USER_PROXY"); - (old_env_cert) ? setenv("X509_USER_CERT", old_env_cert, 1) : - unsetenv("X509_USER_CERT"); - (old_env_key) ? setenv("X509_USER_KEY", old_env_key, 1) : - unsetenv("X509_USER_KEY"); - - if (cert) - X509_free(cert); - if (chain) - sk_X509_pop_free(chain, X509_free); - if (vd) - VOMS_Destroy(vd); - if (cur_proxy) - globus_gsi_cred_handle_destroy(cur_proxy); - if (new_proxy) - globus_gsi_cred_handle_destroy(new_proxy); - if (buf) - free(buf); - - return ret; -} - -int -renew_voms_creds(glite_renewal_core_context ctx, const char *cur_file, const char *renewed_file, const char *new_file) -{ - return renew_voms_certs(ctx, cur_file, renewed_file, new_file); -} - -char * -get_voms_fqans(glite_renewal_core_context ctx, const char *file) -{ - struct vomsdata *voms_info = NULL; - struct voms **voms_cert; - STACK_OF(X509) *chain = NULL; - X509 *cert = NULL; - int ret; - char *fqans = NULL, **f, *tmp; - size_t len, flen; - - ret = load_proxy(ctx, file, &cert, NULL, &chain, NULL); - if (ret) - return NULL; - - ret = get_voms_cert(ctx, cert, chain, &voms_info); - if (ret || voms_info == NULL) - goto end; - - len = 0; - for (voms_cert = voms_info->data; voms_cert && *voms_cert; voms_cert++) { - for (f = (*voms_cert)->fqan; f && *f; f++) { - flen = strlen(*f); - tmp = realloc(fqans, len + ((len) ? 1 : 0) + flen + 1); - if (tmp == NULL) { - free(fqans); - fqans = NULL; - goto end; - } - fqans = tmp; - if (len == 0) - fqans[0] = '\0'; - else - strcat(fqans, ":"); - strcat(fqans, *f); - len += flen; - } - } - -end: - if (voms_info) - VOMS_Destroy(voms_info); - sk_X509_pop_free(chain, X509_free); - X509_free(cert); - - return fqans; -} - -int -is_voms_cert(glite_renewal_core_context ctx, - const char *file, - int *present) -{ - char *fqans = get_voms_fqans(ctx, file); - *present = (fqans != NULL); - free(fqans); - return 0; -} - -int -get_voms_cert(glite_renewal_core_context ctx, - X509 *cert, STACK_OF(X509) *chain, struct vomsdata **vd) -{ - struct vomsdata *voms_info = NULL; - int voms_err, ret, voms_ret; - - /* XXX pass the vomsdir and cadir parameters */ - voms_info = VOMS_Init(NULL, NULL); - if (voms_info == NULL) { - glite_renewal_core_set_err(ctx, "VOMS_Init() failed, probably voms dir was not specified"); - return EDG_WLPR_ERROR_VOMS; - } - - VOMS_SetVerificationType(VERIFY_NONE, voms_info, &voms_err); - - ret = 0; - voms_ret = VOMS_Retrieve(cert, chain, RECURSE_CHAIN, voms_info, &voms_err); - if (voms_ret == 0) { - if (voms_err == VERR_NOEXT) { - voms_info = NULL; - ret = 0; - } else { - char *err_msg = VOMS_ErrorMessage(voms_info, voms_err, NULL, 0); - glite_renewal_core_set_err(ctx, "Failed to retrieve VOMS attributes: %s", - err_msg); - free(err_msg); - ret = -1; /* XXX */ - } - } - - if (ret == 0 && vd != NULL) - *vd = voms_info; - else - VOMS_Destroy(voms_info); - - return ret; -} - -#if 0 -int -main(int argc, char *argv[]) -{ - int ret; - const char *current_proxy = "/tmp/x509up_u11930"; - const char *renewed_proxy = "/tmp/proxy"; - - if (argc > 1) - current_proxy = argv[1]; - if (argc > 2) - renewed_proxy = argv[2]; - - if (globus_module_activate(GLOBUS_GSI_PROXY_MODULE) != GLOBUS_SUCCESS || - globus_module_activate(GLOBUS_GSI_CERT_UTILS_MODULE) != GLOBUS_SUCCESS) { - glite_renewal_core_set_err(ctx, "Unable to initialize Globus modules"); - return 1; - } - - ret = renew_voms_certs(current_proxy, renewed_proxy); - - return 0; -} -#endif diff --git a/org.glite.px/project/version.properties b/org.glite.px/project/version.properties deleted file mode 100644 index 01f306f..0000000 --- a/org.glite.px/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.0.9 -module.age=1 diff --git a/org.glite.security.gsoap-plugin/LICENSE b/org.glite.security.gsoap-plugin/LICENSE deleted file mode 100644 index 259a91f..0000000 --- a/org.glite.security.gsoap-plugin/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.security.gsoap-plugin/Makefile b/org.glite.security.gsoap-plugin/Makefile deleted file mode 100644 index 49dd394..0000000 --- a/org.glite.security.gsoap-plugin/Makefile +++ /dev/null @@ -1,338 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -globalprefix=glite -package=gsoap-plugin -version=1.0.0 -PREFIX=/opt/glite - -glite_location=/opt/glite -gsoap_prefix=/opt/gsoap - -CC=gcc - -gsoap_versions_noflavours?=2.6.2 2.7.0f 2.7.6b 2.7.6d 2.7.9d 2.7.9b -gsoap_versions_flavours?=2.7.10 - --include Makefile.inc --include ../Makefile.inc --include ../project/version.properties --include ../../project/version.properties - -version=${module.version} -gsoap_versions_flavours:=${shell if ! echo ${gsoap_versions_flavours} | grep '\<${gsoap_default_version}\>' >/dev/null; then echo "${gsoap_default_version} "; else echo ''; fi} ${gsoap_versions_flavours} - -GSPLUGIN_DEBUG?=no -GSPLUGIN_VERSION_CHECKING?=yes -CC=gcc - -# In order to use libtool versioning correcty, we must have: -# -# current = major + minor + offset -# revision = patch -# age = minor -# -# where offset is a sum of maximal released minor's of all previous major's -# - -# counted minors: 1.5 -# TODO: bump offset to 5 on next major change -offset=-1 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -ext_repository:=${shell if [ -d "${repository}/externals" ]; then \ - echo "${repository}/externals"; \ - else echo "${repository}"; \ - fi} - -gsoap_version=${gsoap_default_version} -gsoap_prefix?=${ext_repository}/${gsoap_name}/${gsoap_version}/${gsoap_platform} -ifdef lang -langflavour:=_${lang} -langsuffix:=.${lang} -endif - -VPATH=${top_srcdir}/src:${top_srcdir}/test:${top_srcdir}/examples - -default: all - -DEBUG:=-g -O0 -W -Wall -Wno-unused-parameter -# not for globus and gsoap: -Werror -ifeq ($(GSPLUGIN_DEBUG),yes) - DEBUG:=${DEBUG} -DGSPLUGIN_DEBUG=1 -endif -# gsoap logs: -DDEBUG -ifeq ($(GSOAP_DEBUG),yes) - DEBUG:=${DEBUG} -DDEBUG=1 -endif - -#ifeq ($(GSPLUGIN_VERSION_CHECKING),yes) -# DEBUG:=${DEBUG} -DCHECK_GSOAP_VERSION -#endif - -CFLAGS:= ${CFLAGS} ${DEBUG} \ - -DVERSION=\"${version}\" \ - -DWITH_NONAMESPACES \ - -I. -I${top_srcdir}/interface \ - -I${stagedir}/include \ - ${COVERAGE_FLAGS} -D_GNU_SOURCE -DDATAGRID_EXTENSION -DWITH_IPV6 - -LDFLAGS:=${LDFLAGS} ${COVERAGE_FLAGS} - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -COMPILEXX:=libtool --mode=compile ${CXX} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/${libdir} ${LDFLAGS} -LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/${libdir} ${LDFLAGS} -INSTALL:=libtool --mode=install install -LINK_lang:=PATH=${top_srcdir}/project/libtoolhack:${PATH} libtool --mode=link ${CXX} -rpath ${stagedir}/${libdir} ${LDFLAGS} -ifeq (${lang},c) -LINK_lang:=${LINK} -endif -ifeq (${lang},cxx) -LINK_lang:=${LINKXX} -endif - -gsoaplibdir=$(shell if test -d "${gsoap_prefix}/${libdir}"; then echo "${gsoap_prefix}/${libdir}"; else echo "${gsoap_prefix}/lib"; fi) -GSOAP_LIBS?=-L${gsoaplibdir} -lgsoap - -EX_NOTHRLIBS:=-L${stagedir}/${libdir} -lglite_security_gss_${nothrflavour} -EX_THRLIBS:=-L${stagedir}/${libdir} -lglite_security_gss_${thrflavour} -EX_LIBS:=-L${stagedir}/${libdir} -lglite_security_gss -HDRS:=glite_gsplugin.h glite_gscompat.h glite_gsplugin-int.h -EXAMPLES:=wscalc_clt_ex wscalc_srv_ex wscalc_srv_ex2 -TESTS:=test_cxx - -NOTHRSTATICLIB:=libglite_security_gsoap_plugin_${nothrflavour}${langflavour}.a -THRSTATICLIB:=libglite_security_gsoap_plugin_${thrflavour}${langflavour}.a -STATICLIB:=libglite_security_gsoap_plugin${langflavour}.a -NOTHRLTLIB:=libglite_security_gsoap_plugin_${nothrflavour}${langflavour}.la -THRLTLIB:=libglite_security_gsoap_plugin_${thrflavour}${langflavour}.la -LTLIB:=libglite_security_gsoap_plugin${langflavour}.la - -OBJS:=${GSS_OBJS} glite_gsplugin${langsuffix}.o -LOBJS:=${OBJS:.o=.lo} -THROBJS:=${OBJS:.o=.thr.o} -THRLOBJS:=${OBJS:.o=.thr.lo} - -dotless_ver:=${shell echo ${gsoap_version} | tr -d '.'} -NOTHRSTATICLIB_S:=libglite_security_gsoap_plugin_${dotless_ver}_${nothrflavour}${langflavour}.a -THRSTATICLIB_S:=libglite_security_gsoap_plugin_${dotless_ver}_${thrflavour}${langflavour}.a -STATICLIB_S:=libglite_security_gsoap_plugin_${dotless_ver}${langflavour}.a -NOTHRLTLIB_S:=libglite_security_gsoap_plugin_${dotless_ver}_${nothrflavour}${langflavour}.la -THRLTLIB_S:=libglite_security_gsoap_plugin_${dotless_ver}_${thrflavour}${langflavour}.la -LTLIB_S:=libglite_security_gsoap_plugin_${dotless_ver}${langflavour}.la - -ifeq (${thrflavour},) -lib_LTLIBRARIES:=${STATICLIB} ${LTLIB} -lib_LTLIBRARIES_S:=${LTLIB_S} -LTLIB_TEST_S:=libglite_security_gsoap_plugin_${dotless_ver}_cxx.la -default_ltlib_s:=${LTLIB_S} -else -lib_LTLIBRARIES:=${NOTHRSTATICLIB} ${NOTHRLTLIB} ${THRSTATICLIB} ${THRLTLIB} -lib_LTLIBRARIES_S:=${NOTHRLTLIB_S} ${THRLTLIB_S} -LTLIB_TEST_S:=libglite_security_gsoap_plugin_${dotless_ver}_${nothrflavour}_cxx.la -default_ltlib_s:=${NOTHRLTLIB_S} -endif - -ifeq (${gsoap_version},${gsoap_default_version}) -OBJS_S:=glite_gsplugin${langsuffix}.o -GSOAP_DEFAULT_LIBS:=${GSOAP_LIBS} -else -OBJS_S:=glite_gsplugin${langsuffix}.o stdsoap2${langsuffix}.o -GSOAP_DEFAULT_LIBS:= -endif -LOBJS_S:=${OBJS_S:.o=.lo} -THROBJS_S:=${OBJS_S:.o=.thr.o} -THRLOBJS_S:=${OBJS_S:.o=.thr.lo} - -ifeq (${thrflavour},) -${STATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${LTLIB}: ${OBJS} - ${LINK_lang} ${version_info} -o $@ ${LOBJS} ${EX_LIBS} - -${STATICLIB_S}: ${OBJS_S} - ar crv $@ ${OBJS_S} - ranlib $@ - -${LTLIB_S}: ${OBJS_S} - ${LINK_lang} ${version_info} -o $@ ${LOBJS_S} ${EX_LIBS} ${GSOAP_DEFAULT_LIBS} -else -${NOTHRSTATICLIB}: ${OBJS} - ar crv $@ ${OBJS} - ranlib $@ - -${THRSTATICLIB}: ${THROBJS} - ar crv $@ ${THROBJS} - ranlib $@ - -${NOTHRLTLIB}: ${OBJS} - ${LINK_lang} ${version_info} -o $@ ${LOBJS} ${EX_NOTHRLIBS} - -${THRLTLIB}: ${THROBJS} - ${LINK_lang} ${version_info} -o $@ ${THRLOBJS} ${EX_THRLIBS} - -${NOTHRSTATICLIB_S}: ${OBJS_S} - ar crv $@ ${OBJS_S} - ranlib $@ - -${THRSTATICLIB_S}: ${THROBJS_S} - ar crv $@ ${THROBJS_S} - ranlib $@ - -${NOTHRLTLIB_S}: ${OBJS_S} - ${LINK_lang} ${version_info} -o $@ ${LOBJS_S} ${EX_NOTHRLIBS} ${GSOAP_DEFAULT_LIBS} - -${THRLTLIB_S}: ${THROBJS_S} - ${LINK_lang} ${version_info} -o $@ ${THRLOBJS_S} ${EX_THRLIBS} -endif - -all compile: \ - ${lib_LTLIBRARIES} \ - all-libs-with-soap examples - -check: check.cxx - -# C/C++ compatibility test -# (C flavour, gsoap 2.7.10 ==> C++ test fails) -check.cxx: - ${MAKE} lang=cxx -f ${top_srcdir}/Makefile ${LTLIB_TEST_S} test_cxx - LD_LIBRARY_PATH=${cares_prefix}/${libdir}:${LD_LIBRARY_PATH} ./test_cxx - -examples: ${EXAMPLES} - -all-libs-with-soap: - for v in ${gsoap_versions_noflavours}; do \ - dir=`echo $$v | tr -d .`; \ - mkdir $$dir; \ - ${MAKE} -C $$dir -f ../Makefile gsoap_version=$$v top_srcdir=../.. lang= libs-with-soap || exit $?; \ - done - for v in ${gsoap_versions_flavours}; do \ - dir=`echo $$v | tr -d .`; \ - mkdir $$dir; \ - ${MAKE} -C $$dir -f ../Makefile gsoap_version=$$v top_srcdir=../.. lang=c libs-with-soap || exit $?; \ - ${MAKE} -C $$dir -f ../Makefile gsoap_version=$$v top_srcdir=../.. lang=cxx libs-with-soap || exit $?; \ - done - -libs-with-soap: ${lib_LTLIBRARIES_S} - -gsoap_srcname=gsoap-`echo ${gsoap_version} | cut -d. -f1,2` - -link-gsoap: - if [ ${gsoap_version} = ${gsoap_default_version} ]; then \ - ln -sf ${gsoap_prefix}/include/stdsoap2.h stdsoap2.h; \ - elif [ -f ${top_srcdir}/src/stdsoap2_${gsoap_version}.c ]; then \ - ln -sf ${top_srcdir}/src/stdsoap2_${gsoap_version}.c stdsoap2.c; \ - ln -sf ${top_srcdir}/src/stdsoap2_${gsoap_version}.h stdsoap2.h; \ - elif [ -f ${ext_repository}/${gsoap_name}/${gsoap_version}/src/stdsoap2.c ]; then \ - ln -sf ${ext_repository}/${gsoap_name}/${gsoap_version}/src/stdsoap2.[ch] .; \ - elif [ -f ${ext_repository}/${gsoap_name}/${gsoap_version}/${gsoap_platform}/stdsoap2.c ]; then \ - ln -sf ${ext_repository}/${gsoap_name}/${gsoap_version}/${gsoap_platform}/stdsoap2.[ch] .; \ - elif [ -f ${ext_repository}/${gsoap_name}/${gsoap_version}/${gsoap_platform}/src/stdsoap2.c ]; then \ - ln -sf ${ext_repository}/${gsoap_name}/${gsoap_version}/${gsoap_platform}/src/stdsoap2.c .; \ - ln -sf ${ext_repository}/${gsoap_name}/${gsoap_version}/${gsoap_platform}/include/stdsoap2.h .; \ - elif [ -f ${ext_repository}/${gsoap_name}/${gsoap_version}/src/stdsoap2.c ]; then \ - ln -sf ${ext_repository}/${gsoap_name}/${gsoap_version}/src/stdsoap2.[ch] .; \ - elif [ -f ${ext_repository}/${gsoap_name}/${gsoap_version}/src/${gsoap_srcname}/soapcpp2/stdsoap2.c ]; then \ - ln -sf ${ext_repository}/${gsoap_name}/${gsoap_version}/src/${gsoap_srcname}/soapcpp2/stdsoap2.[ch] .; \ - else false ; \ - fi - -stdsoap2.c stdsoap2.h: link-gsoap - -GSOAP_FPREFIX:= GSOAP_ - -WSCALC_CLT_OBJS = wscalc_clt_ex.o ${GSOAP_FPREFIX}C.o ${GSOAP_FPREFIX}Client.o -WSCALC_SRV_OBJS = wscalc_srv_ex.o ${GSOAP_FPREFIX}C.o ${GSOAP_FPREFIX}Server.o -WSCALC_SRV2_OBJS = wscalc_srv_ex2.o ${GSOAP_FPREFIX}C.o ${GSOAP_FPREFIX}Server.o - -wscalc_clt_ex.o wscalc_srv_ex.o wscalc_srv_ex2.o: ${GSOAP_FPREFIX}H.h - -wscalc_clt_ex: ${WSCALC_CLT_OBJS} ${default_ltlib_s} - ${LINK_lang} -o $@ ${WSCALC_CLT_OBJS} ${default_ltlib_s} ${GSOAP_DEFAULT_LIBS} - -wscalc_srv_ex: ${WSCALC_SRV_OBJS} ${default_ltlib_s} - ${LINK_lang} -o $@ ${WSCALC_SRV_OBJS} ${default_ltlib_s} ${GSOAP_DEFAULT_LIBS} - -wscalc_srv_ex2: ${WSCALC_SRV2_OBJS} ${default_ltlib_s} - ${LINK_lang} -o $@ ${WSCALC_SRV2_OBJS} ${default_ltlib_s} ${GSOAP_DEFAULT_LIBS} - -test_cxx: test_gsplugin_cxx.o ${GSOAP_FPREFIX}C.cxx.o - ${LINKXX} -o $@ $+ ${LTLIB_TEST_S} - -soapcpp:=${shell if [ -x ${gsoap_prefix}/bin/soapcpp2 ]; then \ - echo ${gsoap_prefix}/bin/soapcpp2; \ - else echo ${gsoap_prefix}/soapcpp2; \ - fi} - -${GSOAP_FPREFIX}H.h ${GSOAP_FPREFIX}C.c ${GSOAP_FPREFIX}Server.c ${GSOAP_FPREFIX}Client.c ${GSOAP_FPREFIX}ServerLib.c ${GSOAP_FPREFIX}ClientLib.c: calc.h.S - ${soapcpp} -c -p ${GSOAP_FPREFIX} ${top_srcdir}/examples/calc.h.S - -wscalc_clt_ex.o: wscalc_clt_ex.c - ${CC} -c ${CFLAGS} -o $@ $< - -doc: - -stage: - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -install: - -mkdir -p ${PREFIX}/${libdir} - -mkdir -p ${PREFIX}/include/glite/security - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - -mkdir -p ${PREFIX}/include/glite/security/ - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${PREFIX}/include/glite/security/ - for v in ${gsoap_versions_noflavours}; do \ - ${MAKE} -C `echo $$v | tr -d .` -f ../Makefile install-soaplib gsoap_version=$$v lang= PREFIX=${PREFIX} top_srcdir=${top_srcdir}/.. || exit $?; \ - done - for v in ${gsoap_versions_flavours}; do \ - ${MAKE} -C `echo $$v | tr -d .` -f ../Makefile install-soaplib gsoap_version=$$v lang=c PREFIX=${PREFIX} top_srcdir=${top_srcdir}/.. || exit $?; \ - ${MAKE} -C `echo $$v | tr -d .` -f ../Makefile install-soaplib gsoap_version=$$v lang=cxx PREFIX=${PREFIX} top_srcdir=${top_srcdir}/.. || exit $?; \ - done - -install-soaplib: - ${INSTALL} -m 755 ${lib_LTLIBRARIES_S} ${PREFIX}/${libdir} - -clean: - rm -rvf ${lib_LTLIBRARIES} - rm -rvf ${lib_LTLIBRARIES_S} - rm -rvf ${LTLIB_TEST_S} - rm -rvf *.c *.h *.xml *.nsmap *.o *.lo .libs ${EXAMPLES} ${TESTS} - rm -rvf CalcService.wsdl wscalc.xsd - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ debian/ - for v in ${gsoap_versions_noflavours} ${gsoap_versions_flavours}; do \ - rm -rvf `echo $$v | tr -d .`; \ - done - -%.c.o: %.c - ${COMPILE} -o $@ -c $< - -%.cxx.o: %.c - ${COMPILEXX} -o $@ -c $< - -%.o: %.c - ${COMPILE} -o $@ -c $< - -%.c.thr.o: %.c - ${COMPILE} -o $@ -c $< - -%.cxx.thr.o: %.c - ${COMPILEXX} -o $@ -c $< - -%.thr.o: %.c - ${COMPILE} -o $@ -c $< - -test_gsplugin_cxx.o: %.o: %.cpp stdsoap2.h - ${COMPILEXX} -c ${GLOBUS_INC} $< - -glite_gsplugin${langsuffix}.o glite_gsplugin${langsuffix}.thr.o: soap_version.h - -soap_version.h: stdsoap2.h - head stdsoap2.h | \ - perl -ne '/^\s*stdsoap2.h\s+([0-9])\.([0-9])\.(\S+)\s.*/ && printf "#define GSOAP_VERSION %d%02d%02d\n#define GSOAP_MIN_VERSION \"$$3\"\n#ident \"soap_version.h $$1.$$2.$$3\"\n",$$1,$$2,$$3' >$@ diff --git a/org.glite.security.gsoap-plugin/build.xml b/org.glite.security.gsoap-plugin/build.xml deleted file mode 100755 index 2bae60a..0000000 --- a/org.glite.security.gsoap-plugin/build.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.security.gsoap-plugin/configure b/org.glite.security.gsoap-plugin/configure deleted file mode 100755 index dba8bf2..0000000 --- a/org.glite.security.gsoap-plugin/configure +++ /dev/null @@ -1,975 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $branch; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; -my $libdir = getlibdir(); - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient harvester/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - myproxy => '/opt/myproxy', - gsoap => '/usr', - mysql => '/usr', - 'mysql-devel' => '', - 'mysql-server' => '', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - trustmanager => '/opt/glite', - utiljava => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', - axis => '/usr', - log4c => '/usr', - postgresql => '/usr' -); - -my %jar = ( - 'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar', - 'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %buildroot; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim glite-LB/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db log maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - 'gridsite' => [ qw/apache shared commands core/ ], - 'px' => [ qw/proxyrenewal glite-PX myproxy-yaim/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour:s' => \$thrflavour, - 'nothrflavour:s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'branch=s' => \$branch, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, - 'libdir=s' => \$libdir, - 'emi' => \$emi, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -$extern_prefix{'mysql-devel'}=$extern_prefix{mysql} if $extern_prefix{'mysql-devel'} eq ''; -$extern_prefix{'mysql-server'}=$extern_prefix{mysql} if $extern_prefix{'mysql-server'} eq ''; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version, --branch and --output make sense only in --mode=etics\n" - if ($version || $output || $branch) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK "\tcd $full/$buildroot{$_} && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $buildroot{$_} eq '' ? - "\tcd $full && \${MAKE} distclean\n" : - "\trm -rf $full/$buildroot{$_}\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $buildroot{$_}; - - print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava/ ], - 'lb.common' => [ qw/expat cares:B cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw// ], - 'lb.yaim' => [ qw/yaim_core:R/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ], - 'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B/ ], - 'lbjp-common.log' => [ qw/log4c/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B/ ], - 'security.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], - 'gridsite.core' => [qw/httpd-devel:B gsoap:B globus:B/ ], - 'px.proxyrenewal' => [ qw/globus:B myproxy voms/ ], - 'px.glite-PX' => [qw/myproxy:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R/ ], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/jakarta-commons-codec/ ], - 'lb.client-java' => [ qw/jakarta-commons-lang/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp:B jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - lb.ws-interface:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp:B jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - lbjp-common.log - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/ - jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client - security.gss lbjp-common.log - / ], - 'lb.yaim' => [ qw// ], - 'lb.glite-LB' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - / ], - 'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.log' => [ qw// ], - 'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], - - 'gridsite.core' => [ qw/build.common-cpp:B/ ], - - 'px.proxyrenewal' => [ qw// ], - 'px.glite-PX' => [qw/px.myproxy-yaim:R/], - 'px.myproxy-yaim' => [], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -%obsoletes = ( - 'lb.yaim' => [ qq/glite-yaim-lb/ ], - 'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ], - 'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ], -); - -%cvs_prefix = ( - 'lb' => 'org.glite', - 'jp' => 'org.glite', - 'jobid' => 'org.glite', - 'lbjp-common' => 'org.glite', - 'gridsite' => 'org', - 'security' => 'org.glite', - 'px' => 'org.glite', -); - -%conf_prefix = ( - 'lb' => 'glite-', - 'jp' => 'glite-', - 'jobid' => 'glite-', - 'lbjp-common' => 'glite-', - 'gridsite' => '', - 'security' => 'glite-', - 'px' => 'glite-', -); - -%emi_conf_prefix = ( - 'lb' => 'emi-', - 'jp' => 'emi-', - 'jobid' => 'emi-', - 'lbjp-common' => 'emi-', - 'gridsite' => '', - 'security' => 'emi-', - 'px' => 'emi-', -); - -my @k = keys %deps_aux; -@buildroot{@k} = ('build') x ($#k+1); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@buildroot{@t} = ('') x ($#t+1); - -$buildroot{'gridsite.core'} = 'src'; -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -px.proxyrenewal px.myproxy-yaim px.glite-PX -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($buildroot{$_} eq '') { - $build = "/$buildroot{$_}"; - unless (-d "$full/$buildroot{$_}") { - mkdir "$full/$buildroot{$_}" or die "mkdir $full/$buildroot{$_}: $!\n"; - } - unlink "$full/$buildroot{$_}/Makefile"; - symlink "../Makefile","$full/$buildroot{$_}/Makefile" or die "symlink ../Makefile $full/$buildroot{$_}/Makefile: $!\n"; - } - - open MKINC,">$full/$buildroot{$_}/Makefile.inc" - or die "$full/$buildroot{$_}/Makefile.inc: $!\n"; - - print "Creating $full/$buildroot{$_}/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -libdir = $libdir -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus_essentials=>'vdt_globus_essentials', - globus=>'globus', - myproxy=>'myproxy', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - trustmanager=>'org.glite.security.trustmanager', - utiljava=>'org.glite.security.util-java', - gpt=>'gpt', - fetchcrl=>'fetch-crl', - gip_release=>'glite-info-provider-release', - gip_service=>'glite-info-provider-service', - bdii=>'bdii', - glite_version=>'glite-version', - glite_info_templates=>'glite-info-templates', - glue_schema=>'glue-schema', - yaim_core=>'org.glite.yaim.core', - ); - %etics_projects = ( - vdt=>[qw/globus globus_essentials myproxy/], - 'org.glite'=>[qw/voms gridsite lcas gpt gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/], - ); - - %platform_properties = ( - 'gridsite.core' => { - sl5_x86_64_gcc412 => { aprSuffix => '1' }, - sl5_ia32_gcc412 => { aprSuffix => '1' }, - deb5_x86_64_gcc432 => { aprSuffix => '1.0' }, - deb5_ia32_gcc432 => { aprSuffix => '1.0' }, - slc4_x86_64_gcc346 => { aprSuffix => '0' }, - slc4_ia32_gcc346 => { aprSuffix => '0' }, - default => { - } - }, - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"$cvs_prefix{$subsys}.$subsys.$module/project/version.properties" - or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}$jar{$_}"; - } - - my $conf; - my $conftag; - my $confprefix; - - $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n"; - - if ($emi) { $confprefix = $emi_conf_prefix{$subsys} } - else { $confprefix = $conf_prefix{$subsys} } - - if ($branch) { - $conf = "$confprefix${subsys}-${module}_$branch"; - $conftag = $branch; - # forced low age number - $age = $branch eq 'HEAD' ? '0head' : '0dev'; } - else { - $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - -# XXX: gridsite hack - $conftag = $subsys eq 'gridsite' ? "$conf_prefix{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : - "$conf_prefix{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; } - if ($emi) { - $age = "${age}emi"; - } - - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"}; - - my $confdir = $buildroot{"$subsys.$module"} eq '' ? '..' : '../..'; - - my $package_description = ""; - my $package_summary = ""; - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description"; - $package_description = join ("", ); - close V; - chomp $package_description; - $package_description =~ s/\n/\\n/g; - $package_description = "package.description = $package_description\n"; - } - else { - print STDERR "package.description not found for $subsys.$module!\n"; } - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary"; - $package_summary = join ("", ); - close V; - chomp $package_summary; - $package_summary =~ s/\n/\\n/g; - $package_summary = "package.summary = $package_summary\n"; - } - else { - print STDERR "package.summary not found for $subsys.$module!\n"; } - - my %cmd; - @cmd{qw/configure compile test install packaging clean/} = ('None') x 6; - $cmd{clean} = 'make clean'; - - if ($subsys eq 'gridsite') { - if ($module eq 'core') { - my $flags = 'RELEASE_VERSION=${age}.${platformFamily} prefix=${prefix} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"'; - - $cmd{compile} = "make $flags build"; - $cmd{install} = "make $flags install"; - $cmd{packaging} = "make $flags rpm"; - } - else { - $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this"; - } - } - else { - $cmd{configure} = "cd $confdir && /usr/bin/perl \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --libdir=\${libdir} --module $subsys.$module @copts"; - $cmd{compile} = 'make'; - $cmd{test} = 'make check'; - $cmd{install} = 'make install'; - } - - my $defprops = ''; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) { - $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n"; - } - - my $checkoutcmd; - if ($conftag eq 'HEAD') { - $checkoutcmd = "cvs -d \${vcsroot} co -A \${moduleName}"; - } else { - $checkoutcmd = "cvs -d \${vcsroot} co -r \${tag} \${moduleName}"; - } - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = $cvs_prefix{$subsys}.$subsys.$module -displayName = $conf -description = $cvs_prefix{$subsys}.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conftag -version = $major.$minor.$rev -$dwpath -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = $checkoutcmd - -[Platform-default:BuildCommand] -postpublish = None -packaging = $cmd{packaging} -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = $cmd{compile} -init = None -install = $cmd{install} -clean = $cmd{clean} -test = $cmd{test} -configure = $cmd{configure} -checkstyle = None - -[Platform-default:Property] -$buildroot -aprSuffix = 0 -package.RPMSLocation = \${moduleDir}/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/RPMTMP/SRPMS -package.preserve.libtool = false -$package_description$package_summary$defprops}; - - for (@{$obsoletes{"$subsys.$module"}}) { - print C "package.obsoletes = $_\n"; - print C "package.replaces = $_\n"; - } - - for my $pp (keys %{$platform_properties{"$subsys.$module"}}) { - next if $pp eq 'default'; - print C "[Platform-$pp:Property]\n$buildroot\n"; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) { - print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n"; - } - print C q{package.RPMSLocation = ${moduleDir}/RPMTMP/RPMS -package.SRPMSLocation = ${moduleDir}/RPMTMP/SRPMS -}; - print C "$package_description$package_summary\n"; - } - - print C qq{ -[Platform-default:DynamicDependency] -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - -sub getlibdir { - if ( -e "/etc/debian_version") { # We are on Debian - $lib64="lib"; - $lib32="lib32"; } - else { # Another distribution - $lib64="lib64"; - $lib32="lib"; } - $libdir=$lib32; - - open INP, "uname -s | "; # Check kernel name - $kname= ; - chomp($kname); - close INP; - - if ( $kname == "Linux") { - $arch = ("x86_64\npowerpc\nppc64\n"); - - open INP, "uname -p | "; # Check processor type - $procname= ; - chomp($procname); - close INP; - - if ($arch =~/^$procname\n/) { - return ($lib64); } - - open INP, "uname -m | "; # Check machine hardware - $machname= ; - chomp($machname); - close INP; - - if ($arch =~/^$machname\n/) { - return ($lib64); } - - # special cases (hyperlink lib64, Debian) - if (-l "/usr/lib64") { - $libdir=$lib32; } - - # if /usr/lib64 doesn't exist at all (AIX) - unless ( -e "/usr/lib64" ) { - $libdir=$lib32; } - } - - if ( $kname == "SunOS") { - if (-e "/usr/lib/64") { - $libdir="lib/64"; } - } - - return $libdir; -} - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - --version=maj.min.rev-age specify version here instead of reading version.properties - --branch=branch CVS branch/etics name suffix (HEAD, branch_2_1, ...) - --libdir=libdir typically [lib,lib64] postfix - --emi generate configurations with emi flavor in mode 'etics' - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.security.gsoap-plugin/examples/calc.h.S b/org.glite.security.gsoap-plugin/examples/calc.h.S deleted file mode 100644 index da6ea9f..0000000 --- a/org.glite.security.gsoap-plugin/examples/calc.h.S +++ /dev/null @@ -1,13 +0,0 @@ -//gsoap wscalc service name: CalcService -//gsoap wscalc service type: Calc -//gsoap wscalc service port: https://localhost:19999/ -//gsoap wscalc service namespace: urn:calc:wscalc -//gsoap wscalc service documentation: Calculator service - -//gsoap wscalc service method-documentation: add Adds two numbers -int wscalc__add(double a, double b, struct wscalc__addResponse { -double result; } * ); - -//gsoap wscalc service method-documentation: sub Subtracts two numbers -int wscalc__sub(double a, double b, struct wscalc__subResponse { -double result; } * ); diff --git a/org.glite.security.gsoap-plugin/examples/wscalc_clt_ex.c b/org.glite.security.gsoap-plugin/examples/wscalc_clt_ex.c deleted file mode 100644 index a9e122d..0000000 --- a/org.glite.security.gsoap-plugin/examples/wscalc_clt_ex.c +++ /dev/null @@ -1,69 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include - -#include "GSOAP_H.h" -#include "CalcService.nsmap" - -static const char *server = "http://localhost:19999/"; - -int -main(int argc, char **argv) -{ - struct soap soap; - double a, b, result; - int ret; - struct wscalc__addResponse addresult; - struct wscalc__subResponse subresult; - - - if (argc < 4) { - fprintf(stderr, "Usage: [add|sub] num num\n"); - exit(1); - } - - soap_init(&soap); - soap_set_namespaces(&soap, namespaces); - soap_register_plugin(&soap, glite_gsplugin); - - a = strtod(argv[2], NULL); - b = strtod(argv[3], NULL); - switch ( *argv[1] ) { - case 'a': - ret = soap_call_wscalc__add(&soap, server, "", a, b, &addresult); - result = addresult.result; - break; - case 's': - ret = soap_call_wscalc__sub(&soap, server, "", a, b, &subresult); - result = subresult.result; - break; - default: - fprintf(stderr, "Unknown command\n"); - exit(2); - } - - if ( ret ) { - fprintf(stderr, "NECO JE V ****\n\n"); - fprintf(stderr, "plugin err: %s", glite_gsplugin_errdesc(&soap)); - soap_print_fault(&soap, stderr); - } - else printf("result = %g\n", result); - - - return 0; -} diff --git a/org.glite.security.gsoap-plugin/examples/wscalc_srv_ex.c b/org.glite.security.gsoap-plugin/examples/wscalc_srv_ex.c deleted file mode 100644 index 975afa8..0000000 --- a/org.glite.security.gsoap-plugin/examples/wscalc_srv_ex.c +++ /dev/null @@ -1,128 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include "GSOAP_H.h" -#include "CalcService.nsmap" - - -static struct option long_options[] = { - { "cert", required_argument, NULL, 'c' }, - { "key", required_argument, NULL, 'k' }, - { NULL, 0, NULL, 0 } -}; - -void -usage(const char *me) -{ - fprintf(stderr, - "usage: %s [option]\n" - "\t-c, --cred\t certificate file\n" - "\t-k, --key\t private key file\n", me); -} - - -int -main(int argc, char **argv) -{ - struct soap soap; - glite_gsplugin_Context ctx = NULL; - char *name; - char *cert, *key; - int opt; - edg_wll_GssCred cred; - - cert = key = NULL; - name = strrchr(argv[0],'/'); - if ( name ) name++; else name = argv[0]; - - while ((opt = getopt_long(argc, argv, "c:k:", long_options, NULL)) != EOF) { - switch (opt) { - case 'c': cert = optarg; break; - case 'k': key = optarg; break; - case '?': - default : usage(name); exit(1); - } - } - - soap_init(&soap); - soap_set_namespaces(&soap, namespaces); - - if ( soap_register_plugin_arg(&soap, glite_gsplugin, NULL) ) { - fprintf(stderr, "Can't register plugin\n"); - exit(1); - } - - if ( cert || key ) { - ctx = glite_gsplugin_get_context(&soap); - if (ctx == NULL) { - fprintf(stderr, "Can't get context\n"); - exit(1); - } - - if (glite_gsplugin_set_credential(ctx, cert, key) != 0) { - fprintf(stderr, "Can't set credentials: %s\n", - glite_gsplugin_errdesc(&soap)); - exit(1); - } - } - - if ( soap_bind(&soap, NULL, 19999, 100) < 0 ) { - soap_print_fault(&soap, stderr); - exit(1); - } - - while ( 1 ) { - printf("accepting connection\n"); - if ( soap_accept(&soap) < 0 ) { - fprintf(stderr, "soap_accept() failed!!!\n"); - soap_print_fault(&soap, stderr); - fprintf(stderr, "plugin err: %s\n", glite_gsplugin_errdesc(&soap)); - continue; - } - - printf("serving connection\n"); - if ( soap_serve(&soap) ) { - soap_print_fault(&soap, stderr); - fprintf(stderr, "plugin err: %s", glite_gsplugin_errdesc(&soap)); - } - - soap_destroy(&soap); /* clean up class instances */ - soap_end(&soap); /* clean up everything and close socket */ - } - soap_done(&soap); /* close master socket */ - - if ( ctx ) glite_gsplugin_free_context(ctx); - - return 0; -} - -int wscalc__add(struct soap *soap, double a, double b, struct wscalc__addResponse *result) -{ - result->result = a + b; - return SOAP_OK; -} - -int wscalc__sub(struct soap *soap, double a, double b, struct wscalc__subResponse *result) -{ - result->result = a - b; - return SOAP_OK; -} diff --git a/org.glite.security.gsoap-plugin/examples/wscalc_srv_ex2.c b/org.glite.security.gsoap-plugin/examples/wscalc_srv_ex2.c deleted file mode 100644 index 3bec28a..0000000 --- a/org.glite.security.gsoap-plugin/examples/wscalc_srv_ex2.c +++ /dev/null @@ -1,167 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include - -#include "GSOAP_H.h" -#include "CalcService.nsmap" - - -static struct option long_options[] = { - { "cert", required_argument, NULL, 'c' }, - { "key", required_argument, NULL, 'k' }, - { "port", required_argument, NULL, 'p' }, - { NULL, 0, NULL, 0 } -}; - -void -usage(const char *me) -{ - fprintf(stderr, - "usage: %s [option]\n" - "\t-p, --port\t listening port\n" - "\t-c, --cred\t certificate file\n" - "\t-k, --key\t private key file\n", me); -} - - -int -main(int argc, char **argv) -{ - struct soap soap; - edg_wll_GssStatus gss_code; - edg_wll_GssCred cred = NULL; - edg_wll_GssConnection connection; - glite_gsplugin_Context ctx; - struct sockaddr_storage a; - int alen; - char *name, *msg; - int opt, - port = 19999; - char *cert_filename = NULL, *key_filename = NULL; - int sock; - struct addrinfo hints; - struct addrinfo *res; - char *portname; - int error; - - name = strrchr(argv[0],'/'); - if ( name ) name++; else name = argv[0]; - - if ( glite_gsplugin_init_context(&ctx) ) { perror("init context"); exit(1); } - - while ((opt = getopt_long(argc, argv, "c:k:p:", long_options, NULL)) != EOF) { - switch (opt) { - case 'p': port = atoi(optarg); break; - case 'c': cert_filename = strdup(optarg); break; - case 'k': key_filename = strdup(optarg); break; - case '?': - default : usage(name); exit(1); - } - } - - if ( edg_wll_gss_acquire_cred_gsi(cert_filename, key_filename, &cred, &gss_code) ) { - edg_wll_gss_get_error(&gss_code, "Failed to read credential", &msg); - fprintf(stderr, "%s\n", msg); - free(msg); - exit(1); - } - if (cred->name) { - printf("server running with certificate: %s\n", cred->name); - } - - glite_gsplugin_use_credential(ctx, cred); - - soap_init(&soap); - soap_set_namespaces(&soap, namespaces); - - if ( soap_register_plugin_arg(&soap, glite_gsplugin, ctx) ) { - fprintf(stderr, "Can't register plugin\n"); - exit(1); - } - - asprintf(&portname, "%d", port); - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_flags = AI_PASSIVE; - hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo(NULL, portname , &hints, &res); - if (error) { - perror(gai_strerror(error)); - exit(1); - } - alen = res->ai_addrlen; - if ( (sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol)) < 0 ) - { perror("socket()"); exit(1); } - if ( bind(sock, res->ai_addr, res->ai_addrlen) ) { perror("bind()"); exit(1); } - freeaddrinfo(res); - if ( listen(sock, 100) ) { perror("listen()"); exit(1); } - - bzero((char *) &a, alen); - - while ( 1 ) { - int conn; - - printf("accepting connection\n"); - if ( (conn = accept(sock, (struct sockaddr *) &a, &alen)) < 0 ) { - close(sock); - perror("accept"); - exit(1); - } - if ( edg_wll_gss_accept(cred,conn,ctx->timeout,&connection,&gss_code) ){ - edg_wll_gss_get_error(&gss_code, "Failed to read credential", &msg); - fprintf(stderr, "%s\n", msg); - free(msg); - exit(1); - } - - glite_gsplugin_set_connection(ctx, &connection); - - printf("serving connection\n"); - if ( soap_serve(&soap) ) { - soap_print_fault(&soap, stderr); - fprintf(stderr, "plugin err: %s", glite_gsplugin_errdesc(&soap)); - } - - soap_destroy(&soap); /* clean up class instances */ - soap_end(&soap); /* clean up everything and close socket */ - edg_wll_gss_close(&connection, NULL); - } - - soap_done(&soap); /* close master socket */ - - glite_gsplugin_free_context(ctx); - edg_wll_gss_release_cred(&cred, NULL); - - return 0; -} - -int wscalc__add(struct soap *soap, double a, double b, struct wscalc__addResponse *result) -{ - result->result = a + b; - return SOAP_OK; -} - -int wscalc__sub(struct soap *soap, double a, double b, struct wscalc__subResponse *result) -{ - result->result = a - b; - return SOAP_OK; -} diff --git a/org.glite.security.gsoap-plugin/interface/glite_gscompat.h b/org.glite.security.gsoap-plugin/interface/glite_gscompat.h deleted file mode 100644 index 50a2b93..0000000 --- a/org.glite.security.gsoap-plugin/interface/glite_gscompat.h +++ /dev/null @@ -1,111 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_SECURITY_GSCOMPAT_H -#define GLITE_SECURITY_GSCOMPAT_H - -#ident "$Header: " - -#ifndef GSOAP_VERSION - #error GSOAP_VERSION required -#endif - -#ifndef GSOAP_VERSION_LETTER -#define GSOAP_VERSION_LETTER '\0' -#endif - -#if GSOAP_VERSION >= 20709 || GSOAP_VERSION == 20706 && GSOAP_VERSION_LETTER >= 'd' - #define GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) ((CHOICE)->union_##TYPENAME.ITEM) - #define GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) ((CHOICE)->__union_##TYPENAME) = SOAP_UNION__##NS##__union_##TYPENAME##_##ITEM - #define GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) (((CHOICE)->__union_##TYPENAME) == SOAP_UNION__##NS##__union_##TYPENAME##_##ITEM) - /** 2.7.10 requires created dummy choice with type == 0 for empty optional choice */ - #if GSOAP_VERSION >= 20710 - #define GLITE_SECURITY_GSOAP_CHOICE_SETNULL(CHOICE, TYPENAME) ((CHOICE)->__union_##TYPENAME) = 0 - #endif -#elif GSOAP_VERSION >= 20706 - #define GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) ((CHOICE)->union_##TYPENO.ITEM) - #define GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) ((CHOICE)->__union_##TYPENO) = SOAP_UNION_##NS##__union_##TYPENO##_##ITEM - #define GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) (((CHOICE)->__union_##TYPENO) == SOAP_UNION_##NS##__union_##TYPENO##_##ITEM) -#else - #define GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) ((CHOICE)->ITEM) - #define GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) - #define GLITE_SECURITY_GSOAP_CHOICE_ISTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO) (((CHOICE)->ITEM) != NULL) -#endif -#define GLITE_SECURITY_GSOAP_CHOICE_SET(CHOICE, ITEM, NS, TYPENAME, TYPENO, VALUE) do { \ - memset((CHOICE), 0, sizeof(*(CHOICE))); \ - GLITE_SECURITY_GSOAP_CHOICE_SETTYPE(CHOICE, ITEM, NS, TYPENAME, TYPENO); \ - GLITE_SECURITY_GSOAP_CHOICE_GET(CHOICE, ITEM, TYPENAME, TYPENO) = (VALUE); \ -} while(0) - -#if GSOAP_VERSION >= 20706 - #define GLITE_SECURITY_GSOAP_REASON2(SOAP) ((SOAP)->fault->SOAP_ENV__Reason ? (SOAP)->fault->SOAP_ENV__Reason->SOAP_ENV__Text : "(no reason)") - #define GLITE_SECURITY_GSOAP_TRUE xsd__boolean__true_ - #define GLITE_SECURITY_GSOAP_FALSE xsd__boolean__false_ -#else - #define GLITE_SECURITY_GSOAP_REASON2(SOAP) ((SOAP)->fault->SOAP_ENV__Reason) - #define GLITE_SECURITY_GSOAP_TRUE true_ - #define GLITE_SECURITY_GSOAP_FALSE false_ -#endif - -#define GLITE_SECURITY_GSOAP_DETAIL(SOAP) ((SOAP)->version == 2 ? (SOAP)->fault->SOAP_ENV__Detail : (SOAP)->fault->detail) -#define GLITE_SECURITY_GSOAP_REASON(SOAP) ((SOAP)->version == 2 ? GLITE_SECURITY_GSOAP_REASON2((SOAP)) : (SOAP)->fault->faultstring) - -#if GSOAP_VERSION >= 20709 - #define GLITE_SECURITY_GSOAP_LIST_CREATE0(SOAP, LIST, SIZE, TYPE, N) do { \ - if ((N) != 0) (LIST) = soap_malloc((SOAP), (N) * sizeof(TYPE)); \ - else (LIST) = NULL; \ - (SIZE) = (N); \ -} while (0) - #define GLITE_SECURITY_GSOAP_LIST_DESTROY0(SOAP, LIST, SIZE) do { \ - if ((LIST) && (SIZE) != 0) soap_dealloc((SOAP), (LIST)); \ - (LIST) = NULL; \ -} while (0) - #define GLITE_SECURITY_GSOAP_LIST_GET(LIST, INDEX) (&(LIST)[INDEX]) - #define GLITE_SECURITY_GSOAP_LIST_TYPE(NS, LIST) struct NS##__##LIST * -#else - #define GLITE_SECURITY_GSOAP_LIST_CREATE0(SOAP, LIST, SIZE, TYPE, N) do { \ - int ilist; \ - \ - if ((N) != 0) (LIST) = soap_malloc((SOAP), (N) * sizeof(void *)); \ - else (LIST) = NULL; \ - (SIZE) = (N); \ - for (ilist = 0; ilist < (N); ilist++) { \ - (LIST)[ilist] = soap_malloc((SOAP), sizeof(TYPE)); \ - } \ -} while (0) - #define GLITE_SECURITY_GSOAP_LIST_DESTROY0(SOAP, LIST, SIZE) do { \ - int ilist; \ - \ - for (ilist = 0; ilist < (SIZE); ilist++) soap_dealloc((SOAP), (LIST)[ilist]); \ - if ((LIST) && (SIZE) != 0) soap_dealloc((SOAP), (LIST)); \ - (LIST) = NULL; \ -} while (0) - #define GLITE_SECURITY_GSOAP_LIST_GET(LIST, INDEX) ((LIST)[INDEX]) - #define GLITE_SECURITY_GSOAP_LIST_TYPE(NS, LIST) struct NS##__##LIST ** -#endif -#define GLITE_SECURITY_GSOAP_LIST_CREATE(SOAP, CONTAINER, LIST, TYPE, N) GLITE_SECURITY_GSOAP_LIST_CREATE0(SOAP, (CONTAINER)->LIST, (CONTAINER)->__size##LIST, TYPE, N) -#define GLITE_SECURITY_GSOAP_LIST_DESTROY(SOAP, CONTAINER, LIST) GLITE_SECURITY_GSOAP_LIST_DESTROY0(SOAP, (CONTAINER)->LIST, (CONTAINER)->__size##LIST) - -#if GSOAP_VERSION >= 20710 - #define GLITE_SECURITY_GSOAP_SET_FIXED(soap,attr,value) \ - (attr) = soap_strdup((soap),(value)) -#else -/* XXX unsupported */ - #define GLITE_SECURITY_GSOAP_SET_FIXED(soap,attr,value) -#endif - -#endif diff --git a/org.glite.security.gsoap-plugin/interface/glite_gsplugin-int.h b/org.glite.security.gsoap-plugin/interface/glite_gsplugin-int.h deleted file mode 100644 index a962882..0000000 --- a/org.glite.security.gsoap-plugin/interface/glite_gsplugin-int.h +++ /dev/null @@ -1,45 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_SECURITY_GSOAP_PLUGIN_INTERNAL_H -#define GLITE_SECURITY_GSOAP_PLUGIN_INTERNAL_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "glite/security/glite_gss.h" - -struct _glite_gsplugin_ctx { - struct timeval _timeout, *timeout; - - char *error_msg; - - edg_wll_GssConnection *connection; - edg_wll_GssCred cred; - int internal_connection; - int internal_credentials; - - void *user_data; -}; - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/org.glite.security.gsoap-plugin/interface/glite_gsplugin.h b/org.glite.security.gsoap-plugin/interface/glite_gsplugin.h deleted file mode 100644 index 022a897..0000000 --- a/org.glite.security.gsoap-plugin/interface/glite_gsplugin.h +++ /dev/null @@ -1,51 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#ifndef GLITE_SECURITY_GSOAP_PLUGIN_H -#define GLITE_SECURITY_GSOAP_PLUGIN_H - -#include - -#include "glite/security/glite_gss.h" - -#ifdef __cplusplus -extern "C" { -#endif - -#define PLUGIN_ID "GLITE_GSOAP_PLUGIN" - -typedef struct _glite_gsplugin_ctx *glite_gsplugin_Context; - -extern int glite_gsplugin_init_context(glite_gsplugin_Context *); -extern int glite_gsplugin_free_context(glite_gsplugin_Context); -extern glite_gsplugin_Context glite_gsplugin_get_context(struct soap *); -extern void *glite_gsplugin_get_udata(struct soap *); -extern void glite_gsplugin_set_udata(struct soap *, void *); - -extern void glite_gsplugin_set_timeout(glite_gsplugin_Context, struct timeval const *); -extern int glite_gsplugin_set_credential(glite_gsplugin_Context, const char *, const char *); -extern void glite_gsplugin_use_credential(glite_gsplugin_Context, edg_wll_GssCred); -extern int glite_gsplugin_set_connection(glite_gsplugin_Context, edg_wll_GssConnection *); - -extern int glite_gsplugin(struct soap *, struct soap_plugin *, void *); -extern char *glite_gsplugin_errdesc(struct soap *); - -#ifdef __cplusplus -} -#endif - -#endif /* GLITE_SECURITY_GSOAP_PLUGIN_H */ diff --git a/org.glite.security.gsoap-plugin/project/ChangeLog b/org.glite.security.gsoap-plugin/project/ChangeLog deleted file mode 100644 index 7024a4a..0000000 --- a/org.glite.security.gsoap-plugin/project/ChangeLog +++ /dev/null @@ -1,45 +0,0 @@ -1.5.3-1 -- avoid memleak in gsoap -- fix #32059 -- support gsoap 2.7.10 - -1.5.4-1 -- handle client connection errors in gsoap (generate faults) -- don't define gsoap.platformName in configuration confusingly - -1.5.4-2 -- disctinct c and c++ builds (concerns gsoap 2.7.10 only) - -2.0.0-1 -- LB 2.0 release - -2.0.0-2 -- configure script update (globus flavors added to configure call) - -2.0.1-1 -- API reverted towards backward compatibility - -2.0.1-2 -- Module repacked - -2.0.1-3 -- install libraries into $libdir - -2.0.2-1 -- Updated Makefile & Configure script - -2.1.0-1 -- IPv6 fixes -- Fixed error reporting -- Attempt to fix compatibility with gsoap 2.7.10 -- Improved portability - -2.1.1-1 -- libtool version numbering reintroduced - -2.1.2-1 -- Fixed target 'clean' in the Makefile to handle debian builds - -2.1.2-2 -- Module rebuilt - diff --git a/org.glite.security.gsoap-plugin/project/build.number b/org.glite.security.gsoap-plugin/project/build.number deleted file mode 100644 index d794048..0000000 --- a/org.glite.security.gsoap-plugin/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build=0 diff --git a/org.glite.security.gsoap-plugin/project/build.properties b/org.glite.security.gsoap-plugin/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.security.gsoap-plugin/project/configure.properties.xml b/org.glite.security.gsoap-plugin/project/configure.properties.xml deleted file mode 100644 index 3977f05..0000000 --- a/org.glite.security.gsoap-plugin/project/configure.properties.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -lbprefix=${subsystem.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -cares_prefix=${with.c-ares.prefix} -globus_prefix=${with.globus.prefix} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -cppunit=${with.cppunit.prefix} -gsoap_prefix=${with.gsoap.prefix} -gsoap_default_version=${ext.gsoap.version} -gsoap_name=${ext.gsoap.name} -gsoap_platform=${ext.gsoap.platform} -repository=${repository} - - - diff --git a/org.glite.security.gsoap-plugin/project/libtoolhack/gcc b/org.glite.security.gsoap-plugin/project/libtoolhack/gcc deleted file mode 100644 index 32933cd..0000000 --- a/org.glite.security.gsoap-plugin/project/libtoolhack/gcc +++ /dev/null @@ -1 +0,0 @@ -g++ "$@" diff --git a/org.glite.security.gsoap-plugin/project/package.description b/org.glite.security.gsoap-plugin/project/package.description deleted file mode 100644 index ebfb912..0000000 --- a/org.glite.security.gsoap-plugin/project/package.description +++ /dev/null @@ -1 +0,0 @@ -glite-security-gsoap-plugin is plugin for gSoap providing secured communication via GSS, as well as strict timing control of all operations via glite-security-gss. diff --git a/org.glite.security.gsoap-plugin/project/package.summary b/org.glite.security.gsoap-plugin/project/package.summary deleted file mode 100644 index 2f80d4f..0000000 --- a/org.glite.security.gsoap-plugin/project/package.summary +++ /dev/null @@ -1 +0,0 @@ -Plugin for gSoap to use glite-security-gss as the communication layer. diff --git a/org.glite.security.gsoap-plugin/project/properties.xml b/org.glite.security.gsoap-plugin/project/properties.xml deleted file mode 100755 index f63ddbd..0000000 --- a/org.glite.security.gsoap-plugin/project/properties.xml +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.security.gsoap-plugin/project/tar_exclude b/org.glite.security.gsoap-plugin/project/tar_exclude deleted file mode 100644 index b3133e4..0000000 --- a/org.glite.security.gsoap-plugin/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure-options.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.security.gsoap-plugin/project/version.properties b/org.glite.security.gsoap-plugin/project/version.properties deleted file mode 100644 index 7838732..0000000 --- a/org.glite.security.gsoap-plugin/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# $Header$ -module.version=2.1.2 -module.age=2 diff --git a/org.glite.security.gsoap-plugin/src/glite_gsplugin.c b/org.glite.security.gsoap-plugin/src/glite_gsplugin.c deleted file mode 100644 index 81128f4..0000000 --- a/org.glite.security.gsoap-plugin/src/glite_gsplugin.c +++ /dev/null @@ -1,594 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include - -#include -#include -#include -#include - -#include "soap_version.h" -#include "glite_gsplugin-int.h" -#include "glite_gsplugin.h" - -#ifdef GSPLUGIN_DEBUG -# define pdprintf(s) printf s -#else -# define pdprintf(s) -#endif - -typedef struct _int_plugin_data_t { - glite_gsplugin_Context ctx; /**< data used for connection etc. */ - int def; /**< is the context created by plugin? */ -} int_plugin_data_t; - -static const char plugin_id[] = PLUGIN_ID; - -static void glite_gsplugin_delete(struct soap *, struct soap_plugin *); -static int glite_gsplugin_copy(struct soap *, struct soap_plugin *, struct soap_plugin *); - -static size_t glite_gsplugin_recv(struct soap *, char *, size_t); -static int glite_gsplugin_send(struct soap *, const char *, size_t); -static int glite_gsplugin_connect(struct soap *, const char *, const char *, int); -static int glite_gsplugin_close(struct soap *); -#if GSOAP_VERSION >= 20700 -static int glite_gsplugin_poll(struct soap *); -#endif -static int glite_gsplugin_accept(struct soap *, int, struct sockaddr *, int *); -static int glite_gsplugin_posthdr(struct soap *soap, const char *key, const char *val); - -static int get_error(int err, edg_wll_GssStatus *gss_stat, const char *msg, char **desc); - -int -glite_gsplugin_init_context(glite_gsplugin_Context *ctx) -{ - glite_gsplugin_Context out = (glite_gsplugin_Context) malloc(sizeof(*out)); - if (!out) return ENOMEM; - - memset(out, 0, sizeof(*out)); - out->cred = NULL; - - /* XXX: some troubles with glite_gss and blocking calls! - out->timeout.tv_sec = 10000; - */ - - out->timeout = NULL; - *ctx = out; - - return 0; -} - -int -glite_gsplugin_free_context(glite_gsplugin_Context ctx) -{ - if (ctx == NULL) - return 0; - - if ( ctx->internal_credentials && ctx->cred != NULL ) - edg_wll_gss_release_cred(&ctx->cred, NULL); - if ( ctx->internal_connection && ctx->connection ) { - if ( ctx->connection->context != NULL ) - edg_wll_gss_close(ctx->connection, NULL); - free(ctx->connection); - } - if (ctx->error_msg) - free(ctx->error_msg); - free(ctx); - - return 0; -} - -glite_gsplugin_Context -glite_gsplugin_get_context(struct soap *soap) -{ - return ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; -} - -void * -glite_gsplugin_get_udata(struct soap *soap) -{ - int_plugin_data_t *pdata; - - pdata = (int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id); - assert(pdata); - return pdata->ctx->user_data; -} - -void -glite_gsplugin_set_udata(struct soap *soap, void *d) -{ - int_plugin_data_t *pdata; - - pdata = (int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id); - assert(pdata); - pdata->ctx->user_data = d; -} - -void glite_gsplugin_set_timeout(glite_gsplugin_Context ctx, struct timeval const *to) -{ - if (to) { - ctx->_timeout = *to; - ctx->timeout = &ctx->_timeout; - } - else ctx->timeout = NULL; -} - -int -glite_gsplugin_set_credential(glite_gsplugin_Context ctx, - const char *cert, - const char *key) -{ - edg_wll_GssStatus gss_code; - edg_wll_GssCred cred = NULL; - - int ret; - - ret = edg_wll_gss_acquire_cred_gsi((char *)cert, (char *)key, &cred, &gss_code); - if (ret) - return get_error(ret, &gss_code, "failed to load GSI credentials", &ctx->error_msg); - - if (ctx->internal_credentials && ctx->cred != NULL) - edg_wll_gss_release_cred(&ctx->cred, NULL); - - ctx->cred = cred; - ctx->internal_credentials = 1; - - return 0; -} - -void -glite_gsplugin_use_credential(glite_gsplugin_Context ctx, - edg_wll_GssCred cred) -{ - ctx->cred = cred; - ctx->internal_credentials = 0; -} - -int -glite_gsplugin_set_connection(glite_gsplugin_Context ctx, edg_wll_GssConnection *conn) -{ - int ret = SOAP_OK; - - if ( ctx->connection ) { - if ( ctx->internal_connection && ctx->connection->context != NULL) { - pdprintf(("GSLITE_GSPLUGIN: closing gss connection\n")); - ret = edg_wll_gss_close(ctx->connection, ctx->timeout); - free(ctx->connection); - } - } - ctx->connection = conn; - ctx->internal_connection = 0; - - return ret; -} - -int -glite_gsplugin(struct soap *soap, struct soap_plugin *p, void *arg) -{ - int_plugin_data_t *pdata = (int_plugin_data_t *)malloc(sizeof(int_plugin_data_t)); - - pdprintf(("GSLITE_GSPLUGIN: initializing gSOAP plugin\n")); - if ( !pdata ) return ENOMEM; - if ( arg ) { - pdprintf(("GSLITE_GSPLUGIN: Context is given\n")); - pdata->ctx = (glite_gsplugin_Context)arg; - pdata->def = 0; - } - else { - edg_wll_GssStatus gss_code; - - pdprintf(("GSLITE_GSPLUGIN: Creating default context\n")); - if ( glite_gsplugin_init_context((glite_gsplugin_Context*)&(pdata->ctx)) ) { - free(pdata); - return ENOMEM; - } - if ( edg_wll_gss_acquire_cred_gsi(NULL, NULL, &pdata->ctx->cred, &gss_code) ) { - /* XXX: Let user know, that cred. load failed. Somehow... - */ - glite_gsplugin_free_context(pdata->ctx); - return EINVAL; - } - pdata->ctx->internal_credentials = 1; - pdprintf(("GSLITE_GSPLUGIN: server running with certificate: %s\n", - pdata->ctx->cred->name)); - pdata->def = 1; - } - - p->id = plugin_id; - p->data = pdata; - p->fdelete = glite_gsplugin_delete; - p->fcopy = glite_gsplugin_copy; - - soap->fopen = glite_gsplugin_connect; - soap->fconnect = NULL; - soap->fclose = glite_gsplugin_close; -#if GSOAP_VERSION >= 20700 - soap->fpoll = glite_gsplugin_poll; -#endif - soap->faccept = glite_gsplugin_accept; - soap->fsend = glite_gsplugin_send; - soap->frecv = glite_gsplugin_recv; - soap->fposthdr = glite_gsplugin_posthdr; - - return SOAP_OK; -} - - -char *glite_gsplugin_errdesc(struct soap *soap) -{ - glite_gsplugin_Context ctx; - - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - if ( ctx ) return ctx->error_msg; - - return NULL; -} - - - -static int -glite_gsplugin_copy(struct soap *soap, struct soap_plugin *dst, struct soap_plugin *src) -{ - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_copy()\n")); - /* Should be the copy code here? - */ - return ENOSYS; -} - -static void -glite_gsplugin_delete(struct soap *soap, struct soap_plugin *p) -{ - int_plugin_data_t *d = (int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id); - - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_delete()\n")); - if ( d->def ) { - glite_gsplugin_close(soap); - glite_gsplugin_free_context(d->ctx); - } - free(d); -} - - -static int -glite_gsplugin_connect( - struct soap *soap, - const char *endpoint, - const char *host, - int port) -{ - glite_gsplugin_Context ctx; - edg_wll_GssStatus gss_stat; - int ret; - const char *msg = NULL; - - - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_connect()\n")); -#if defined(CHECK_GSOAP_VERSION) && GSOAP_VERSION <= 20700 - if ( GSOAP_VERSION < 20700 - || (GSOAP_VERSION == 20700 - && (strlen(GSOAP_MIN_VERSION) < 1 || GSOAP_MIN_VERSION[1] < 'e')) ) { - fprintf(stderr, "Client connect will work only with gSOAP v2.7.0e and later"); - soap->errnum = ENOSYS; - return ENOSYS; - } -#endif - - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - if (ctx->connection) { - pdprintf(("GSLITE_GSPLUGIN: Warning: connection dropped, new to %s:%d\n", host, port)); - } - pdprintf(("GSLITE_GSPLUGIN: connection to %s:%d will be established\n", host, port)); - - if ( ctx->cred == NULL ) { - pdprintf(("GSLITE_GSPLUGIN: loading default credentials\n")); - ret = edg_wll_gss_acquire_cred_gsi(NULL, NULL, - &ctx->cred, &gss_stat); - if ( ret ) { - msg = "failed to load GSI credentials"; - goto err; - } - ctx->internal_credentials = 1; - } - - if ( !(ctx->connection = (edg_wll_GssConnection *)malloc(sizeof(*ctx->connection))) ) return errno; - ret = edg_wll_gss_connect(ctx->cred, - host, port, - ctx->timeout, - ctx->connection, &gss_stat); - if ( ret ) { - free(ctx->connection); - ctx->connection = NULL; - msg = "edg_wll_gss_connect() error"; - goto err; - } - ctx->internal_connection = 1; - - soap->errnum = 0; - return ctx->connection->sock; - -err: - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_connect() error!\n")); - - soap->errnum = get_error(ret, &gss_stat, msg, &ctx->error_msg); - - switch ( ret ) { - case EDG_WLL_GSS_ERROR_GSS: - soap_set_sender_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR); - break; - case EDG_WLL_GSS_ERROR_HERRNO: - soap_set_sender_error(soap, "connection error", hstrerror(soap->errnum), SOAP_CLI_FAULT); - break; - case EDG_WLL_GSS_ERROR_EOF: - soap->errnum = ECONNREFUSED; - soap_set_sender_error(soap, "connection error", strerror(soap->errnum), SOAP_CLI_FAULT); - break; - case EDG_WLL_GSS_ERROR_ERRNO: - case EDG_WLL_GSS_ERROR_TIMEOUT: - soap_set_sender_error(soap, "connection error", strerror(soap->errnum), SOAP_CLI_FAULT); - break; - default: - soap_set_sender_error(soap, "unknown error", "", SOAP_CLI_FAULT); - break; - } - - return SOAP_INVALID_SOCKET; -} - -/** It is called in soap_closesocket() - * - * return like errno value - */ -static int -glite_gsplugin_close(struct soap *soap) -{ - glite_gsplugin_Context ctx; - - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_close()\n")); - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - return glite_gsplugin_set_connection(ctx, NULL); -} - - -static int -glite_gsplugin_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ - glite_gsplugin_Context ctx; - edg_wll_GssStatus gss_code; - int conn; - int ret; - - soap->errnum = 0; - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_accept()\n")); - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - if ( (conn = accept(s, (struct sockaddr *)&a, (socklen_t *)n)) < 0 ) return conn; - if ( !ctx->connection ) { - if ( !(ctx->connection = (edg_wll_GssConnection *)malloc(sizeof(*ctx->connection))) ) { - close(conn); - soap_set_receiver_error(soap, "malloc error", strerror(ENOMEM), ENOMEM); - return SOAP_INVALID_SOCKET; - } - ctx->internal_connection = 1; - } - if ( (ret = edg_wll_gss_accept(ctx->cred, conn, ctx->timeout, ctx->connection, &gss_code)) != 0) { - pdprintf(("GSLITE_GSPLUGIN: Client authentication failed, closing.\n")); - close(conn); - get_error(ret, &gss_code, "Client authentication failed", &ctx->error_msg); - soap->errnum = SOAP_SVR_FAULT; - soap_set_receiver_error(soap, "SSL error", "SSL authentication failed in tcp_connect(): check password, key file, and ca file.", SOAP_SSL_ERROR); - return SOAP_INVALID_SOCKET; - } - - return conn; -} - -static size_t -glite_gsplugin_recv(struct soap *soap, char *buf, size_t bufsz) -{ - glite_gsplugin_Context ctx; - edg_wll_GssStatus gss_code; - int len; - - - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - if ( ctx->error_msg ) { free(ctx->error_msg); ctx->error_msg = NULL; } - - if ( ctx->connection->context == NULL ) { - soap->errnum = ENOTCONN; - /* XXX: glite_gsplugin_send() returns SOAP_EOF on errors - */ - return 0; - } - - len = edg_wll_gss_read(ctx->connection, buf, bufsz, - ctx->timeout, - &gss_code); - - switch ( len ) { - case EDG_WLL_GSS_OK: - break; - case EDG_WLL_GSS_ERROR_GSS: - case EDG_WLL_GSS_ERROR_ERRNO: - case EDG_WLL_GSS_ERROR_TIMEOUT: - case EDG_WLL_GSS_ERROR_EOF: - soap->errnum = get_error(len, &gss_code, "receiving WS request", &ctx->error_msg); - return 0; - /* default: fallthrough */ - } - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_recv() = %d\n",len)); - - return len; -} - -static int -glite_gsplugin_send(struct soap *soap, const char *buf, size_t bufsz) -{ - glite_gsplugin_Context ctx; - edg_wll_GssStatus gss_code; - struct sigaction sa, osa; - size_t total = 0; - int ret; - - - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - /* XXX: check whether ctx is initialized - * i.e. ctx->connection != NULL - */ - if ( ctx->error_msg ) { free(ctx->error_msg); ctx->error_msg = NULL; } - if ( ctx->connection == NULL || ctx->connection->context == NULL ) { - soap->errnum = ENOTCONN; - return SOAP_EOF; - } - - memset(&sa, 0, sizeof(sa)); - assert(sa.sa_handler == NULL); - sa.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &sa, &osa); - - ret = edg_wll_gss_write_full(ctx->connection, - (void*)buf, bufsz, ctx->timeout, &total, &gss_code); - - sigaction(SIGPIPE, &osa, NULL); - - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_send(%d) = %d\n",bufsz,ret)); - - soap->errnum = get_error(ret, &gss_code, "sending WS request", &ctx->error_msg); - - switch ( ret ) { - case EDG_WLL_GSS_OK: - return SOAP_OK; - - case EDG_WLL_GSS_ERROR_ERRNO: - if (soap->errnum == EPIPE) soap->errnum = ENOTCONN; - return SOAP_EOF; - - case EDG_WLL_GSS_ERROR_TIMEOUT: - case EDG_WLL_GSS_ERROR_GSS: - case EDG_WLL_GSS_ERROR_EOF: - default: - return SOAP_EOF; - } -} - - -#if GSOAP_VERSION >= 20700 -static int -glite_gsplugin_poll(struct soap *soap) -{ - glite_gsplugin_Context ctx; - fd_set readfds; - struct timeval timeout = {tv_sec: 0, tv_usec: 0}; - int ret; - - ctx = ((int_plugin_data_t *)soap_lookup_plugin(soap, plugin_id))->ctx; - if (!ctx->connection || !ctx->connection->context) { - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_poll, no connection\n")); - return SOAP_EOF; - } - - FD_ZERO(&readfds); - FD_SET(ctx->connection->sock, &readfds); - ret = select(ctx->connection->sock + 1, &readfds, NULL, NULL, &timeout); - if (ret < 0) { - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_poll, select(%d) failed\n", ctx->connection->sock)); - return SOAP_TCP_ERROR; - } else if (ret == 0) { - /* has been OK but server can disconnect anytime */ - return SOAP_OK; - } else { - pdprintf(("GSLITE_GSPLUGIN: glite_gsplugin_poll, select(%d) = %d\n", ctx->connection->sock, ret)); - return SOAP_EOF; - } -} -#endif - - -static int http_send_header(struct soap *soap, const char *s) { - 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; -} - - -static int glite_gsplugin_posthdr(struct soap *soap, const char *key, const char *val) { - if (key) { - if (strcmp(key, "Status") == 0) { - snprintf(soap->tmpbuf, sizeof(soap->tmpbuf), "HTTP/%s", soap->http_version); - if (http_send_header(soap, soap->tmpbuf)) return soap->error; - if (val && (soap_send_raw(soap, " ", 1) || http_send_header(soap, val))) - return soap->error; - } else { - 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); -} - - -static int get_error(int err, edg_wll_GssStatus *gss_stat, const char *msg, char **desc) { - int num; - const char *s; - - if (desc) { - free(*desc); - *desc = NULL; - } - - switch (err) { - case EDG_WLL_GSS_OK: - return 0; - case EDG_WLL_GSS_ERROR_GSS: - if (desc) edg_wll_gss_get_error(gss_stat, msg, desc); - return ENOTCONN; - case EDG_WLL_GSS_ERROR_HERRNO: - num = h_errno; - s = hstrerror(num); - if (desc) { - if (s) asprintf(desc, "%s: %s", msg, s); - else asprintf(desc, "%s: herrno %d", msg, num); - } - return num; - case EDG_WLL_GSS_ERROR_ERRNO: - num = errno; - break; - case EDG_WLL_GSS_ERROR_TIMEOUT: - num = ETIMEDOUT; - break; - case EDG_WLL_GSS_ERROR_EOF: - num = ENOTCONN; - break; - default: - if (desc) asprintf(desc, "%s: unknown error type %d from glite_gss", msg, err); - return EINVAL; - } - - if (desc) asprintf(desc, "%s: %s", msg, strerror(num)); - return num; -} diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.c deleted file mode 100644 index 78c4872..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.c +++ /dev/null @@ -1,11020 +0,0 @@ -/* - -stdsoap2.c[pp] 2.6.2 - -Runtime environment. - -gSOAP XML Web services tools -Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc. All Rights Reserved. - -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - vxWorks compatible - - Support for IPv6. - --------------------------------------------------------------------------------- -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-2004 Robert A. 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 --------------------------------------------------------------------------------- - -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 - -*/ - -#include "stdsoap2.h" - -#ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.6.2 2004-06-12 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.6.2 2004-06-12 12:00:00 GMT") -#endif - -/* 8bit character representing unknown/nonrepresentable character data (not supported by current locale) */ -#ifndef SOAP_UNKNOWN_CHAR -#define SOAP_UNKNOWN_CHAR (127) -#endif - -/* EOF=-1 */ -#define LT (wchar)(-2) /* XML character '<' */ -#define TT (wchar)(-3) /* XML character '' */ -#define QT (wchar)(-5) /* XML character '"' */ -#define AP (wchar)(-6) /* XML character ''' */ - -#define soap_blank(c) ((c) >= 0 && (c) <= 32) -#define soap_notblank(c) ((c) > 32) -#define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) - -static int soap_isxdigit(int); -static wchar soap_char(struct soap*); -static wchar soap_getchunkchar(struct soap*); -static void soap_update_ptrs(struct soap*, char*, char*, long); -static int soap_has_copies(struct soap*, char*, char*); -static struct soap_ilist *soap_hlookup(struct soap*, 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*); -static int soap_set_error(struct soap*, const char*, const char*, const char*, int); -static int soap_copy_fault(struct soap*, const char*, const char*, const char*); -static int soap_getattrval(struct soap*, char*, size_t, wchar); -static void soap_set_local_namespaces(struct soap*); -static size_t soap_begin_dime(struct soap*); -static int soap_isnumeric(struct soap*, const char*); -static void *fplugin(struct soap*, const char*); - -#ifndef WITH_LEAN -static time_t soap_timegm(struct tm*); -static void soap_init_logs(struct soap*); -static void soap_close_logfile(struct soap*, int); -static void soap_set_logfile(struct soap*, int, const char*); -#endif - -#ifdef WITH_FAST -/* Use look-aside buffers */ -static int soap_append_lab(struct soap*, const char*, size_t); -#endif - -#ifndef WITH_LEANER -static int soap_putdimefield(struct soap*, const char*, size_t); -static char *soap_getdimefield(struct soap*, size_t); -#endif - -#ifdef WITH_GZIP -static int soap_getgzipheader(struct soap*); -#endif - -#ifdef WITH_OPENSSL -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -/* This callback is included for future references. It should not be deleted -static DH *ssl_tmp_dh(SSL*, int, int); -*/ -#endif - -static const char *soap_strerror(struct soap*); -static const char *tcp_error(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_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*); -static int tcp_connect(struct soap*, const char*, const char*, int); -static int tcp_accept(struct soap*, int, struct sockaddr*, int*); -static int tcp_disconnect(struct soap*); -static int fsend(struct soap*, const char*, size_t); -static size_t frecv(struct soap*, char*, size_t); - -/* WR[ */ -#ifdef VXWORKS -static int vx_nonblocking = TRUE; /* ioctl argument */ -#endif -/* ]WR */ - -#ifndef PALM_2 -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 - -static const char soap_padding[3] = "\0\0"; -#define SOAP_STR_PADDING (soap_padding) -#define SOAP_STR_EOS (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_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 - -#ifndef WITH_LEAN -static const struct soap_code_map h_http_error_codes[] = -{ { 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 - -#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 - -#ifdef WIN32 -static int tcp_done = 0; -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -fsend(struct soap *soap, const char *s, size_t n) -{ register int nwritten; -#if defined(__cplusplus) && !defined(UNDER_CE) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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)soap->socket, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return SOAP_EOF; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else -#endif -#ifndef PALM - nwritten = send((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { -#ifdef WITH_OPENSSL - int err; - if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return SOAP_EOF; -#endif - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EWOULDBLOCK && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - 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 -/* WR[ */ -#ifdef VXWORKS -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - { - httpBlockPut(soap->rpmreqid, s, n); - nwritten = n; - } - else - { - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); - } -#else - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); -#endif /* WMW_RPM_IO */ -#else -/* ]WR */ - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -/* WR[ */ -#endif -/* ]WR */ -#endif -#endif - if (nwritten <= 0) - { if (soap_errno != SOAP_EINTR && soap_errno != SOAP_EWOULDBLOCK && soap_errno != SOAP_EAGAIN) - { soap->errnum = soap_errno; - 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_flush_raw(struct soap *soap, const char *s, size_t n) -{ -#ifndef WITH_LEAN - if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) - { char *t; - if (!(t = (char*)soap_push_block(soap, n))) - return soap->error = SOAP_EOM; - memcpy(t, s, n); - return SOAP_OK; - } - 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; - } -#endif - DBGMSG(SENT, s, n); - return soap->error = soap->fsend(soap, s, n); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_flush(struct soap *soap) -{ if (soap->bufidx) - { -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { soap->d_stream.next_in = (Byte*)soap->buf; - soap->d_stream.avail_in = (unsigned int)soap->bufidx; -#ifdef WITH_GZIP - soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->bufidx); -#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:"")); - 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 - if (soap_flush_raw(soap, soap->buf, soap->bufidx)) - return soap->error; - soap->bufidx = 0; - } - return SOAP_OK; -} -#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; - if (soap->fprepare) - return soap->fprepare(soap, s, n); - 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_send(struct soap *soap, const char *s) -{ if (s) - return soap_send_raw(soap, s, strlen(s)); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static size_t -frecv(struct soap *soap, char *s, size_t n) -{ register int r; - soap->errnum = 0; -#if defined(__cplusplus) && !defined(UNDER_CE) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifndef WITH_LEAN - struct timeval timeout; - fd_set fd; - if (soap->recv_timeout) - { 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)soap->socket, &fd); - for (;;) - { r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r > 0) - break; - if (r == 0) - return 0; - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { int err; - r = SSL_read(soap->ssl, s, n); - if ((err = SSL_get_error(soap->ssl, r)) == SSL_ERROR_NONE) - return (size_t)r; - if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return 0; - } - else -#endif - { r = recv((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); - if (r >= 0) - return (size_t)r; - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#ifndef WITH_LEAN - { struct timeval timeout; - fd_set fd; - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#endif - } - } -#ifdef WITH_FASTCGI - return fread(s, 1, n, stdin); -#else -#ifdef UNDER_CE - return fread(s, 1, n, soap->recvfd); -#else -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - { - r = httpBlockRead(soap->rpmreqid, s, n); - } - else - { - r = read(soap->recvfd, s, n); - } - if (r >= 0) - { - return r; - } - return 0; -#else -/* ]WR */ - r = read((SOAP_SOCKET)soap->recvfd, s, n); - if (r >= 0) - return (size_t)r; - soap->errnum = soap_errno; - return 0; -/* WR[ */ -#endif -/* ]WR */ -#endif -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static 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\n", (unsigned int)soap->buflen)); - DBGMSG(RECV, soap->buf, soap->buflen); - if (soap->buflen) - return soap->buf[soap->bufidx++]; - return EOF; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -soap_isxdigit(int c) -{ switch (c) - { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - return 1; - } - return 0; -} -#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; - 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); - 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 (soap->buflen) - { soap->count += soap->buflen; - 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->d_stream.next_out = Z_NULL; - 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; - } - } -#endif - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ - { -chunk_again: - 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; - } - else - { register wchar c; - char tmp[8], *t; - t = tmp; - if (!soap->chunkbuflen) - { soap->chunkbuflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes\n", (unsigned int)ret)); - DBGMSG(RECV, soap->buf, ret); - soap->bufidx = 0; - if (!ret) - return EOF; - } - else - soap->bufidx = soap->buflen; - soap->buflen = soap->chunkbuflen; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (%u %u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen)); - while (!soap_isxdigit((int)(c = soap_getchunkchar(soap)))) - if ((int)c == EOF) - return 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 EOF; - *t = '\0'; - 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); - return EOF; - } - soap->buflen = soap->bufidx + soap->chunksize; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to %u (%u %s)\n", (unsigned int)soap->buflen, (unsigned int)soap->bufidx, 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 (%lu bytes left)\n", (unsigned long)(soap->buflen - soap->bufidx))); - } - else if (soap->chunkbuflen) - soap->chunksize = 0; - ret = soap->buflen - soap->bufidx; - if (!ret) - goto chunk_again; - } - } - else - { soap->bufidx = 0; - soap->buflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes\n", (unsigned int)ret)); - DBGMSG(RECV, soap->buf, ret); - } -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { 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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - } - else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:"")); - soap->d_stream.next_out = Z_NULL; - 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 -wchar -SOAP_FMAC2 -soap_getchar(struct soap *soap) -{ register wchar c; - if (soap->ahead) - { c = soap->ahead; - 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 *map, const char *str) -{ while (map->string) - { if (!strcmp(str, map->string)) - return map; - map++; - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -long -SOAP_FMAC2 -soap_int_code(const struct soap_code_map *map, const char *str, long other) -{ while (map->string) - { if (!strcmp(str, map->string)) - return map->code; - map++; - } - return other; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_str_code(const struct soap_code_map *map, long code) -{ while (map->code != code && map->string) - map++; - return map->string; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static wchar -soap_char(struct soap *soap) -{ char tmp[8]; - register int i; - register 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 (wchar)soap_int_code(html_entity_codes, tmp, 127); -#else - return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -wchar -SOAP_FMAC2 -soap_get(struct soap *soap) -{ register wchar c; - c = soap->ahead; - if (c) - soap->ahead = 0; - else - c = soap_get1(soap); - for (;;) - { if (soap->cdata) - { if (c == ']') - { c = soap_get1(soap); - if (c == ']') - { soap->cdata = 0; - soap_get1(soap); /* skip > */ - c = soap_get1(soap); - } - else - { soap_revget1(soap); - return ']'; - } - } - else - return c; - } - switch (c) - { case '<': - do c = soap_get1(soap); - while (soap_blank(c)); - if (c == '!' || c == '?' || c == '%') - { 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); - } - } - while ((int)c != EOF && c != '>') - c = soap_get1(soap); - if ((int)c == EOF) - break; - c = soap_get1(soap); - continue; - } - if (c == '/') - return TT; - soap_revget1(soap); - return LT; - case '>': - return GT; - case '"': - return QT; - case '\'': - return AP; - case '&': - return soap_char(soap) | 0x80000000; - } - break; - } - return c; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -wchar -SOAP_FMAC2 -soap_advance(struct soap *soap) -{ register wchar c; - while ((int)((c = soap_get(soap)) != EOF) && c != LT && c != TT) - ; - return c; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -wchar -SOAP_FMAC2 -soap_skip(struct soap *soap) -{ register wchar c; - do c = soap_get(soap); - while (soap_blank(c)); - 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 > 0 && c < 0x80) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - return soap_send(soap, tmp); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -wchar -SOAP_FMAC2 -soap_getutf8(struct soap *soap) -{ register wchar c, c1, c2, c3, c4; - c = soap_get(soap); - if (c < 0x80) - return c; - c1 = soap_get(soap); - if (c1 < 0x80) - { soap_unget(soap, c1); - return c; - } - c1 &= 0x3F; - if (c < 0xE0) - return ((wchar)(c & 0x1F) << 6) | c1; - c2 = (wchar)soap_get1(soap) & 0x3F; - if (c < 0xF0) - return ((wchar)(c & 0x0F) << 12) | (c1 << 6) | c2; - c3 = (wchar)soap_get1(soap) & 0x3F; - if (c < 0xF8) - return ((wchar)(c & 0x07) << 18) | (c1 << 12) | (c2 << 6) | c3; - c4 = (wchar)soap_get1(soap) & 0x3F; - if (c < 0xFC) - return ((wchar)(c & 0x03) << 24) | (c1 << 18) | (c2 << 12) | (c3 << 6) | c4; - return ((wchar)(c & 0x01) << 30) | (c1 << 24) | (c2 << 18) | (c3 << 12) | (c4 << 6) | (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) -{ /* TODO: serialize to DOM (as an option) using new soap_s2hex() */ - char d[2]; - register int i; - 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_FAST - soap->labidx = 0; - for (;;) - { register char *s; - register int 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 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - return NULL; - } - for (i = 0; i < SOAP_BLKLEN; i++) - { register char d1, d2; - register 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, i); - p = (unsigned char*)soap_save_block(soap, NULL); - 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]; -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { soap->dom->data = (char*)soap_malloc(soap, (n + 2) / 3 * 4 + 1); - return soap_s2base64(soap, s, soap->dom->data, n); - } -#endif - if (!s) - return SOAP_OK; - for (; n > 2; n -= 3, s += 3) - { m = ((unsigned long)((unsigned char*)s)[0] << 16) | ((unsigned long)((unsigned char*)s)[1] << 8) | (unsigned long)((unsigned char*)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_FAST - soap->labidx = 0; - for (;;) - { register int i, k; - register char *s; - if (soap_append_lab(soap, NULL, 2)) - return NULL; - s = soap->labbuf + soap->labidx; - k = 3 * ((soap->lablen - soap->labidx) / 3); - soap->labidx = 3 * (soap->lablen / 3); - if (!s) - return NULL; - for (i = 0; i < k; i += 3) - { register unsigned long m = 0; - register int j = 0; - do - { register 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - if (c >= 0) - { while ((int)((c = soap_get(soap)) != EOF) && c != LT && c != TT) - ; - } - soap_unget(soap, c); - return p; - } - c -= '+'; - if (c >= 0 && c <= 79) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - return NULL; - } - for (i = 0; i < SOAP_BLKLEN; i++) - { register unsigned long m = 0; - register int j = 0; - do - { register 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, i); - p = (unsigned char*)soap_save_block(soap, NULL); - if (c >= 0) - { while ((int)((c = soap_get(soap)) != EOF) && c != LT && c != TT) - ; - } - soap_unget(soap, c); - return p; - } - c -= '+'; - if (c >= 0 && c <= 79) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#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 -int -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(sizeof(struct soap_blist)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size)); - if (!(p = (char*)SOAP_MALLOC(n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->ptr = *(char**)p; - SOAP_FREE(p); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -soap_update_ptrs(struct soap *soap, char *start, char *end, long offset) -{ int i; - register struct soap_ilist *ip; - 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) - ip->ptr = (char*)ip->ptr + offset; - 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 + offset; - } - } - for (q = &ip->copy; q; q = (void**)p) - { p = *q; - if (p && (char*)p >= start && (char*)p < end) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copy update id='%s' %p\n", ip->id, p)); - *q = (char*)p + offset; - } - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -soap_has_copies(struct soap *soap, register char *start, register char *end) -{ int i; - register struct soap_ilist *ip; - register char *p; - for (i = 0; i < SOAP_IDHASH; i++) - for (ip = soap->iht[i]; ip; ip = ip->next) - for (p = (char*)ip->copy; p; p = *(char**)p) - if (p >= start && p < end) - return SOAP_ERR; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_resolve(struct soap *soap) -{ register int i; - register struct soap_ilist *ip; - short flag1 = 0, flag2; - for (i = 0; i < SOAP_IDHASH; i++) - for (ip = soap->iht[i]; ip; ip = ip->next) - { if (ip->ptr) - soap_resolve_ptr(ip); - else if (*ip->id == '#') - flag1 = 1; - } - do - { flag2 = 0; - 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->copy && ip->ptr && ip->size) - if (!soap_has_copies(soap, (char*)ip->ptr, (char*)ip->ptr + ip->size)) - { 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); - flag2 = 1; - } - } while (flag2); - for (i = 0; i < SOAP_IDHASH; i++) - for (ip = soap->iht[i]; ip; ip = ip->next) - { register struct soap_flist *fp; - for (fp = ip->flist; fp; fp = fp->next) - if (fp->finsert) - { unsigned int k = fp->level; - void *p = ip->ptr; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolving forwarded container data type=%d location=%p level=%u,%u\n", fp->type, fp->ptr, ip->level, fp->level)); - while (ip->level < k) - { void **q = (void**)soap_malloc(soap, sizeof(void*)); - if (!q) - return SOAP_EOM; - *q = p; - p = (void*)q; - k--; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Descending one level...\n")); - } - fp->finsert(soap, fp->type, fp->ptr, p); - } - } - if (flag1) - return soap->error = SOAP_MISSING_ID; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_resolve_ptr(struct soap_ilist *ip) -{ register void *p, **q, *r; - q = (void**)ip->link; - ip->link = NULL; - r = ip->ptr; - while (q) - { p = *q; - *q = r; - q = (void**)p; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_size_block(struct soap *soap, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(p); - } - soap->blist = bp->next; - SOAP_FREE(bp); - } - 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, char *p) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); - soap_update_ptrs(soap, q, q + n, (long)s - (long)q); /* pointers s and q may or may not be related */ - 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); - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_store_block(struct soap *soap, char *p) -{ p = soap_save_block(soap, p); - if (!soap->blist) - { struct soap_ilist *ip; - int i; - for (i = 0; i < SOAP_IDHASH; i++) - for (ip = soap->iht[i]; ip; ip = ip->next) - if (ip->ptr) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolve link chain to point to %p\n", ip->ptr)); - soap_resolve_ptr(ip); - } - } - 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; - n = 1; - do - { attr1++; - 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; - } - } while (attr1 && *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 = 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; - np = (struct soap_nlist*)SOAP_MALLOC(sizeof(struct soap_nlist) + strlen(id)); - if (!np) - return soap->error = SOAP_EOM; - np->next = soap->nlist; - soap->nlist = np; - strcpy(np->id, id); - np->level = soap->level; - np->index = -1; - np->ns = NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns)); - p = soap->local_namespaces; - if (p) - { register short i = 0; - if (!strcmp(ns, soap_env1)) - soap->version = 1; /* make sure we use SOAP 1.1 */ - else if (!strcmp(ns, soap_env2)) - soap->version = 2; /* make sure we use SOAP 1.2 */ - else - { for (; p->id; p++, i++) - { if (p->ns) - if (!strcmp(ns, p->ns)) - break; - if (p->in) - if (!soap_tag_cmp(ns, p->in)) - { if (p->out) - SOAP_FREE(p->out); - if ((p->out = (char*)SOAP_MALLOC(strlen(ns) + 1))) - strcpy(p->out, ns); - break; - } - } - } - if (i == 0 && (!p->ns || strcmp(ns, p->ns))) - { if (p[0].out) - SOAP_FREE(p[0].out); - if ((p[0].out = (char*)SOAP_MALLOC(strlen(ns) + 1))) - strcpy(p[0].out, ns); - if (p[1].out) - SOAP_FREE(p[1].out); - if (soap->version == 1) - { if ((p[1].out = (char*)SOAP_MALLOC(sizeof(soap_enc1)))) - strcpy(p[1].out, soap_enc1); - } - else if ((p[1].out = (char*)SOAP_MALLOC(sizeof(soap_enc2)))) - strcpy(p[1].out, soap_enc2); - } - if (p && p->id) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push OK ('%s' matches '%s' in namespace table)\n", id, p->id)); - np->index = i; - } - } - if (!p || !p->id) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); - np->ns = (char*)SOAP_MALLOC(strlen(ns) + 1); - if (!np->ns) - return soap->error = SOAP_EOM; - strcpy(np->ns, ns); - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_push_default_namespace(struct soap *soap, const char *id, int n) -{ register struct soap_nlist *np = soap->nlist; - while (np && np->index >= -1) - np = np->next; - if (np && (!strncmp(np->id, id, n) && !np->id[n])) - return SOAP_OK; - np = (struct soap_nlist*)SOAP_MALLOC(sizeof(struct soap_nlist) + n); - if (!np) - return soap->error = SOAP_EOM; - np->next = soap->nlist; - soap->nlist = np; - strncpy(np->id, id, n); - np->id[n] = '\0'; - np->level = soap->level; - np->index = -2; - np->ns = NULL; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_namespace(struct soap *soap) -{ register struct soap_nlist *np; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - if (soap->nlist->ns) - SOAP_FREE(soap->nlist->ns); - SOAP_FREE(soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int n2) -{ register struct soap_nlist *np = soap->nlist; - while (np && (np->index == -2 || (strncmp(np->id, id1, n1) || np->id[n1]))) - np = np->next; - if (np) - { if (np->index < 0 || (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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - return SOAP_OK; - return SOAP_SYNTAX_ERROR; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_default_namespace(struct soap *soap) -{ register struct soap_nlist *np = soap->nlist; - while (np && np->index >= -1) - np = np->next; - if (np) - return np->id; - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_tag_cmp(register const char *s, register const char *t) -{ for (; *s && *s != '"'; s++, t++) - if (tolower(*s) != tolower(*t)) - if (*t != '-') - { if (*t != '*') - return 1; - if (*++t) - { register int c = tolower(*t); - for (; *s && *s != '"'; s++) - { if (tolower(*s) == c) - if (!soap_tag_cmp(s + 1, t + 1)) - return 0; - } - break; - } - else - return 0; - } - 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; - if (!tag1 || !tag2 || !*tag2) - return SOAP_OK; - s = strchr(tag1, ':'); - t = strchr(tag2, ':'); - if (t) - { if (s) - { if (SOAP_STRCMP(s + 1, t + 1)) - return SOAP_TAG_MISMATCH; - if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - } - else if (SOAP_STRCMP(tag1, t + 1)) - return SOAP_TAG_MISMATCH; - else if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Tags and (default) namespaces match: '%s' '%s'\n", tag1, tag2)); - return SOAP_OK; - } - if (s) - { if (((soap->mode & SOAP_XML_STRICT) && soap->part != SOAP_IN_HEADER && soap->encodingStyle)) - return SOAP_TAG_MISMATCH; - if (SOAP_STRCMP(s + 1, tag2)) - return SOAP_TAG_MISMATCH; - if (!soap->encodingStyle) - { t = soap_default_namespace(soap); - if (!t || soap_match_namespace(soap, tag1, t, s - tag1, strlen(t))) - 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 - -/******************************************************************************/ - -#ifdef WITH_OPENSSL -/******************************************************************************/ -#ifndef PALM_1 -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; - if (dhfile) - { soap->dhfile = dhfile; - soap->rsa = 0; - } - else - { soap->dhfile = NULL; - soap->rsa = 1; - } - soap->randfile = randfile; - soap->require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION); - if (!(err = soap->fsslauth(soap))) - if (sid) - SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, strlen(sid)); - return err; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -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->rsa = 0; - soap->randfile = randfile; - soap->require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION); - return soap->fsslauth(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -ssl_init() -{ static int done = 0; - if (!done) - { done = 1; - SSL_library_init(); -#ifndef WITH_LEAN - SSL_load_error_strings(); -#endif - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static const char * -ssl_error(struct soap *soap, int ret) -{ int err = SSL_get_error(soap->ssl, ret); - const char *msg = soap_str_code(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 strlen(strcpy(buf, (char*)userdata)); -} -#endif - -/******************************************************************************/ -/* This callback is included for future references. It should not be deleted -#ifndef PALM_1 -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) -{ ssl_init(); - 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); - 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); - } - else if (!RAND_load_file("/dev/urandom", 1024)) - { int r; -#ifdef HAVE_RAND_R - unsigned int s = (unsigned int)time(NULL); -#endif - RAND_seed(soap->buf, sizeof(soap->buf)); - while (!RAND_status()) - { -#ifdef HAVE_RAND_R - r = rand_r(&s); -#else - r = rand(); -#endif - RAND_seed(&r, sizeof(int)); - } - } - 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/or directory", SOAP_SSL_ERROR); - 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); - 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); - } - } - if (soap->rsa) - { RSA *rsa = RSA_generate_key(512, 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); - } - SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); - SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, soap->fsslverify); -#if (OPENSSL_VERSION_NUMBER < 0x00905100L) - SSL_CTX_set_verify_depth(soap->ctx, 1); -#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 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 - return ok; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ int i, r; - 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->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; -#ifdef WIN32 - u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - soap->bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, soap->bio, soap->bio); - i = 100; - while ((r = SSL_accept(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - if (i-- <= 0) - break; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - else - { soap->errnum = err; - break; - } - } -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - if (r <= 0) - { soap_set_receiver_error(soap, ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); - soap_closesock(soap); - return SOAP_SSL_ERROR; - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#endif /* WITH_OPENSSL */ - -/******************************************************************************/ -#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 -#ifdef PALM - errno = 0; - h_errno = 0; - AppNetRefnum = 0; - NetUInit(); - AppNetTimeout = 10000; - NetLibOpen(AppNetRefnum, &h_errno); -#endif - return 0; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_done(struct soap *soap) -{ -#ifndef WITH_LEAN - int i; -#endif - soap_free(soap); - while (soap->clist) - { struct soap_clist *p = soap->clist->next; - SOAP_FREE(soap->clist); - soap->clist = p; - } - 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->copy) - soap->plugins->fdelete(soap, soap->plugins); - SOAP_FREE(soap->plugins); - soap->plugins = p; - } - soap->fplugin = fplugin; - soap->fpost = http_post; - soap->fget = http_get; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#ifndef MAC_CARBON - soap->faccept = tcp_accept; - soap->fopen = tcp_connect; - soap->fclose = tcp_disconnect; - soap->fsend = fsend; - soap->frecv = frecv; -#endif - soap->fprepare = NULL; - soap->fignore = NULL; -#ifdef WITH_OPENSSL - if (soap->session) - { SSL_SESSION_free(soap->session); - soap->session = NULL; - } -#endif - if (!soap->copy) - { if (soap_valid_socket(soap->master)) - { closesocket((SOAP_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = NULL; - } -#endif - } -#ifndef WITH_LEAN - for (i = 0; i < SOAP_MAXLOGS; i++) - { soap_close_logfile(soap, i); - if (soap->logfile[i]) - { SOAP_FREE((void*)soap->logfile[i]); - soap->logfile[i] = NULL; - } - } -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -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 - -/******************************************************************************/ -#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_str_code(h_error_codes, soap->errnum); - if (!msg) -#endif - { sprintf(soap->msgbuf, "TCP error %d", soap->errnum); - msg = soap->msgbuf; - } - } - } - return msg; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static const char* -http_error(struct soap *soap, int status) -{ register const char *msg = NULL; -#ifndef WITH_LEAN - msg = soap_str_code(h_http_error_codes, status); - if (!msg) -#endif - { sprintf(soap->msgbuf, "HTTP error %d", status); - msg = soap->msgbuf; - } - return msg; -} -#endif - -/******************************************************************************/ -/* WR[ */ -#ifndef WITH_IPV6 -/* ]WR */ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -soap_gethost(struct soap *soap, const char *addr, struct in_addr *inaddr) -{ unsigned long iadd; - struct hostent hostent, *host = &hostent; -/* WR[ */ -#ifdef VXWORKS - int hostint; - char * addrcopy = (char*)malloc(strlen(addr) + 1); /*copy of addr. */ - /* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */ - strncpy(addrcopy, addr, strlen(addr)+1); - iadd = inet_addr(addrcopy); -#else -/* ]WR */ -#if defined(_AIXVERSION_431) || defined(TRU64) - struct hostent_data ht_data; -#endif - iadd = inet_addr(addr); -/* WR[ */ -#endif -/* ]WR */ - if ((int)iadd != -1) - { memcpy(inaddr, &iadd, sizeof(iadd)); -/* WR[ */ -#ifdef VXWORKS - free(addrcopy); -#endif -/* ]WR */ - return 0; - } -#if defined(__GLIBC__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - memset(&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); -/* WR[ */ -#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(addrcopy); - if (hostint == ERROR) - { - host = NULL; - soap->errnum = soap_errno; - } - free(addrcopy); /*free() is placed after the error checking to assure that - * errno captured is that from hostGetByName() */ -/* ]WR */ -#else - if (!(host = gethostbyname(addr))) - soap->errnum = h_errno; -#endif - if (!host) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Host name not found\n")); - return -1; - } -/* WR[ */ -#ifdef VXWORKS - inaddr->s_addr = hostint; -#else -/* ]WR */ - memcpy(inaddr, host->h_addr, host->h_length); -/* WR[ */ -#endif -/* ]WR */ - return 0; -} -#endif -#endif -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ struct sockaddr_in sockaddr; -/* WR[ */ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo resaddr; - struct sockaddr_storage addrstorage; - int err; -#endif /* WITH_IPV6 */ -/* ]WR */ - register int fd; -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->socket)) - closesocket((SOAP_SOCKET)soap->socket); - soap->socket = SOAP_INVALID_SOCKET; - if (tcp_init(soap)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP initialization failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } - soap->errmode = 0; -/* WR[ */ -#ifdef WITH_IPV6 - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - soap->errmode = 2; - if (soap->proxy_host) - err = getaddrinfo(soap->proxy_host, soap_int2s(soap, soap->proxy_port), &hints, &addrinfo); - else - err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); - if (addrinfo) - { resaddr = *addrinfo; - addrstorage = *((struct sockaddr_storage *) addrinfo->ai_addr); - resaddr.ai_addr = (struct sockaddr *) &addrstorage; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_sender_error(soap, gai_strerror(err), - "TCP getaddrinfo on proxy host failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } - fd = (int)socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol); /* modified to use fd */ - soap->errmode = 0; -#else /* WITH_IPV6 */ -/* ]WR */ - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - if (fd < 0) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP socket failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } -#ifndef WITH_LEAN - if (soap->connect_flags & SO_LINGER) - { struct linger linger; - memset(&linger, 0, sizeof(struct linger)); - linger.l_onoff = 1; - linger.l_linger = 0; - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - } - if ((soap->connect_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } -#endif -#endif -/* WR[ */ -#ifndef WITH_IPV6 -/* ]WR */ - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Open socket %d to host='%s'\n", fd, host)); - soap->errmode = 2; - if (soap->proxy_host) - { if (soap_gethost(soap, soap->proxy_host, &sockaddr.sin_addr)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - sockaddr.sin_port = htons((short)soap->proxy_port); - } - else - { if (soap_gethost(soap, host, &sockaddr.sin_addr)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP get host by name failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - sockaddr.sin_port = htons((short)port); - } - soap->errmode = 0; -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { - vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -/* WR[ */ -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, resaddr.ai_addr, resaddr.ai_addrlen)) /* modified to use fd */ -#else /* WITH_IPV6 */ - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr))) -#endif /* WITH_IPV6 */ -/* ]WR */ - { -#ifndef WITH_LEAN - if (soap->connect_timeout && (soap_socket_errno == SOAP_EINPROGRESS || soap_socket_errno == SOAP_EWOULDBLOCK)) - { struct timeval timeout; -#if defined(SOCKLEN_T) - SOCKLEN_T n = sizeof(struct sockaddr_in); -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) - socklen_t n = sizeof(struct sockaddr_in); -#elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) - int n = sizeof(struct sockaddr_in); -#else - size_t n = sizeof(struct sockaddr_in); -#endif - fd_set fds; - 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((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(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", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - } - n = sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &n) && !soap->errnum) - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - else -#endif - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - closesocket((SOAP_SOCKET)fd); - return -1; - } - } - else - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - soap->socket = fd; -#ifdef WITH_OPENSSL - soap->imode &= ~SOAP_ENC_SSL; - soap->omode &= ~SOAP_ENC_SSL; - if (!strncmp(endpoint, "https:", 6)) - { int r; - if (soap->proxy_host) - { unsigned int k = soap->omode; /* make sure we only parse HTTP */ - size_t n = soap->count; /* save the content length */ - soap->omode &= ~0xFF; /* mask IO and ENC */ - soap->omode |= SOAP_IO_BUFFER; - soap_begin_send(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to proxy server\n")); - sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return -1; -#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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - return soap->error; - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - return -1; - soap->omode = k; - k = soap->imode; - soap->imode &= ~0xFF; /* mask IO and ENC */ - if (soap_begin_recv(soap)) - return -1; - soap->imode = k; - soap->count = n; - soap_begin_send(soap); - } - 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); - return -1; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->error = SOAP_SSL_ERROR; - return -1; - } - 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; - soap->bio = BIO_new_socket((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, soap->bio, soap->bio); -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - { soap_set_sender_error(soap, ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); - return -1; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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((SOAP_SOCKET)(soap->socket), &fds); - for (;;) - { int r = select((SOAP_SOCKET)(soap->socket + 1), &fds, NULL, &fds, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); - soap_set_sender_error(soap, "Timeout", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } - } - continue; - } - } - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if (soap->require_server_auth) - { X509 *peer; - 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 cannot be verified in tcp_connect()", SOAP_SSL_ERROR); - return -1; - } - 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); - return -1; - } - X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); - X509_free(peer); - if (soap_tag_cmp(soap->msgbuf, host)) - { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); - return -1; - } - } - } -#endif - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_bind(struct soap *soap, const char *host, int port, int backlog) -{ struct sockaddr_in sockaddr; -/* WR[ */ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo resaddr; - struct sockaddr_storage addrstorage; - int err; -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { closesocket((SOAP_SOCKET)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 -1; - } -/* WR[ */ -#ifdef WITH_IPV6 - memset(&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; - soap->errmode = 2; - if (host) - err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); - else - err = getaddrinfo(NULL, soap_int2s(soap, port), &hints, &addrinfo); - if (NULL != addrinfo) - { - resaddr = *addrinfo; - addrstorage = *((struct sockaddr_storage *) addrinfo->ai_addr); - resaddr.ai_addr = (struct sockaddr *) &addrstorage; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "TCP getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - soap->errmode = 0; - if ((soap->master = socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol)) < 0) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#else /* WITH_IPV6 */ -/* ]WR */ - soap->errmode = 0; - if ((soap->master = (int)socket(AF_INET, SOCK_STREAM, 0)) < 0) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - if (soap->bind_flags && setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#endif -#endif -/* WR[ */ -#ifdef WITH_IPV6 - soap->errmode = 0; - if (bind(soap->master, resaddr.ai_addr, resaddr.ai_addrlen) || listen(soap->master, backlog)) - { - soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); - soap_closesock(soap); - soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#else /* WITH_IPV6 */ -/* ]WR */ - memset(&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - soap->errmode = 2; - if (host) - { if (soap_gethost(soap, host, &sockaddr.sin_addr)) - { soap_set_receiver_error(soap, tcp_error(soap), "TCP get host by name failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - } - else - sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); - sockaddr.sin_port = htons((short)port); - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) || listen((SOAP_SOCKET)soap->master, backlog)) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); - soap_closesock(soap); - soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifdef WITH_OPENSSL - if (!soap->ctx && (soap->error = soap->fsslauth(soap))) - return -1; -#endif - return soap->master; -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_poll(struct soap *soap) -{ -#ifndef WITH_LEAN - struct timeval timeout; - fd_set sfd,rfd; - int r; - timeout.tv_sec = 0; - timeout.tv_usec = 0; - FD_ZERO(&rfd); - FD_ZERO(&sfd); - if (soap->socket >= 0) - { FD_SET(soap->socket, &rfd); - FD_SET(soap->socket, &sfd); - r = select(soap->socket + 1, &rfd, &sfd, NULL, &timeout); - } - else if (soap->master >= 0) - { FD_SET(soap->master, &rfd); - r = select(soap->master + 1, &rfd, &sfd, NULL, &timeout); - } - else - { FD_SET(soap->sendfd, &sfd); - FD_SET(soap->recvfd, &rfd); - r = select((soap->sendfd > soap->recvfd ? soap->sendfd : soap->recvfd) + 1, &rfd, &sfd, NULL, &timeout); - } - if (r > 0) - { -#ifdef WITH_OPENSSL - if (soap->ssl) - { if ((soap->socket >= 0) && FD_ISSET(soap->socket, &rfd)) - { char buf = '\0'; - if (SSL_peek(soap->ssl, &buf, 1) <= 0) - return SOAP_EOF; - } - } -#endif - return SOAP_OK; - } - if (r < 0 && (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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 = soap_errno; - return SOAP_EOF; -#else - return SOAP_OK; -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ -#if defined(SOCKLEN_T) - return (int)accept((SOAP_SOCKET)s, a, (SOCKLEN_T*)n); -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) - return (int)accept((SOAP_SOCKET)s, a, (socklen_t*)n); -#elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) - return (int)accept((SOAP_SOCKET)s, a, n); -#else - return (int)accept((SOAP_SOCKET)s, a, (size_t*)n); -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_accept(struct soap *soap) -{ -/* WR[ */ -#ifdef WITH_IPV6 - struct sockaddr_storage sockaddr; -#else /* WITH_IPV6 */ -/* ]WR */ - struct sockaddr_in sockaddr; -/* WR[ */ -#endif -/* ]WR */ - int n = (int)sizeof(struct sockaddr); -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - memset(&sockaddr, 0, sizeof(sockaddr)); - soap->socket = SOAP_INVALID_SOCKET; - soap->errmode = 0; - if (soap_valid_socket(soap->master)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->accept_timeout) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - soap_closesock(soap); - soap_set_sender_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - } -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if ((soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&sockaddr, &n)) >= 0) - { -/* WR[ */ -#ifdef WITH_IPV6 -/* Use soap->host to store the numeric form of the remote host */ - getnameinfo((struct sockaddr*)&sockaddr, n, soap->host, sizeof(soap->host), NULL, 0, NI_NUMERICHOST | NI_NUMERICSERV); - soap->ip = 0; /* info stored in soap->host */ - soap->port = 0; /* info stored in soap->host */ -#else /* WITH_IPV6 */ -/* ]WR */ - soap->ip = ntohl(sockaddr.sin_addr.s_addr); - soap->port = (int)ntohs(sockaddr.sin_port); -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - soap->keep_alive = ((soap->imode & SOAP_IO_KEEPALIVE) != 0); -#ifndef WITH_LEAN - if (soap->accept_flags & SO_LINGER) - { struct linger linger; - memset(&linger, 0, sizeof(struct linger)); - linger.l_onoff = 1; - linger.l_linger = 0; - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - } - if ((soap->accept_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } -#endif -#endif - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -/* WR[ */ -#elif defined(VXWORKS) - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&vx_nonblocking)); -/* ]WR */ -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - } - return soap->socket; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - } - } - else - { soap_set_receiver_error(soap, tcp_error(soap), "TCP no master socket in soap_accept()", SOAP_TCP_ERROR); - return -1; - } -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#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); - 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 != 1) - { s = ERR_get_error(); - if (s) - { if (soap_valid_socket(soap->socket)) - { shutdown((SOAP_SOCKET)soap->socket, 1); - soap->socket = SOAP_INVALID_SOCKET; - } - r = SSL_shutdown(soap->ssl); - } - } - DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); - SSL_free(soap->ssl); - soap->ssl = NULL; - if (s) - return SOAP_SSL_ERROR; - ERR_remove_state(0); - } -#endif - if (soap_valid_socket(soap->socket)) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Closing socket %d\n", soap->socket)); - shutdown((SOAP_SOCKET)soap->socket, 2); - closesocket((SOAP_SOCKET)soap->socket); - soap->socket = SOAP_INVALID_SOCKET; - } - return SOAP_OK; -} -#endif -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_closesock(struct soap *soap) -{ register int status = soap->error; -#ifndef MAC_CARBON - if (status == SOAP_EOF || !soap->keep_alive) - { if ((soap->error = soap->fclose(soap))) - return soap->error; - soap->socket = SOAP_INVALID_SOCKET; - } -#endif -#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 PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_hash(register const char *s) -{ register int h = 0; - while (*s) - h += *s++ & 0x1F; - return h % SOAP_IDHASH; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -soap_init_pht(struct soap *soap) -{ register int i; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing pointer hashtable\n")); - for (i = 0; i < SOAP_PTRHASH; i++) - soap->pht[i] = NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new() -{ struct soap *soap = (struct soap*)SOAP_MALLOC(sizeof(struct soap)); - if (soap) - soap_init(soap); - return soap; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new1(int mode) -{ return soap_new2(mode, mode); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new2(int imode, int omode) -{ struct soap *soap = (struct soap*)SOAP_MALLOC(sizeof(struct soap)); - if (soap) - soap_init2(soap, imode, omode); - return soap; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static void -soap_free_pht(struct soap *soap) -{ register struct soap_plist *pp, *next; - register int i; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free pointer hashtable\n")); - for (i = 0; i < SOAP_PTRHASH; i++) - { for (pp = soap->pht[i]; pp; pp = next) - { next = pp->next; - SOAP_FREE(pp); - } - soap->pht[i] = NULL; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_embed_element(struct soap *soap, const void *p, const char *tag, int type) -{ register int i; - struct soap_plist *pp; - if (soap->version != 1) - soap->encoding = 1; - if ((i = soap_pointer_lookup(soap, p, type, &pp))) - { if (soap_is_embedded(soap, pp) || soap_is_single(soap, pp)) - return 0; - soap_set_embedded(soap, pp); - } - return i; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_embed_array(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 ((i = soap_array_pointer_lookup(soap, p, a, n, type, &pp))) - { if (soap_is_embedded(soap, pp) || soap_is_single(soap, pp)) - return 0; - soap_set_embedded(soap, pp); - } - return i; -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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) -{ 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 && pp->array->__size == 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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_pointer_enter(struct soap *soap, const void *p, int type, struct soap_plist **ppp) -{ register struct soap_plist *pp; - if (!p) - { *ppp = NULL; - return 0; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Enter location=%p type=%d id=%lu\n", p, type, soap->idnum+1)); - *ppp = pp = (struct soap_plist*)SOAP_MALLOC(sizeof(struct soap_plist)); - if (pp) - { register int h = soap_hash_ptr(p); - pp->next = soap->pht[h]; - pp->type = type; - if ((soap->mode & SOAP_XML_TREE) || soap->part == SOAP_IN_HEADER) - { pp->mark1 = 0; - pp->mark2 = 0; - } - else - { pp->mark1 = 1; - pp->mark2 = 1; - } - pp->ptr = p; - pp->array = NULL; - soap->pht[h] = pp; - return pp->id = ++soap->idnum; - } - return 0; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_array_pointer_enter(struct soap *soap, const void *p, const struct soap_array *a, int type, struct soap_plist **ppp) -{ struct soap_plist *pp; - *ppp = NULL; - if (!p || !a->__ptr) - return 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array enter location=%p size=%d type=%d id=%lu\n", a->__ptr, a->__size, type, soap->idnum+1)); - *ppp = pp = (struct soap_plist*)SOAP_MALLOC(sizeof(struct soap_plist)); - if (pp) - { register int h = soap_hash_ptr(a->__ptr); - pp->next = soap->pht[h]; - pp->type = type; - if ((soap->mode & SOAP_XML_TREE) || soap->part == SOAP_IN_HEADER) - { pp->mark1 = 0; - pp->mark2 = 0; - } - else - { pp->mark1 = 1; - pp->mark2 = 1; - } - pp->ptr = p; - pp->array = a; - soap->pht[h] = pp; - return pp->id = ++soap->idnum; - } - return 0; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_begin_count(struct soap *soap) -{ soap_clr_attr(soap); - soap_set_local_namespaces(soap); - if (soap->mode & SOAP_ENC_DIME) - soap->mode = soap->omode | SOAP_IO_LENGTH | SOAP_ENC_DIME; - else - { soap->mode = soap->omode; - if (((soap->mode & (SOAP_IO_STORE | SOAP_IO_CHUNK)) || (soap->mode & SOAP_ENC_XML)) && !soap->fprepare) - soap->mode &= ~SOAP_IO_LENGTH; - else - soap->mode |= SOAP_IO_LENGTH; - } - 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; - } - 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->dime_count = 0; /* count # of attachments */ - soap->dime_size = 0; /* accumulate total size of attachments */ - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=%hd count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_begin_send(struct soap *soap) -{ soap_clr_attr(soap); - soap_set_local_namespaces(soap); - soap->mode = (soap->omode & ~SOAP_IO_LENGTH) | (soap->mode & SOAP_ENC_DIME); - 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; - } - if ((soap->mode & SOAP_IO) == SOAP_IO_FLUSH && soap_valid_socket(soap->socket)) - { if (soap->count || (soap->mode & SOAP_ENC_XML)) - soap->mode |= SOAP_IO_BUFFER; - else - soap->mode |= SOAP_IO_STORE; - } - if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) - soap_new_block(soap); - if (!(soap->mode & SOAP_IO_KEEPALIVE)) - soap->keep_alive = 0; -#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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)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->part = SOAP_BEGIN; - soap->idnum = 0; - soap->level = 0; -#ifdef WITH_ZLIB - soap->z_ratio_out = 1.0; - if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=%hd count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_embedded(struct soap *soap, const void *p, int t) -{ struct soap_plist *pp; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded %p type=%d\n", p, t)); - if (soap_pointer_lookup(soap, p, t, &pp)) - { pp->mark1 = 1; - pp->mark2 = 1; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded %p type=%d set to %d\n", p, t, (int)pp->mark1)); - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_reference(struct soap *soap, const void *p, int t) -{ register int i; - struct soap_plist *pp; - if (!p) - return 1; - i = soap_pointer_lookup(soap, p, t, &pp); - if (i) - { if (pp->mark1 == 0) - { pp->mark1 = 2; - pp->mark2 = 2; - } - } - else - { soap_pointer_enter(soap, p, t, &pp); - pp->mark1 = 0; - pp->mark2 = 0; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Reference %p type = %d (%d %d)\n", p, t, (int)pp->mark1, (int)pp->mark2)); - return pp->mark1; -} -#endif - -/******************************************************************************/ -#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) - 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_array_pointer_enter(soap, p, a, t, &pp)) - return 1; - pp->mark1 = 0; - pp->mark2 = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Array reference %p ptr=%p size=%d type = %d (%d %d)\n", p, a->__ptr, n, t, (int)pp->mark1, (int)pp->mark2)); - return pp->mark1; -} -#endif - -/******************************************************************************/ -#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; - 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_TREE | SOAP_XML_GRAPH)) && soap->part != SOAP_IN_HEADER) - { if (id < 0) - { id = soap_pointer_lookup(soap, p, t, &pp); - if (id > 0 && pp) - { if (soap->mode & SOAP_IO_LENGTH) - pp->mark1 = 2; - else - pp->mark2 = 2; - } - return -1; - } - return id; - } - if (id < 0) - id = soap_pointer_lookup(soap, p, t, &pp); - else - soap_pointer_lookup(soap, p, t, &pp); - if (id > 0 && pp) - { if (soap->mode & SOAP_IO_LENGTH) - pp->mark1 = 1; - else - pp->mark2 = 1; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id id=%d %p type=%d = (%d %d)\n", id, p, t, (int)pp->mark1, (int)pp->mark2)); - } - return id; -} -#endif - -/******************************************************************************/ -#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_TREE | 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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_is_single(struct soap *soap, struct soap_plist *pp) -{ if ((soap->mode & SOAP_XML_TREE) || 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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_is_multi(struct soap *soap, struct soap_plist *pp) -{ if (soap->mode & SOAP_IO_LENGTH) - return pp->mark1 == 2; - return pp->mark2 == 2; -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef WITH_LEANER -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_set_attached(struct soap *soap, struct soap_plist *pp, const char *id, const char *type, const char *options, size_t size) -{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attached id='%s' type='%s'\n", id?id:"", type?type:"")); - if (soap->mode & SOAP_IO_LENGTH) - { if (pp->mark1 != 3) - { pp->mark1 = 3; - soap->dime_count++; /* one more attachment found */ - soap->dime_size += 12; /* increase total size (DIME fields) */ - if (id) - soap->dime_size += (strlen(id)+3)&(~3); - if (type) - soap->dime_size += (strlen(type)+3)&(~3); - if (options) - soap->dime_size += 4 + (((((unsigned char)options[2] << 8 | (unsigned char)options[3]))+3)&(~3)); - soap->dime_size += (size+3)&(~3); - } - } - else if (pp->mark2 != 3) - pp->mark2 = 3; -} -#endif -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef PALM_2 -static void -soap_free_iht(struct soap *soap) -{ register int i; - register struct soap_ilist *ip, *p; - register struct soap_flist *fp, *q; - 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 = q) - { q = fp->next; - SOAP_FREE(fp); - } - p = ip->next; - SOAP_FREE(ip); - } - soap->iht[i] = NULL; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static struct soap_ilist * -soap_hlookup(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - for (ip = soap->iht[soap_hash(id)]; ip; ip = ip->next) - if (!strcmp(ip->id, id)) - return ip; - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_ilist * -SOAP_FMAC2 -soap_lookup(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - ip = soap_hlookup(soap, id); -#ifndef WITH_LEANER - if (!ip && *id != '#' && !strchr(id, ':')) /* try content id "cid:" with DIME attachments */ - { char cid[SOAP_TAGLEN]; - strcpy(cid, "cid:"); - strncat(cid + 4, id, sizeof(cid) - 5); - cid[sizeof(cid) - 1] = '\0'; - ip = soap_hlookup(soap, cid); - } -#endif - return ip; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_ilist * -SOAP_FMAC2 -soap_enter(struct soap *soap, const char *id) -{ register int h; - register struct soap_ilist *ip; - ip = (struct soap_ilist*)SOAP_MALLOC(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; - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_malloc(struct soap *soap, size_t n) -{ register char *p; - if (!n) - return NULL; - if (!soap) - return SOAP_MALLOC(n); - n += (-(long)n) & 7; - if (!(p = (char*)SOAP_MALLOC(n + sizeof(void*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - /* keep chain of alloced cells for later destruction */ - soap->alloced = 1; - *(void**)(p + n) = soap->alist; - *(size_t*)(p + n + sizeof(void*)) = n; - soap->alist = p + n; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Malloc %u bytes at location %p\n", (unsigned int)n, p)); - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_dealloc(struct soap *soap, void *p) -{ if (!soap) - return; - if (p) - { register char **q; - 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, "Freed data at %p\n", p)); - SOAP_FREE(p); - return; - } - } - soap_delete(soap, p); - } - else - { register char *q; - while (soap->alist) - { q = (char*)soap->alist; - soap->alist = *(void**)q; - q -= *(size_t*)(q + sizeof(void*)); - if (q == (char*)soap->fault) - soap->fault = NULL; /* this was deallocated */ - else if (q == (char*)soap->header) - soap->header = NULL; /* this was deallocated */ - SOAP_FREE(q); - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Dealloc all data done\n")); - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_delete(struct soap *soap, void *p) -{ register struct soap_clist **cp = &soap->clist; - if (p) - { while (*cp) - { if (p == (*cp)->ptr) - { register struct soap_clist *q = *cp; - *cp = q->next; - q->fdelete(q); - SOAP_FREE(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->ptr == (void*)soap->fault) - soap->fault = NULL; /* this was deallocated */ - else if (q->ptr == (void*)soap->header) - soap->header = NULL; /* this was deallocated */ - q->fdelete(q); - SOAP_FREE(q); - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_clist * -SOAP_FMAC2 -soap_link(struct soap *soap, void *p, int t, int n, void (*fdelete)(struct soap_clist*)) -{ register struct soap_clist *cp; - if ((cp = (struct soap_clist*)SOAP_MALLOC(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)); - 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(q); - return; - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_lookup_type(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - if (*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 - -/******************************************************************************/ -#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 (*id == '\0') - return p; - soap->alloced = 0; - if (!p) - p = (void**)soap_malloc(soap, sizeof(void*)); - ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ - if (!ip) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding first href='%s' %p (%u bytes)\n", id, 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 (!soap->blist && ip->ptr) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolved href='%s' type='%d' (%u bytes)\n", id, t, (unsigned int)n)); - if (ip->type != t) - { soap->error = SOAP_HREF; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Object mismatch: id's type='%d' href's type='%d'\n", 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*)); - s = *q; - *q = *r; - r = *(void***)q; - 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' (%u bytes)\n", id, (unsigned int)n)); - while (ip->level < k) - { q = (void**)soap_malloc(soap, sizeof(void*)); - *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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_id_forward(struct soap *soap, const char *href, void *p, int t, size_t n) -{ struct soap_ilist *ip; - if (!p || !*href) - return p; - ip = soap_lookup(soap, soap->href); /* lookup pointer to hash table entry for string id */ - if (!ip) - { if (n >= sizeof(void*)) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - ip->type = t; - ip->size = n; - ip->link = NULL; - ip->copy = p; - ip->flist = NULL; - *(void**)p = NULL; - ip->ptr = NULL; - ip->level = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding first copying address %p for type %d href='%s'\n", p, t, href)); - return p; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding problem: copying location %p too small (%u) for href='%s'\n", p, (unsigned int)n, href)); - soap->error = SOAP_HREF; - return NULL; - } - else if (ip->ptr) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying value from location %p to location %p to resolve href='%s'\n", ip->ptr, p, href)); - memcpy(p, ip->ptr, n); - } - else if (n >= sizeof(void*)) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding copying address %p for type %d href='%s' (prev in chain = %p)\n", p, t, href, ip->copy)); - *(void**)p = ip->copy; - ip->copy = p; - return p; - } - else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Forwarding problem: copying location %p too small (%u) for href='%s'\n", p, (unsigned int)n, href)); - soap->error = SOAP_HREF; /* href to object too small to hold pointer */ - return NULL; - } - return ip->ptr; -} -#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, int k) -{ struct soap_ilist *ip; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Enter id='%s' type=%d loc=%p size=%d level=%d\n", id, t, p, (int)n, k)); - soap->alloced = 0; - if (*id == '\0') - { if (!p) - return soap_malloc(soap, n); - else - return p; - } - ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Lookup entry id='%s'\n", id)); - if (!ip) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "New entry id='%s' type=%d size=%u\n", id, t, (unsigned int)n)); - ip->type = t; - ip->size = n; - ip->link = NULL; - ip->copy = NULL; - ip->flist = NULL; - if (!p) - p = soap_malloc(soap, n); - ip->ptr = p; - ip->level = k; - } - else if (ip->ptr) /* storage address was forwarded */ - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Multiply defined id='%s'\n", id)); - if (p) - { soap->error = SOAP_MULTI_ID; - return NULL; - } - } - else - { if (!p) - p = soap_malloc(soap, n); - ip->ptr = p; - if (!soap->blist) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Resolve link chain to point to %p\n", ip->ptr)); - soap_resolve_ptr(ip); - } - } - return ip->ptr; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_end_send(struct soap *soap) -{ 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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", soap->z_crc)); -#endif - } -#endif -#ifndef WITH_LEAN - if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) - { char *p; - 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++; - } - for (p = soap_first_block(soap); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } - 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_OPENSSL - if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive) - shutdown((SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ -#else - if (soap_valid_socket(soap->socket) && !soap->keep_alive) - shutdown((SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send message ok\n")); - soap->part = SOAP_END; - soap->count = 0; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_end_recv(struct soap *soap) -{ soap->part = SOAP_END; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(soap)) == EOF) - return soap->error = SOAP_EOF; - soap->z_buf[i] = (char)c; - } - if (soap->z_crc != ((unsigned char)soap->z_buf[0] | (unsigned long)((unsigned char)soap->z_buf[1] << 8) | (unsigned long)((unsigned char)soap->z_buf[2] << 16) | (unsigned long)((unsigned char)soap->z_buf[3] << 24))) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: crc check failed, message corrupted? (crc32=%lu)\n", soap->z_crc)); - return soap->error = SOAP_ZLIB_ERROR; - } - if (soap->d_stream.total_out != ((unsigned char)soap->z_buf[4] | (unsigned long)((unsigned char)soap->z_buf[5] << 8) | (unsigned long)((unsigned char)soap->z_buf[6] << 16) | (unsigned long)((unsigned char)soap->z_buf[7] << 24))) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Gzip error: incorrect message length\n")); - return soap->error = SOAP_ZLIB_ERROR; - } - } -#endif - } -#endif - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) - while ((int)soap_getchar(soap) != EOF) /* advance to last chunk */ - ; - if (soap->fdisconnect) - if ((soap->error = soap->fdisconnect(soap))) - return soap->error; - return soap_resolve(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free(struct soap *soap) -{ register struct soap_nlist *np; - register struct soap_attribute *tp; - register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { np = soap->nlist->next; - if (soap->nlist->ns) - SOAP_FREE(soap->nlist->ns); - SOAP_FREE(soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attributes\n")); - while (soap->attributes) - { tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap->attributes->value); - SOAP_FREE(soap->attributes); - soap->attributes = tp; - } - if (soap->labbuf) - SOAP_FREE(soap->labbuf); - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; - soap_free_pht(soap); - soap_free_iht(soap); - ns = soap->local_namespaces; - if (ns) - { for (; ns->id; ns++) - { if (ns->out) - { SOAP_FREE(ns->out); - if (soap->encodingStyle == ns->out) - soap->encodingStyle = SOAP_STR_EOS; - ns->out = NULL; - } - if (soap->encodingStyle == ns->ns) - soap->encodingStyle = SOAP_STR_EOS; - } - SOAP_FREE(soap->local_namespaces); - soap->local_namespaces = NULL; - } -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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; - } -#ifdef SOAP_DEBUG - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, "TEST.log"); -#endif -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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 - -/******************************************************************************/ -#ifndef WITH_LEAN -static void -soap_close_logfile(struct soap *soap, int i) -{ if (soap->fdebug[i]) - { fclose(soap->fdebug[i]); - soap->fdebug[i] = NULL; - } -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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 - -/******************************************************************************/ -#ifndef WITH_LEAN -static void -soap_set_logfile(struct soap *soap, int i, const char *logfile) -{ char *s = NULL; - soap_close_logfile(soap, i); - if (soap->logfile[i]) - SOAP_FREE((void*)soap->logfile[i]); - if (logfile) - if ((s = (char*)SOAP_MALLOC(strlen(logfile) + 1))) - strcpy(s, logfile); - soap->logfile[i] = s; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_set_recv_logfile(struct soap *soap, const char *logfile) -{ soap_set_logfile(soap, SOAP_INDEX_RECV, logfile); -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_set_sent_logfile(struct soap *soap, const char *logfile) -{ soap_set_logfile(soap, SOAP_INDEX_SENT, logfile); -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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(struct soap *soap) -{ return soap_copy_context((struct soap*)SOAP_MALLOC(sizeof(struct soap)), soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_copy_context(struct soap *copy, struct soap *soap) -{ if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - copy->copy = 1; - copy->user = NULL; - copy->userid = NULL; - copy->passwd = NULL; - copy->nlist = NULL; - copy->blist = NULL; - copy->clist = NULL; - copy->alist = NULL; - copy->attributes = NULL; - copy->local_namespaces = NULL; - soap_set_local_namespaces(copy); - soap_init_iht(copy); - soap_init_pht(copy); - copy->header = NULL; - copy->fault = NULL; - copy->action = NULL; - *copy->host = '\0'; -#ifndef WITH_LEAN -#ifdef WITH_COOKIES - copy->cookies = soap_copy_cookies(soap); -#else - copy->cookies = NULL; -#endif - soap_init_logs(copy); -#endif - copy->plugins = NULL; - for (p = soap->plugins; p; p = p->next) - { register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC(sizeof(struct soap_plugin)); - if (!q) - return NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying plugin '%s'\n", p->id)); - *q = *p; - if (p->fcopy && (soap->error = p->fcopy(soap, q, p))) - { SOAP_FREE(q); - return NULL; - } - q->next = copy->plugins; - copy->plugins = q; - } - } - else - soap->error = SOAP_EOM; - return copy; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init(struct soap *soap) -{ soap->version = 1; /* default SOAP 1.1 */ - soap_imode(soap, SOAP_IO_DEFAULT); - soap_omode(soap, SOAP_IO_DEFAULT); - soap->copy = 0; - soap->plugins = NULL; - soap->user = NULL; - soap->userid = NULL; - soap->passwd = NULL; - soap->fpost = http_post; - soap->fget = http_get; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; - soap->fconnect = NULL; - soap->fdisconnect = NULL; -#ifndef MAC_CARBON - soap->faccept = tcp_accept; - soap->fopen = tcp_connect; - soap->fclose = tcp_disconnect; - soap->fsend = fsend; - soap->frecv = frecv; -#endif - soap->fprepare = NULL; - soap->fignore = NULL; - soap->fplugin = fplugin; - soap->fdimereadopen = NULL; - soap->fdimewriteopen = NULL; - soap->fdimereadclose = NULL; - soap->fdimewriteclose = NULL; - soap->fdimeread = NULL; - soap->fdimewrite = NULL; - soap->float_format = "%.8g"; /* .8 preserves single FP precision as much as possible, but might not be very efficient */ - soap->double_format = "%.17lg"; /* .17 preserves double FP precision as much as possible, but might not be very efficient */ - soap->dime_id_format = "cid:id%d"; /* default DIME id format */ - soap->http_version = "1.1"; - soap->encodingStyle = SOAP_STR_EOS; - soap->actor = NULL; - soap->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->ip = 0; - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; -#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; - soap->dom = NULL; -#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; -#ifdef WITH_OPENSSL - soap->fsslauth = ssl_auth_init; - soap->fsslverify = ssl_verify_callback; - soap->bio = NULL; - soap->ssl = NULL; - soap->ctx = NULL; - soap->require_server_auth = 0; - soap->require_client_auth = 0; - soap->rsa = 0; - soap->keyfile = NULL; - soap->password = NULL; - soap->dhfile = NULL; - soap->cafile = NULL; - soap->capath = NULL; - soap->randfile = NULL; - soap->session = NULL; -#endif -#ifdef WITH_ZLIB - soap->zlib_state = SOAP_ZLIB_NONE; - soap->zlib_in = SOAP_ZLIB_NONE; - soap->zlib_out = SOAP_ZLIB_NONE; - soap->d_stream.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = NULL; - soap->z_level = 6; -#endif -#ifndef WITH_LEAN - soap->cookies = NULL; - soap->cookie_domain = NULL; - soap->cookie_path = NULL; - soap->cookie_max = 32; - soap_init_logs(soap); -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - soap->rpmreqid = NULL; -#endif /* WMW_RPM_IO */ -/* ]WR */ - soap_init_iht(soap); - soap_init_pht(soap); - soap_begin(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init1(struct soap *soap, int mode) -{ soap_init2(soap, mode, mode); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init2(struct soap *soap, int imode, int 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, "Initializing\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_BEGIN; - 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'; - soap->dime_chunksize = 0; - soap->dime_buflen = 0; - soap->dot_net_bug = 0; - soap_free(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end(struct soap *soap) -{ register struct soap_clist *cp; - soap_free(soap); - soap_dealloc(soap, NULL); - while (soap->clist) - { cp = soap->clist->next; - SOAP_FREE(soap->clist); - soap->clist = cp; - } - soap_closesock(soap); -#ifndef WITH_LEAN - soap_close_logfiles(soap); -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_namespaces(struct soap *soap, struct Namespace *p) -{ struct Namespace *ns = soap->local_namespaces; - struct soap_nlist *np, *nq, *nr; - unsigned int level = soap->level; - soap->namespaces = p; - soap->local_namespaces = NULL; - soap_set_local_namespaces(soap); - /* reverse the 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; - } - } - while (np) - { soap->level = np->level; /* preserve element nesting level */ - if (np->ns) - { if (soap_push_namespace(soap, np->id, np->ns)) - return soap->error; - } - else if (np->index >= 0 && ns) - { if (ns[np->index].out) - { if (soap_push_namespace(soap, np->id, ns[np->index].out)) - return soap->error; - } - else if (soap_push_namespace(soap, np->id, ns[np->index].ns)) - return soap->error; - } - if (np->ns) - SOAP_FREE(np->ns); - nq = np; - np = np->next; - SOAP_FREE(nq); - } - if (ns) - { int i; - for (i = 0; ns[i].id; i++) - { if (ns[i].out) - { SOAP_FREE(ns[i].out); - ns[i].out = NULL; - } - } - SOAP_FREE(ns); - } - soap->level = level; /* restore level */ - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static void -soap_set_local_namespaces(struct soap *soap) -{ if (soap->namespaces && !soap->local_namespaces) - { register struct Namespace *ns; - register size_t n = 1; - for (ns = soap->namespaces; ns->id; ns++) - n++; - if (n > 3) - { n *= sizeof(struct Namespace); - ns = (struct Namespace*)SOAP_MALLOC(n); - if (ns) - { memcpy(ns, soap->namespaces, n); - ns[0].id = "SOAP-ENV"; - ns[1].id = "SOAP-ENC"; - ns[2].id = "xsi"; - if (ns[0].ns) - { if (!strcmp(ns[0].ns, soap_env1)) - soap->version = 1; - else - soap->version = 2; - } - soap->local_namespaces = ns; - } - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element(struct soap *soap, const char *tag, int id, const char *type) -{ struct Namespace *ns = soap->local_namespaces; - register const char *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); -/**/ -#ifdef WITH_DOM - if (soap->mode & SOAP_XML_DOM) - { register struct soap_dom_element *p, *e = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); - e->next = NULL; - e->prnt = soap->dom; - e->nstr = NULL; - e->name = soap_strdup(soap, tag); /* check EOM? */ - e->data = NULL; - e->type = 0; - e->node = NULL; - e->elts = NULL; - e->atts = NULL; - if (soap->dom) - { p = soap->dom->elts; - if (p) - { while (p->next) - p = p->next; - p->next = e; - } - else - soap->dom->elts = e; - } - soap->dom = e; - } - else -#endif -{ - soap->level++; - if (!soap->ns && !(soap->mode & SOAP_XML_CANONICAL)) - if (soap_send(soap, "")) - return soap->error; - if (soap_send_raw(soap, "<", 1)) - return soap->error; - s = tag; - if (ns && soap->part != SOAP_IN_ENVELOPE && (soap->part == SOAP_IN_HEADER || !soap->encodingStyle)) - { register const char *t = strchr(s, ':'); - if (t) - { s = t + 1; - for (ns++; ns->id; ns++) - { if ((ns->out || ns->ns) && !strncmp(ns->id, tag, t - tag) && !ns->id[t - tag]) - { if (soap_send(soap, s) || soap_attribute(soap, "xmlns", ns->out ? ns->out : ns->ns)) - return soap->error; - s = NULL; - break; - } - } - } - } - if (s) - if (soap_send(soap, tag)) - return soap->error; -} -/**/ - if (!soap->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; - } - if (id > 0) - { sprintf(soap->tmpbuf, "_%d", id); - if (soap_attribute(soap, "id", soap->tmpbuf)) - return soap->error; - } - if (type && *type) - { if (soap_attribute(soap, "xsi:type", type)) - return soap->error; - } - if (soap->null && soap->position > 0) - { 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) - { if (!*soap->encodingStyle && soap->local_namespaces) - { 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; - 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) - 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) - 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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_array_begin_out(struct soap *soap, const char *tag, int id, const char *type, const char *offset) -{ 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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } - return soap_element_start_end_out(soap, NULL); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element_start_end_out(struct soap *soap, const char *tag) -{ register struct soap_attribute *tp; -/**/ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - a->next = soap->dom->atts; - a->nstr = NULL; - a->name = soap_strdup(soap, tp->name); /* check EOM */ - a->data = soap_strdup(soap, tp->value); /* check EOM */ - a->wide = NULL; - soap->dom->atts = a; - tp->visible = 0; - } - } - return SOAP_OK; - } -#endif -/**/ - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { if (soap_send_raw(soap, " ", 1) - || 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) - { soap->level--; -#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 - return soap_send_raw(soap, "/>", 2); - } - return soap_send_raw(soap, ">", 1); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -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 -/**/ - if (soap->part != SOAP_IN_ENVELOPE && (soap->part == SOAP_IN_HEADER || !soap->encodingStyle) && soap->local_namespaces) - { const char *s = strchr(tag, ':'); - if (s && strncmp(tag, "SOAP-ENV", s - tag)) - tag = s + 1; - } - soap->level--; - if (soap_send_raw(soap, "", 1)) - return soap->error; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element_ref(struct soap *soap, const char *tag, int id, int href) -{ int n = 0; - if (soap_element(soap, tag, id, NULL)) - return soap->error; - if (soap->version == 2) - n = 1; - sprintf(soap->tmpbuf, "#_%d", href); - if (soap_attribute(soap, "href" + n, soap->tmpbuf + n) - || soap_element_start_end_out(soap, tag)) - return soap->error; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element_href(struct soap *soap, const char *tag, int id, const char *href) -{ if (soap_element(soap, tag, id, NULL) - || soap_attribute(soap, "href", href) - || soap_element_start_end_out(soap, tag)) - return soap->error; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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_2 -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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_attribute(struct soap *soap, const char *name, const char *value) -{ -/**/ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - a->next = soap->dom->atts; - a->nstr = NULL; - a->name = soap_strdup(soap, name); /* check EOM */ - a->data = soap_strdup(soap, value); /* check EOM */ - a->wide = NULL; - soap->dom->atts = a; - return SOAP_OK; - } -#endif -/**/ -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { if (soap_set_attr(soap, name, value)) - return soap->error; - } - else -#endif - { if (soap_send_raw(soap, " ", 1) - || 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) -{ if (tag && *tag == '-') - return SOAP_OK; - if (!soap_peek_element(soap)) - { if (soap->other) - return soap->error = SOAP_TAG_MISMATCH; - if (!(soap->error = soap_match_tag(soap, soap->tag, tag))) - { if (tag && !soap->encodingStyle) - { const char *s = strchr(tag, ':'); - if (s) - soap_push_default_namespace(soap, tag, s - tag); - } - soap->peeked = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (soap->body) - soap->level++; - } - } - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element_end_in(struct soap *soap, const char *tag) -{ register wchar c; - register char *s; - register const char *t; - if (tag && *tag == '-') - return SOAP_OK; - soap->level--; - soap_pop_namespace(soap); - if (soap->peeked) - { if (*soap->tag == '\0') - { soap->peeked = 0; - soap->error = SOAP_OK; - } - else - return soap->error = SOAP_SYNTAX_ERROR; - } - else - { while (((c = soap_get(soap)) != TT)) - { if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (c == LT) - return soap->error = SOAP_SYNTAX_ERROR; - } - } - s = soap->tag; - do c = soap_get(soap); - while (soap_blank(c)); - do - { *s++ = (char)c; - c = soap_get(soap); - } while (soap_notblank(c)); - *s = '\0'; - if ((int)c == EOF) - return soap->error = SOAP_EOF; - while (soap_blank(c)) - c = soap_get(soap); - if (c != 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:"")); - if (!tag) - return SOAP_OK; - if ((s = strchr(soap->tag, ':'))) - s++; - else - s = soap->tag; - if ((t = strchr(tag, ':'))) - t++; - else - t = tag; - if (!SOAP_STRCMP(s, t)) - return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_attribute * -SOAP_FMAC2 -soap_attr(struct soap *soap, const char *name) -{ register struct soap_attribute *tp; - for (tp = soap->attributes; tp; tp = tp->next) - if (!soap_match_tag(soap, tp->name, name)) - return tp; - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char * -SOAP_FMAC2 -soap_attr_value(struct soap *soap, const char *name) -{ register struct soap_attribute *tp = soap_attr(soap, name); - if (tp && tp->visible == 2) - return tp->value; - 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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(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, ':'); - 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 (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(tp->value); - tp->value = NULL; - tp->ns = NULL; - } - if (value) - { if (!tp->value) - { tp->size = strlen(value) + 1; - if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) - return soap->error = SOAP_EOM; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value of %s (%p)\n", tp->name, tp->value)); - } - strcpy(tp->value, value); - if (!strncmp(tp->name, "xmlns:", 6)) - tp->ns = tp->value; - tp->visible = 2; - } - 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; - SOAP_FREE(soap->attributes->value); - SOAP_FREE(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, wchar d) -{ size_t i; - wchar c; - for (i = 0; i < n; i++) - { c = soap_getutf8(soap); - switch (c) - { - case TT: - *s++ = '<'; - soap_unget(soap, '/'); - break; - case LT: - *s++ = '<'; - break; - case GT: - if (d == ' ') - { soap_unget(soap, c); - *s = '\0'; - return SOAP_OK; - } - *s++ = '>'; - break; - case QT: - if (c == d) - { *s = '\0'; - return SOAP_OK; - } - *s++ = '"'; - break; - case 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 -static int -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->lablen); - if (!soap->labbuf) - { if (t) - free(t); - return soap->error = SOAP_EOM; - } - if (t && soap->labidx) - { memcpy(soap->labbuf, t, soap->labidx); - free(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) -{ struct soap_attribute *tp; - const char *t; - register char *s; - register wchar c; - register int i; - if (soap->peeked) - { if (*soap->tag == '\0') - return soap->error = SOAP_NO_TAG; - return SOAP_OK; - } - soap->peeked = 1; - for (;;) - { while (((c = soap_get(soap)) != LT) && c != TT) - { if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - if (c == TT) - { *soap->tag = '\0'; - return soap->error = SOAP_NO_TAG; /* ending tag found */ - } - s = soap->tag; - do c = soap_get(soap); - while (soap_blank(c)); - i = sizeof(soap->tag); - while (c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - *s = '\0'; - if (*soap->tag != '?') - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <%s?>\n", soap->tag)); - while ((int)c != EOF && c != GT && c != '?') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf) - 2; - while (c != '=' && c != GT && c != '?' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { *s++ = '='; - do c = soap_get(soap); - while (soap_blank(c)); - if (c != QT && c != AP) - { soap_unget(soap, c); - c = ' '; /* blank delimiter */ - } - if (soap_getattrval(soap, s, i, c) == SOAP_EOM) - while (soap_getattrval(soap, soap->tmpbuf, sizeof(soap->tmpbuf), c) == SOAP_EOM) - ; - else if (!strcmp(soap->tag, "?xml") && (!soap_tag_cmp(soap->tmpbuf, "encoding=iso-8859-1") || !soap_tag_cmp(soap->tmpbuf, "encoding=latin1"))) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML latin1 encoding\n")); - soap->mode |= SOAP_C_LATIN; - } - } - do c = soap_get(soap); - while (soap_blank(c)); - } - } - 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; - soap_clr_attr(soap); - soap_pop_namespace(soap); - while ((int)c != EOF && c != GT && c != '/') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf); - while (c != '=' && c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - *s = '\0'; - if (i == sizeof(soap->tmpbuf)) - return soap->error = SOAP_SYNTAX_ERROR; - if (!strncmp(soap->tmpbuf, "xmlns:", 6)) - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (!strcmp(soap->tmpbuf, "xmlns")) - t = SOAP_STR_EOS; - else - t = NULL; - tp = soap_attr(soap, soap->tmpbuf); - if (!tp) - { tp = (struct soap_attribute*)SOAP_MALLOC(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; - tp->next = soap->attributes; - soap->attributes = tp; - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { do c = soap_get(soap); - while (soap_blank(c)); - if (c != QT && c != 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; - soap->labidx = 0; - if (soap_append_lab(soap, tp->value, tp->size)) - return soap->error; - SOAP_FREE(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; - } - tp->size = soap->lablen; - if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) - return soap->error = SOAP_EOM; - memcpy(tp->value, soap->labbuf, soap->lablen); -#else - size_t n; - if (soap->error != SOAP_EOM) - return soap->error; - soap->error = SOAP_OK; - if (soap_new_block(soap)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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(n))) - return soap->error = SOAP_EOM; - if (tp->value) - { memcpy(s, tp->value, tp->size); - SOAP_FREE(tp->value); - } - soap_save_block(soap, s + tp->size); - tp->value = s; - tp->size = n; -#endif - } - do c = soap_get(soap); - while (soap_blank(c)); - tp->visible = 2; /* seen this attribute w/ value */ - } - else - tp->visible = 1; /* seen this attribute w/o value */ - if (t && tp->value) - { if (soap_push_namespace(soap, t, tp->value)) - return soap->error; - tp->visible = 0; - } - } - if ((int)c == EOF) - return soap->error = SOAP_EOF; - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible && tp->value) - { if (!strcmp(tp->name, "id")) - { if (soap->part != SOAP_IN_HEADER || !soap->dot_net_bug) - { *soap->id = '#'; - strncpy(soap->id + 1, tp->value, sizeof(soap->id) - 2); - } - } - else if (soap->version == 1 && !strcmp(tp->name, "href")) - strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - else if (soap->version == 2 && !strcmp(tp->name, "ref")) - { *soap->href = '#'; - strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); - } - else if (!soap_match_tag(soap, tp->name, "xsi:type")) - strncpy(soap->type, tp->value, sizeof(soap->type) - 1); - else if (soap->version == 1 && !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); - } - else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) - strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); - else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) - strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) - strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position")) - soap->position = soap_getposition(tp->value, soap->positions); - else if (soap->version == 1 && !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:actor") - || !soap_match_tag(soap, tp->name, "SOAP-ENV:role")) - { if ((!soap->actor || strcmp(soap->actor, tp->value)) - && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next") - && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) - soap->other = 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, "xsi:null") - || !soap_match_tag(soap, tp->name, "xsi:nil")) - && (!strcmp(tp->value, "1") - || !strcmp(tp->value, "true"))) - soap->null = 1; - } - } - if (!(soap->body = (c != '/'))) - do c = soap_get(soap); - while (soap_blank(c)); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_retry(struct soap *soap) -{ soap->peeked = 1; - soap->error = SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_revert(struct soap *soap) -{ 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 wchar c; - register wchar mask = 0x80000000; -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { soap->dom->data = soap_strdup(soap, s); /* check EOM */ - return SOAP_OK; - } -#endif - if (soap->mode & SOAP_C_UTFSTRING) - mask = 0; - t = s; - while ((c = *t++)) - { switch (c) - { - case 9: - if (flag) - { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) - return soap->error; - s = t; - } - break; - case 10: - 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 13: - 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: -#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 - if (c & mask) - { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) - return soap->error; - s = t; - } - } - } - 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) -{ register char *s; - char *t = NULL; - register size_t i; - register int n = 0; - register int m = 0; - register wchar c; -#ifdef HAVE_WCTOMB - char buf[MB_LEN_MAX > 8 ? MB_LEN_MAX : 8]; -#else - char buf[8]; -#endif -#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)) - 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, 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 && !(soap->mode & SOAP_C_LATIN)) - { soap_unget(soap, c); - c = soap_getutf8(soap); - if (soap->mode & SOAP_C_UTFSTRING) - { if ((c & 0x80000000) && c >= -0x7FFFFF80 && c < 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_get1(soap); - if (c == '>') - n--; - soap_unget(soap, c); - } - *s++ = '/'; - break; - case '<': - c = soap_get1(soap); - if (c == '/') - { if (n == 0) - { c = TT; - goto end; - } - n--; - } - else if (c == '!') - { c = soap_get1(soap); - if (c == '[') - { do c = soap_get1(soap); - while ((int)c != EOF && c != '['); - if ((int)c == EOF) - goto end; - t = (char*)"![CDATA["; - state = 1; - } - else if (c == '-') - { if ((c = soap_get1(soap)) == '-') - state = 2; - t = (char*)"!-"; - soap_unget(soap, c); - } - else - { t = (char*)"!"; - 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: -#ifdef HAVE_WCTOMB - if (soap->mode & SOAP_C_MBSTRING) - { m = wctomb(buf, c & 0x7FFFFFFF); - if (m >= 1) - { t = buf; - *s++ = *t++; - m--; - } - else - *s++ = SOAP_UNKNOWN_CHAR; - } - else -#endif - *s++ = (char)(c & 0xFF); - } - } - } - } -#endif -#ifdef WITH_FAST - soap->labidx = 0; /* use look-aside buffer */ -#else - if (soap_new_block(soap)) - 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, 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 < 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 if (soap->mode & SOAP_C_LATIN) - c = soap_get(soap); - else - c = soap_getutf8(soap); - switch (c) - { - case TT: - if (n == 0) - goto end; - n--; - *s++ = '<'; - soap_unget(soap, '/'); - break; - case LT: - n++; - *s++ = '<'; - break; - case GT: - *s++ = '>'; - break; - case QT: - *s++ = '"'; - break; - case AP: - *s++ = '\''; - break; - case '/': - if (n > 0) - { c = soap_get(soap); - if (c == GT) - n--; - soap_unget(soap, c); - } - *s++ = '/'; - break; - case '<': - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - } - break; - case '>': - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - } - break; - case '"': - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - } - break; - default: - if ((int)c == EOF) - goto end; -#ifdef HAVE_WCTOMB - if (soap->mode & SOAP_C_MBSTRING) - { m = wctomb(buf, c & 0x7FFFFFFF); - if (m >= 1) - { t = buf; - *s++ = *t++; - m--; - } - else - *s++ = SOAP_UNKNOWN_CHAR; - } - else -#endif - *s++ = (char)(c & 0xFF); - } - } - } -end: - soap_unget(soap, c); - *s = '\0'; -#ifdef WITH_FAST - t = soap_strdup(soap, soap->labbuf); -#else - soap_size_block(soap, i+1); - t = soap_save_block(soap, NULL); -#endif - if (flag == 2) - if (soap_s2QName(soap, t, &t)) - return NULL; - return t; -} -#endif - -/******************************************************************************/ -#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 wchar c; -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { soap->dom->wide = NULL; /* soap_malloc() ??? */ - return SOAP_OK; - } -#endif - while ((c = *s++)) - { switch (c) - { - case 9: - if (flag) - t = " "; - else - t = "\t"; - break; - case 10: - if (flag || !(soap->mode & SOAP_XML_CANONICAL)) - t = " "; - else - t = "\n"; - break; - case 13: - 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 > 0 && 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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -wchar_t * -SOAP_FMAC2 -soap_wstring_in(struct soap *soap, int flag) -{ wchar_t *s; - register int i, n = 0; - register wchar c; - const char *t = NULL; - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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; - } - if (soap->mode & SOAP_C_LATIN) - c = soap_get(soap); - else - c = soap_getutf8(soap); - switch (c) - { - case TT: - if (n == 0) - goto end; - n--; - *s++ = '<'; - soap_unget(soap, '/'); - break; - case LT: - n++; - *s++ = '<'; - break; - case GT: - *s++ = '>'; - break; - case QT: - *s++ = '"'; - break; - case AP: - *s++ = '\''; - break; - case '/': - if (n > 0) - { c = soap_getutf8(soap); - if (c == GT) - n--; - soap_unget(soap, c); - } - *s++ = '/'; - break; - case '<': - if (flag) - *s++ = (wchar)'<'; - else - { *s++ = (wchar)'&'; - t = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (wchar)'>'; - else - { *s++ = (wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (wchar)'"'; - else - { *s++ = (wchar)'&'; - t = "quot;"; - } - break; - default: - if ((int)c == EOF) - goto end; - *s++ = (wchar_t)c & 0x7FFFFFFF; - } - } - } -end: - soap_unget(soap, c); - *s = '\0'; - soap_size_block(soap, sizeof(wchar_t) * (i + 1)); - return (wchar_t*)soap_save_block(soap, NULL); -} -#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) -{ long m = (long)*p; - return soap_outlong(soap, tag, id, &m, type, n); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2int(struct soap *soap, const char *s, int *p) -{ if (s) - { char *r; - *p = (int)soap_strtol(s, &r, 10); - if (*r) - return soap->error = SOAP_TYPE; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (int*)soap_id_enter(soap, soap->id, p, t, sizeof(int), 0); - if (p && soap->body && !*soap->href) - soap_s2int(soap, soap_value(soap), p); - else - p = (int*)soap_id_forward(soap, soap->href, p, t, sizeof(int)); - 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; - *p = soap_strtol(s, &r, 10); - if (*r) - return soap->error = SOAP_TYPE; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (long*)soap_id_enter(soap, soap->id, p, t, sizeof(long), 0); - if (p && soap->body && !*soap->href) - soap_s2long(soap, soap_value(soap), p); - else - p = (long*)soap_id_forward(soap, soap->href, p, t, sizeof(long)); - 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 && sscanf(s, SOAP_LONG_FORMAT, p) != 1) - return soap->error = SOAP_TYPE; - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (LONG64*)soap_id_enter(soap, soap->id, p, t, sizeof(LONG64), 0); - if (soap->body && !*soap->href) - soap_s2LONG64(soap, soap_value(soap), p); - else - p = (LONG64*)soap_id_forward(soap, soap->href, p, t, sizeof(LONG64)); - 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) -{ long m = (long)*p; - return soap_outlong(soap, tag, id, &m, type, n); -} -#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 (*r || n < -128 || n > 127) - return soap->error = SOAP_TYPE; - *p = (char)n; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (char*)soap_id_enter(soap, soap->id, p, t, sizeof(char), 0); - if (soap->body && !*soap->href) - soap_s2byte(soap, soap_value(soap), p); - else - p = (char*)soap_id_forward(soap, soap->href, p, t, sizeof(char)); - 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) -{ long m = (long)*p; - return soap_outlong(soap, tag, id, &m, type, n); -} -#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 (*r || n < -32768 || n > 32767) - return soap->error = SOAP_TYPE; - *p = (char)n; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (short*)soap_id_enter(soap, soap->id, p, t, sizeof(short), 0); - if (soap->body && !*soap->href) - soap_s2short(soap, soap_value(soap), p); - else - p = (short*)soap_id_forward(soap, soap->href, p, t, sizeof(short)); - 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) -{ const char *s; - if (isnan(n)) - s = "NaN"; - else if (n >= FLT_PINFTY) - s = "INF"; - else if (n <= FLT_NINFTY) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->float_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 (!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 - { -#ifdef HAVE_STRTOD - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif - if (sscanf(s, soap->float_format, p) != 1) - return soap->error = SOAP_TYPE; - } - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - if (*soap->type != '\0' && soap_isnumeric(soap, type)) - return NULL; - p = (float*)soap_id_enter(soap, soap->id, p, t, sizeof(float), 0); - if (soap->body && !*soap->href) - soap_s2float(soap, soap_value(soap), p); - else - p = (float*)soap_id_forward(soap, soap->href, p, t, sizeof(float)); - 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) -{ const char *s; - if (isnan(n)) - s = "NaN"; - else if (n >= DBL_PINFTY) - s = "INF"; - else if (n <= DBL_NINFTY) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->double_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 (!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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif - if (sscanf(s, soap->double_format, p) != 1) - return soap->error = SOAP_TYPE; - } - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - if (*soap->type != '\0' && soap_isnumeric(soap, type)) - return NULL; - p = (double*)soap_id_enter(soap, soap->id, p, t, sizeof(double), 0); - if (soap->body && !*soap->href) - soap_s2double(soap, soap_value(soap), p); - else - p = (double*)soap_id_forward(soap, soap->href, p, t, sizeof(double)); - 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) -{ unsigned long m = (unsigned long)*p; - return soap_outunsignedLong(soap, tag, id, &m, type, n); -} -#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 (*r || n > 255) - return soap->error = SOAP_TYPE; - *p = (unsigned char)n; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (unsigned char*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned char), 0); - if (soap->body && !*soap->href) - soap_s2unsignedByte(soap, soap_value(soap), p); - else - p = (unsigned char*)soap_id_forward(soap, soap->href, p, t, sizeof(unsigned char)); - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - return p; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_unsignedShort2s(struct soap *soap, unsigned short n) -{ return soap_unsignedLong2s(soap, (unsigned long)n); -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_outunsignedShort(struct soap *soap, const char *tag, int id, const unsigned short *p, const char *type, int n) -{ unsigned long m = (unsigned long)*p; - return soap_outunsignedLong(soap, tag, id, &m, type, n); -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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 (*r || n > 65535) - return soap->error = SOAP_TYPE; - *p = (unsigned short)n; - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (unsigned short*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned short), 0); - if (soap->body && !*soap->href) - soap_s2unsignedShort(soap, soap_value(soap), p); - else - p = (unsigned short*)soap_id_forward(soap, soap->href, p, t, sizeof(unsigned short)); - 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) -{ unsigned long m = (unsigned long)*p; - return soap_outunsignedLong(soap, tag, id, &m, type, n); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2unsignedInt(struct soap *soap, const char *s, unsigned int *p) -{ if (s) - { char *r; - *p = (unsigned int)soap_strtoul(s, &r, 10); - if (*r) - return soap->error = SOAP_TYPE; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (unsigned int*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned int), 0); - if (soap->body && !*soap->href) - soap_s2unsignedInt(soap, soap_value(soap), p); - else - p = (unsigned int*)soap_id_forward(soap, soap->href, p, t, sizeof(unsigned int)); - 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; - *p = soap_strtoul(s, &r, 10); - if (*r) - return soap->error = SOAP_TYPE; - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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; - } - p = (unsigned long*)soap_id_enter(soap, soap->id, p, t, sizeof(unsigned long), 0); - if (soap->body && !*soap->href) - soap_s2unsignedLong(soap, soap_value(soap), p); - else - p = (unsigned long*)soap_id_forward(soap, soap->href, p, t, sizeof(unsigned long)); - 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 && sscanf(s, SOAP_ULONG_FORMAT, p) != 1) - return soap->error = SOAP_TYPE; - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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); - if (soap->body && !*soap->href) - soap_s2ULONG64(soap, soap_value(soap), p); - else - p = (ULONG64*)soap_id_forward(soap, soap->href, p, t, sizeof(ULONG64)); - 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) -{ *t = NULL; - if (s && !(*t = soap_strdup(soap, s))) - return soap->error = SOAP_EOM; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2QName(struct soap *soap, const char *s, char **t) -{ if (s) - { struct soap_nlist *np = soap->nlist; - const char *p = strchr(s, ':'); - if (p) - { int n = p - s; - while (np && (np->index == -2 || strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - return s; - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%lu", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#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) -{ if (!*p) - { if (soap_element_null(soap, tag, id, type)) - return soap->error; - } - else - { struct soap_plist *pp; - int i = soap_pointer_lookup(soap, *p, n, &pp); - if (id > 0) - { if (i) - { if (soap_element_begin_out(soap, tag, id, type) || soap_string_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - soap_set_embedded(soap, pp); - } - else - { i = soap_pointer_enter(soap, *p, n, &pp); - if (soap_element_begin_out(soap, tag, id, type) || soap_string_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - pp->mark1 = 0; - else - pp->mark2 = 0; - } - } - else if (i) - { if (soap_is_embedded(soap, pp)) - { if (soap_element_ref(soap, tag, 0, i)) - return soap->error; - } - else if (soap_is_single(soap, pp)) - { if (soap_element_begin_out(soap, tag, 0, type) || soap_string_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - } - else - { if (soap_element_begin_out(soap, tag, i, type) || soap_string_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - soap_set_embedded(soap, pp); - } - } - else - { soap_pointer_enter(soap, *p, n, &pp); - if (soap_element_begin_out(soap, tag, id, type) || soap_string_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - pp->mark1 = 0; - else - pp->mark2 = 0; - } - } - 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) -{ if (soap_element_begin_in(soap, tag)) - return NULL; - if (soap->null) - { p = (char**)soap_id_enter(soap, soap->id, p, t, sizeof(char**), 0); - if (p) - *p = NULL; - } - else if (soap->body && !*soap->href) - { if (soap_match_tag(soap, soap->type, "PointerTostring") == 0) - { p = (char**)soap_id_enter(soap, soap->id, p, t, sizeof(char**), 0); - p = (char**)soap_instring(soap, "string", p, type, t, flag); - } - else - { if (!p) - if ((p = (char**)soap_id_enter(soap, SOAP_STR_EOS, p, t, sizeof(char**), 0)) == NULL) - return NULL; - *p = (char*)soap_id_enter(soap, soap->id, soap_string_in(soap, flag), t, 0, 0); - } - } - else - 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 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) -{ if (!*p) - { if (soap_element_null(soap, tag, id, type)) - return soap->error; - } - else - { struct soap_plist *pp; - int i = soap_pointer_lookup(soap, *p, n, &pp); - if (id > 0) - { if (i) - { if (soap_element_begin_out(soap, tag, id, type) || soap_wstring_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - soap_set_embedded(soap, pp); - } - else - { i = soap_pointer_enter(soap, *p, n, &pp); - if (soap_element_begin_out(soap, tag, id, type) || soap_wstring_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - pp->mark1 = 0; - else - pp->mark2 = 0; - } - } - else if (i) - { if (soap_is_embedded(soap, pp)) - { if (soap_element_ref(soap, tag, 0, i)) - return soap->error; - } - else if (soap_is_single(soap, pp)) - { if (soap_element_begin_out(soap, tag, 0, type) || soap_wstring_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - } - else - { if (soap_element_begin_out(soap, tag, i, type) || soap_wstring_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - soap_set_embedded(soap, pp); - } - } - else - { if (soap_element_begin_out(soap, tag, id, type) || soap_wstring_out(soap, *p, 0) || soap_element_end_out(soap, tag)) - return soap->error; - if (soap->mode & SOAP_IO_LENGTH) - pp->mark1 = 0; - else - pp->mark2 = 0; - } - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#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) -{ if (soap_element_begin_in(soap, tag)) - return NULL; - if (soap->null) - { p = (wchar_t**)soap_id_enter(soap, soap->id, p, t, sizeof(wchar_t**), 0); - if (p) - *p = NULL; - } - else if (soap->body && !*soap->href) - { if (soap_match_tag(soap, soap->type, "PointerTostring") == 0) - p = (wchar_t**)soap_inwstring(soap, "string", (wchar_t**)soap_id_enter(soap, soap->id, p, t, sizeof(wchar_t**), 0), type, t); - else - { if (!p) - if (!(p = (wchar_t**)soap_id_enter(soap, SOAP_STR_EOS, p, t, sizeof(wchar_t**), 0))) - return NULL; - *p = (wchar_t*)soap_id_enter(soap, soap->id, soap_wstring_in(soap, 1), t, 0, 0); - } - } - else - 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 - -/******************************************************************************/ -#ifndef WITH_LEAN -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#elif defined(HAVE_GETTIMEOFDAY) - struct timezone t; - struct timeval tv; - gettimeofday(&tv, &t); /* doesn't work properly on Solaris */ - T->tm_min -= t.tz_minuteswest; - T->tm_isdst = (t.tz_dsttime != 0); - return mktime(T); -/* WR[ */ - /* The following define was added for VxWorks*/ -#elif defined(HAVE_MKTIME) - /* FOR VXWORKS: - vxWorks does not seem to have any variable representation of time zones, but - timezone information can be set in INSTALL_DIR/target/h/private/timeP.h header - file, by setting the ZONEBUFFER define. The ZONEBUFFER define follows this - format: - - name_of_zone:<(unused)>:time_in_minutes_from_UTC:daylight_start:daylight_end - - To calculate local time, the value of time_in_minutes_from_UTC is subtracted - from UTC; time_in_minutes_from_UTC must be positive. Daylight information is - expressed as mmddhh (month-day-hour), for example: - - UTC::0:040102:100102 - - */ - return mktime(T); -/* ]WR */ -#elif defined(HAVE_FTIME) - struct timeb t; - t.timezone = 0; - t.dstflag = -1; - ftime(&t); - T->tm_min -= t.timezone; - T->tm_isdst = t.dstflag; /* doesn't work properly on Solaris */ - return mktime(T); -#else -#warning "time_t (de)serialization is not MT safe on this platform" - time_t t; - char *tz = getenv("TZ"); - putenv("TZ=UTC"); - tzset(); - t = mktime(T); - if (tz) - { char tmp[16]; - strcpy(tmp, "TZ="); - strncat(tmp, tz, 12); - tmp[15] = '\0'; - putenv(tmp); - } - else - putenv("TZ="); - tzset(); - return t; -#endif -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_dateTime2s(struct soap *soap, time_t n) -{ struct tm T; - struct tm *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); -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -/* ]WR */ -#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 t; -#if defined(HAVE_LOCALTIME_R) - if (localtime_r(&n, pT)) - { struct timeval tv; - gettimeofday(&tv, &t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.tz_minuteswest/60-(t.tz_dsttime!=0), abs(t.tz_minuteswest)%60); - } -#else - if ((pT = localtime(&n))) - { struct timeval tv; - gettimeofday(&tv, &t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.tz_minuteswest/60-(t.tz_dsttime!=0), abs(t.tz_minuteswest)%60); - } -#endif -#elif defined(HAVE_FTIME) - struct timeb t; -#if defined(HAVE_LOCALTIME_R) - if (localtime_r(&n, pT)) - { ftime(&t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60-(t.dstflag!=0), abs(t.timezone)%60); - } -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, abs(t.timezone)%60); - } -/* ]WR */ -#else - if ((pT = localtime(&n))) - { ftime(&t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60-(t.dstflag!=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); -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); -/* ]WR */ -#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) - { struct tm T; - char zone[16]; - memset(&T, 0, sizeof(struct tm)); - zone[sizeof(zone)-1] = '\0'; - sscanf(s, "%d-%d-%dT%d:%d:%d%15s", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s != 'Z') - { int h = 0, m = 0; - sscanf(s, "%d:%d", &h, &m); - T.tm_hour -= h; - if (h >= 0) - T.tm_min -= m; - else - T.tm_min += m; - } - *p = soap_timegm(&T); - } - else - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - return SOAP_OK; -} -#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)) - return NULL; - if (soap->null) - { if (soap->mode & SOAP_XML_NIL) - { soap->error = SOAP_NULL; - return NULL; - } - return p; - } - 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); - if (soap->body && !*soap->href) - soap_s2dateTime(soap, soap_value(soap), p); - else - p = (time_t*)soap_id_forward(soap, soap->href, p, t, sizeof(time_t)); - 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) -{ int i; - const char *t = NULL; - if (tag && *tag != '-') - { if ((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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p && *p) - { if (soap_send(soap, *p)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - return NULL; - 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, 0); - else - *p = NULL; - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_outwliteral(struct soap *soap, const char *tag, wchar_t *const*p) -{ int i; - const char *t = NULL; - wchar_t c; - const wchar_t *s; - if (tag && *tag != '-') - { if (tag && (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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p) - { s = *p; - while ((c = *s++)) - if (soap_pututf8(soap, (unsigned char)c)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#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)) - return NULL; - if (!p) - if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) - return NULL; - if (soap->null) - *p = NULL; - else if (soap->body) - *p = soap_wstring_in(soap, 0); - else - *p = NULL; - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -char * -SOAP_FMAC2 -soap_value(struct soap *soap) -{ size_t i; - wchar c = 0; - char *s; - s = soap->tmpbuf; - for (i = 0; i < sizeof(soap->tmpbuf) - 1; i++) - { c = soap_get(soap); - if (c == TT || (int)c == EOF || soap_blank(c)) - break; - *s++ = (char)c; - } - if ((int)c == EOF || c == TT) - soap_unget(soap, c); - *s = '\0'; - return soap->tmpbuf; /* return non-null pointer */ -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_getline(struct soap *soap, char *s, int len) -{ int i = len; - wchar c = 0; - for (;;) - { while (--i > 0) - { c = soap_getchar(soap); - if (c == '\r' || c == '\n' || (int)c == EOF) - break; - *s++ = (char)c; - } - *s = '\0'; - while (c != '\n' && (int)c != EOF) - c = soap_getchar(soap); - if ((int)c == EOF) - return SOAP_EOF; - if (i+1 == len) /* empty line: end of HTTP header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static size_t -soap_begin_dime(struct soap *soap) -{ -#ifndef WITH_LEANER - if (soap->mode & SOAP_ENC_DIME) - { size_t count; - 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; - count = soap->dime_size + 12 + ((soap->count+3)&(~3)) + ((strlen(soap->dime_id)+3)&(~3)) + ((strlen(soap->dime_type)+3)&(~3)); - soap->dime_size = soap->count; - if (soap->dime_count) - soap->dime_flags = SOAP_DIME_MB | SOAP_DIME_ABSURI; - else - soap->dime_flags = SOAP_DIME_MB | SOAP_DIME_ME | SOAP_DIME_ABSURI; - return count; - } -#endif - return soap->count; -} -#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 type, 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] = type >> 8; - s[1] = type & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime_type) - typelen = strlen(soap->dime_type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime_flags & 0x7); - tmp[1] = soap->dime_flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime_size >> 24; - tmp[9] = (soap->dime_size >> 16) & 0xFF; - tmp[10] = (soap->dime_size >> 8) & 0xFF; - tmp[11] = 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, int i, char *id, char *type, char *options, void *ptr, size_t size) -{ void *h; - if (id) - soap->dime_id = id; - else - { sprintf(soap->id, soap->dime_id_format, i); - soap->dime_id = soap->id; - } - soap->dime_type = type; - soap->dime_options = options; - soap->dime_size = size; - soap->dime_flags = SOAP_DIME_VERSION | SOAP_DIME_MEDIA; - if (soap->fdimereadopen && ((h = soap->fdimereadopen(soap, (void*)ptr, soap->dime_id, type, options)) || soap->error)) - { size_t n; - if (!h) - { 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)) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Chunked streaming DIME\n")); - n = sizeof(soap->tmpbuf); - do - { size = soap->fdimeread(soap, h, soap->tmpbuf, n); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread returned %lu bytes\n", (unsigned long)size)); - if (size == n) - soap->dime_flags |= SOAP_DIME_CF; - else - { soap->dime_flags &= ~SOAP_DIME_CF; - if (--soap->dime_count == 0) - soap->dime_flags |= SOAP_DIME_ME; - } - soap->dime_size = size; - if (soap_putdimehdr(soap) - || soap_send_raw(soap, soap->tmpbuf, size) - || soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->dime_size&3)) - 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 >= n); - } - else - { if (--soap->dime_count == 0) - soap->dime_flags |= SOAP_DIME_ME; - if (soap_putdimehdr(soap)) - return soap->error; - do - { if (size < sizeof(soap->tmpbuf)) - n = size; - else - n = sizeof(soap->tmpbuf); - if (!(n = soap->fdimeread(soap, h, soap->tmpbuf, n))) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "fdimeread failed: insufficient data (%lu bytes remaining from %lu bytes)\n", (unsigned long)size, (unsigned long)soap->dime_size)); - soap->error = SOAP_EOF; - break; - } - if (soap_send_raw(soap, soap->tmpbuf, n)) - break; - size -= n; - } 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, h); - return soap->error; - } - if (--soap->dime_count == 0) - soap->dime_flags |= SOAP_DIME_ME; - if (soap_putdimehdr(soap)) - return soap->error; - return soap_putdimefield(soap, (char*)ptr, size); -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_LEANER -#ifndef PALM_1 -static char * -soap_getdimefield(struct soap *soap, size_t n) -{ register wchar c; - register int i; - register char *s; - 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 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_EOD; - 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=%u flags=0x%X\n", (unsigned int)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->dime_type?soap->dime_type:"", soap->dime_options?soap->dime_options+4:"")); - 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) -{ if (soap_getdimehdr(soap)) - return soap->error; - if (soap->fdimewriteopen && ((soap->dime_ptr = (char*)soap->fdimewriteopen(soap, soap->dime_id, soap->dime_type, soap->dime_options)) || soap->error)) - { 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) - { char *id, *type, *options; - register wchar c; - register char *s; - register int i; - id = soap->dime_id; - type = soap->dime_type; - options = soap->dime_options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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))) - return soap->error; - soap->dime_ptr[soap->dime_size] = '\0'; /* make 0-terminated to enable string-based attachments */ - soap->dime_id = id; - soap->dime_type = type; - soap->dime_options = options; - } - else - soap->dime_ptr = soap_getdimefield(soap, soap->dime_size); - return soap->error; -} -#endif -#endif - -/******************************************************************************/ - -#ifdef WITH_COOKIES -/******************************************************************************/ -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_encode_cookie(const char *s, char *t, int len) -{ register int c; - register int n = len; - while ((c = *s++) && --n > 0) - { if (c > ' ' && c < 128 && c != ';' && 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 -const char* -SOAP_FMAC2 -soap_decode_cookie(char *buf, int len, const char *val) -{ const char *s; - char *t; - for (s = val; *s; s++) - if (*s != ' ' && *s != '=') - break; - if (*s == '"') - { t = buf; - s++; - while (*s && *s != '"' && --len) - *t++ = *s++; - *t = '\0'; - do s++; - while (*s && *s != ';' && *s != '='); - } - else - { t = buf; - while (*s && *s != ';' && *s != '=' && --len) - switch (*s) - { case ' ': - s++; - break; - case '%': - *t++ = ((s[1] >= 'A' ? (s[1] & 0x7) + 9 : s[1] - '0') << 4) - + (s[2] >= 'A' ? (s[2] & 0x7) + 9 : s[2] - '0'); - s += 3; - break; - default: - *t++ = *s++; - } - *t = '\0'; - } - return s; -} - -/******************************************************************************/ -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++; - n = strlen(path); - for (p = soap->cookies; p; p = p->next) - if (!strcmp(p->name, name) - && domain - && p->domain - && !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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"", domain?domain:"", path?path:"")); - if (!domain) - domain = soap->cookie_domain; - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - return NULL; - } - if (*path == '/') - path++; - q = soap_cookie(soap, name, domain, path); - if (!q) - { if ((q = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - { if ((q->name = (char*)SOAP_MALLOC(strlen(name)+1))) - strcpy(q->name, name); - q->value = NULL; - q->domain = NULL; - q->path = NULL; - q->expire = -1; - q->version = 0; - q->secure = 0; - q->env = 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 && strcmp((*p)->path, path) < 0) - break; - if (n) - { q->next = *p; - *p = q; - } - else - { SOAP_FREE(q->name); - SOAP_FREE(q); - q = NULL; - } - } - } - else - q->modified = 1; - if (q) - { if (q->value) - { SOAP_FREE(q->value); - q->value = NULL; - } - if (q->domain) - { SOAP_FREE(q->domain); - q->domain = NULL; - } - if (q->path) - { SOAP_FREE(q->path); - q->path = NULL; - } - if (value && *value && (q->value = (char*)SOAP_MALLOC(strlen(value)+1))) - strcpy(q->value, value); - if (domain && *domain && (q->domain = (char*)SOAP_MALLOC(strlen(domain)+1))) - strcpy(q->domain, domain); - if (path && *path && (q->path = (char*)SOAP_MALLOC(strlen(path)+1))) - strcpy(q->path, path); - q->session = 1; - } - 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) - { soap_set_receiver_error(soap, "Cookie domain not set", SOAP_STR_EOS, SOAP_HTTP_ERROR); - return; - } - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", SOAP_STR_EOS, SOAP_HTTP_ERROR); - 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(q->value); - if (q->domain) - SOAP_FREE(q->domain); - if (q->path) - SOAP_FREE(q->path); - *p = q->next; - SOAP_FREE(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 -long -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; - if ((p = soap_cookie(soap, name, domain, path))) - { p->expire = 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 || !p->env) - { s = tmp; - if (p->name) - s += soap_encode_cookie(p->name, s, tmp-s+4064); - if (p->value) - { *s++ = '='; - s += soap_encode_cookie(p->value, s, tmp-s+4064); - } - if (p->domain && (int)strlen(p->domain) < tmp-s+4064) - sprintf(s, ";Domain=%s", p->domain); - else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) - sprintf(s, ";Domain=%s", soap->cookie_domain); - strcpy(s, ";Path=/"); - if (p->path) - t = p->path; - else - t = soap->cookie_path; - if (t) - { if (*t == '/') - t++; - if ((int)strlen(t) < tmp-s+4064) - strcat(s, t); - } - s += strlen(s); - if (p->version > 0) - { sprintf(s, ";Version=%u", p->version); - s += strlen(s); - } - if (p->expire >= 0) - { sprintf(s, ";Max-Age=%ld", p->expire); - s += strlen(s); - } - if (p->secure) - strcpy(s, ";Secure"); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set-Cookie: %s\n", tmp)); - if (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; - while ((q = *p)) - { if (q->expire && now > q->expire) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie %s expired\n", q->name)); - SOAP_FREE(q->name); - if (q->value) - SOAP_FREE(q->value); - if (q->domain) - SOAP_FREE(q->domain); - if (q->path) - SOAP_FREE(q->path); - *p = q->next; - SOAP_FREE(q); - } - else if ((!q->domain || !strcmp(q->domain, domain)) - && (!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) - { *s++ = '='; - s += soap_encode_cookie(q->value, s, tmp-s+4080); - } - if (q->path && (int)strlen(q->path) < tmp-s+4080) - { sprintf(s, ";$Path=/%s", 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->fposthdr(soap, "Cookie", tmp)) - return soap->error; - p = &q->next; - } - else - 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_cookie(tmp, sizeof(tmp), s); - if (!soap_tag_cmp(tmp, "$Version")) - { if ((s = soap_decode_cookie(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_cookie(tmp, sizeof(tmp), s); - if (*tmp) - { if ((t = (char*)SOAP_MALLOC(strlen(tmp)+1))) - strcpy(t, tmp); - } - else - t = NULL; - if (p) - { if (p->path) - SOAP_FREE(p->path); - p->path = t; - } - else - { if (path) - SOAP_FREE(path); - path = t; - } - } - else if (!soap_tag_cmp(tmp, "$Domain")) - { s = soap_decode_cookie(tmp, sizeof(tmp), s); - if (*tmp) - { if ((t = (char*)SOAP_MALLOC(strlen(tmp)+1))) - strcpy(t, tmp); - } - else - t = NULL; - if (p) - { if (p->domain) - SOAP_FREE(p->domain); - p->domain = t; - } - else - { if (domain) - SOAP_FREE(domain); - domain = t; - } - } - else if (p && !soap_tag_cmp(tmp, "Path")) - { s = soap_decode_cookie(tmp, sizeof(tmp), s); - if (p->path) - SOAP_FREE(p->path); - if (*tmp) - { if ((p->path = (char*)SOAP_MALLOC(strlen(tmp)+1))) - strcpy(p->path, tmp); - } - else - p->path = NULL; - } - else if (p && !soap_tag_cmp(tmp, "Domain")) - { s = soap_decode_cookie(tmp, sizeof(tmp), s); - if (p->domain) - SOAP_FREE(p->domain); - if (*tmp) - { if ((p->domain = (char*)SOAP_MALLOC(strlen(tmp)+1))) - strcpy(p->domain, tmp); - } - else - p->domain = NULL; - } - else if (p && !soap_tag_cmp(tmp, "Version")) - { s = soap_decode_cookie(tmp, sizeof(tmp), s); - p->version = (unsigned int)atol(tmp); - } - else if (p && !soap_tag_cmp(tmp, "Max-Age")) - { s = soap_decode_cookie(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_cookie(tmp, sizeof(tmp), s); - memset(&T, 0, sizeof(struct tm)); - 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 = (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:"", p->domain?p->domain:"", p->path?p->path:"", 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(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } - if ((p = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - { p->name = (char*)SOAP_MALLOC(strlen(tmp)+1); - strcpy(p->name, tmp); - s = soap_decode_cookie(tmp, sizeof(tmp), s); - if (*tmp) - { p->value = (char*)SOAP_MALLOC(strlen(tmp)+1); - strcpy(p->value, tmp); - } - else - p->value = NULL; - p->domain = domain; - p->path = path; - p->expire = 0; - p->secure = 0; - p->version = version; - } - } - if (*s == ';') - s++; - } - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"", p->domain?p->domain:"", p->path?p->path:"", 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; - } - if (p->name) - SOAP_FREE(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } - if (domain) - SOAP_FREE(domain); - if (path) - SOAP_FREE(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_cookie(key, sizeof(key), s); - s = soap_decode_cookie(val, sizeof(val), s); - p = soap_set_cookie(soap, key, val, NULL, NULL); - if (p) - p->env = 1; - if (*s == ';') - s++; - } while (*s); - return SOAP_OK; -} - -/******************************************************************************/ -SOAP_FMAC1 -struct soap_cookie* -SOAP_FMAC2 -soap_copy_cookies(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(sizeof(struct soap_cookie)))) - return r; - **q = *p; - if (p->name) - { if (((*q)->name = (char*)SOAP_MALLOC(strlen(p->name)+1))) - strcpy((*q)->name, p->name); - } - if (p->value) - { if (((*q)->value = (char*)SOAP_MALLOC(strlen(p->value)+1))) - strcpy((*q)->value, p->value); - } - if (p->domain) - { if (((*q)->domain = (char*)SOAP_MALLOC(strlen(p->domain)+1))) - strcpy((*q)->domain, p->domain); - } - if (p->path) - { if (((*q)->path = (char*)SOAP_MALLOC(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(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } -} - -/******************************************************************************/ -#endif /* WITH_COOKIES */ - -/******************************************************************************/ -#ifdef WITH_GZIP -#ifndef PALM_2 -static int -soap_getgzipheader(struct soap *soap) -{ int i; - wchar c, 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)f != 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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_begin_recv(struct soap *soap) -{ wchar c; - soap_set_local_namespaces(soap); - soap->version = 0; /* don't assume we're parsing SOAP content by default */ - soap_free_iht(soap); - if ((soap->imode & SOAP_IO) == SOAP_IO_CHUNK) - soap->omode |= SOAP_IO_CHUNK; - soap->imode &= ~SOAP_IO; - 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->userid = NULL; - soap->passwd = NULL; - soap->action = NULL; - soap->dime_chunksize = 0; - soap->dime_buflen = 0; -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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 - c = soap_getchar(soap); - if ((c & 0xFFFC) == (SOAP_DIME_VERSION | SOAP_DIME_MB) && (soap_get0(soap) & 0xFFF0) == 0x20) - soap->mode |= SOAP_ENC_DIME; -#ifdef WITH_GZIP - else if (c == 0x1F) - { if (soap_getgzipheader(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")); - 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; - } -#endif - else - { if (c == 0xEF && !(soap->mode & SOAP_C_LATIN)) - { soap_unget(soap, c); - c = soap_getutf8(soap); - if (c == 0xFEFF) - c = soap_getchar(soap); - } - while (soap_blank(c)) - c = soap_getchar(soap); - } - if ((int)c == EOF) - return soap->error = SOAP_EOF; - soap_unget(soap, c); - if (c != '<' && !(soap->mode & (SOAP_ENC_DIME | SOAP_ENC_ZLIB))) - { soap->mode &= ~SOAP_IO; - if ((soap->error = soap->fparse(soap))) - { if (soap->error == 307) /* HTTP redirect */ - { soap_getline(soap, soap->endpoint, sizeof(soap->endpoint)); - soap->keep_alive = 0; /* force close when soap_closesock() */ - } - return soap->error; - } - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) - { soap->chunkbuflen = soap->buflen; - soap->buflen = soap->bufidx; - soap->chunksize = 0; - } -#ifdef WITH_ZLIB - if (soap->zlib_in) - { /* fparse should not use soap_unget */ -#ifdef WITH_GZIP - c = soap_get1(soap); - if (c == 0x1F) - { if (soap_getgzipheader(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->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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 - } -#ifndef WITH_LEANER - 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 PALM_1 -static int -http_parse(struct soap *soap) -{ char header[SOAP_HDRLEN], *s; - unsigned short g = 0, k; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for response...\n")); - *soap->endpoint = '\0'; - soap->length = 0; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return SOAP_EOF; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP status: %s\n", soap->msgbuf)); - for (;;) - { if (soap_getline(soap, header, SOAP_HDRLEN)) - return SOAP_EOF; - if (!*header) - break; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP header: %s\n", header)); - s = strchr(header, ':'); - if (s) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - if ((soap->error = soap->fparsehdr(soap, header, s))) - return soap->error; - } - } - if ((s = strchr(soap->msgbuf, ' '))) - k = (unsigned short)soap_strtoul(s, NULL, 10); - else - k = 0; - } while (k == 100); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Finished HTTP header parsing\n")); - 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 (s && (((g = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!g); - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!g), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (g) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - return SOAP_OK; - } - if (k == 0 || (k >= 200 && k <= 299) || k == 400 || k == 500) - return SOAP_OK; - return soap_set_receiver_error(soap, "HTTP error", soap->msgbuf, k); -} -#endif - -/******************************************************************************/ -#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'; - } - else if (!soap_tag_cmp(key, "Content-Type")) - { if (!soap_tag_cmp(val, "*application/dime*")) - soap->mode |= SOAP_ENC_DIME; - } - 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_tag_cmp(val, "*gzip*")) - soap->zlib_out = SOAP_ZLIB_GZIP; - else -#endif - if (strchr(val, '*') || !soap_tag_cmp(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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked*")) - soap->mode |= 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 *")) - { size_t 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); - } - } - } -#endif - else if (!soap_tag_cmp(key, "SOAPAction")) - { if (val[0] && val[1]) - { soap->action = soap_strdup(soap, val + 1); - soap->action[strlen(soap->action) - 1] = '\0'; - } - } -/* [ Deal with .NET bug (invalid XML id-ref) */ - else if (!soap_tag_cmp(key, "Server")) - { if (!soap_tag_cmp(val, "Microsoft-IIS*")) - soap->dot_net_bug = 1; - } - else if (!soap_tag_cmp(key, "User-Agent")) - { if (!soap_tag_cmp(val, "*.NET CLR*") || !soap_tag_cmp(val, "*MS Web Services Client Protocol*")) - soap->dot_net_bug = 1; - } -/* ] */ -#ifdef WITH_COOKIES - else if (!soap_tag_cmp(key, "Cookie") || !soap_tag_cmp(key, "Set-Cookie")) - soap_getcookies(soap, val); -#endif - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_envelope_begin_out(struct soap *soap) -{ 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; - soap->part = SOAP_END_ENVELOPE; -#ifndef WITH_LEANER - if (!(soap->mode & SOAP_IO_LENGTH) && (soap->mode & SOAP_ENC_DIME)) - return soap_send_raw(soap, SOAP_STR_PADDING, -(long)soap->count&3); -#endif - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_envelope_begin_in(struct soap *soap) -{ soap->part = SOAP_IN_ENVELOPE; - if (soap_element_begin_in(soap, "SOAP-ENV:Envelope")) - return soap->error = SOAP_VERSIONMISMATCH; - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_envelope_end_in(struct soap *soap) -{ if (soap_element_end_in(soap, "SOAP-ENV:Envelope")) - return soap->error; - soap->part = SOAP_END_ENVELOPE; - return SOAP_OK; -} -#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; - if (soap_element(soap, "SOAP-ENV:Body", 0, NULL)) - return soap->error; - if (soap_attribute(soap, "id", "_0")) - 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_IN_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; - return soap_element_begin_in(soap, "SOAP-ENV:Body"); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_body_end_in(struct soap *soap) -{ if (soap_element_end_in(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_recv_header(struct soap *soap) -{ if (soap_getheader(soap) && soap->error == SOAP_TAG_MISMATCH) - soap->error = SOAP_OK; - 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'; - *soap->host = '\0'; - *soap->path = '\0'; - soap->port = 80; - if (!endpoint || !*endpoint) - return; -#ifdef WITH_OPENSSL - if (!strncmp(endpoint, "https:", 6)) - soap->port = 443; -#endif - strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); - 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; -/* WR[ */ -#ifdef WITH_IPV6 - if ('[' == s[0]) - { - s++; - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (']' == s[i]) - { - s++; - break; - } - } - } - else - { - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (s[i] == '/' || s[i] == ':') - break; - } - } -#else /* WITH_IPV6 */ -/* ]WR */ - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (s[i] == '/' || s[i] == ':') - break; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - soap->host[i] = '\0'; - if (s[i] == ':') - { soap->port = (int)atol(s + i + 1); - for (i++; i < n; i++) - if (s[i] == '/') - break; - } - if (s[i]) - { strncpy(soap->path, s + i + 1, 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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - soap_set_endpoint(soap, endpoint); - if (action) - soap->action = soap_strdup(soap, action); - if (soap->fconnect) - { - if ((soap->error = soap->fconnect(soap, endpoint, soap->host, soap->port))) - return soap->error; - } - else if (*soap->host) - { soap->status = http_command; - if (!soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port) - { soap->keep_alive = 0; /* force close */ - soap_closesock(soap); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); - 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); - } - else if (!soap->keep_alive || soap_poll(soap)) - { soap->keep_alive = 0; /* force close */ - soap_closesock(soap); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); - soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); - if (soap->error) - return soap->error; - } - } - count = soap_begin_dime(soap); - if (soap_begin_send(soap)) - return soap->error; - 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; - if ((k & SOAP_IO) == SOAP_IO_CHUNK) - { if (soap_flush(soap)) - return soap->error; - } - soap->mode = k; - } - if (http_command != SOAP_POST) - return soap_end_send(soap); -#ifndef WITH_LEANER - if (soap->mode & SOAP_ENC_DIME) - return soap_putdimehdr(soap); -#endif - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2base64(struct soap *soap, const unsigned char *s, char *t, size_t n) -{ register size_t i; - register unsigned long m; - if (!t) - return SOAP_EOM; - t[0] = '\0'; - if (!s) - return SOAP_OK; - for (; n > 2; n -= 3, s += 3) - { m = ((unsigned long)((unsigned char*)s)[0] << 16) | ((unsigned long)((unsigned char*)s)[1] << 8) | (unsigned long)((unsigned char*)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 SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_base642s(struct soap *soap, const char *s, char *t, size_t l, size_t *n) -{ register int i, j, c; - register unsigned long m; - char *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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } - *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 PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_puthttphdr(struct soap *soap, int status, size_t count) -{ const char *s; - if (status == SOAP_FILE) - s = soap->http_content; - else if (status == SOAP_HTML) - s = "text/html; charset=utf-8"; - else if (soap->mode & SOAP_ENC_DIME) - s = "application/dime"; - else if (soap->version == 2) - s = "application/soap+xml; charset=utf-8"; - else - s = "text/xml; charset=utf-8"; - soap->error = soap->fposthdr(soap, "Content-Type", s); - if (soap->error) - return soap->error; -#ifdef WITH_ZLIB - if (soap->omode & SOAP_ENC_ZLIB) -#ifdef WITH_GZIP - soap->error = soap->fposthdr(soap, "Content-Encoding", "gzip"); -#else - soap->error = soap->fposthdr(soap, "Content-Encoding", "deflate"); -#endif -#endif - if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK) - soap->error = soap->fposthdr(soap, "Transfer-Encoding", "chunked"); - else if (count > 0) - { sprintf(soap->tmpbuf, "%lu", (unsigned long)count); - soap->error = soap->fposthdr(soap, "Content-Length", soap->tmpbuf); - } - if (soap->error) - return soap->error; - return soap->error = soap->fposthdr(soap, "Connection", soap->keep_alive ? "keep-alive" : "close"); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -http_get(struct soap *soap) -{ return SOAP_GET_METHOD; -} -#endif - -/******************************************************************************/ -#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) -{ const char *s; - if (soap->status == SOAP_GET) - { s = "GET"; - count = 0; - } - else - s = "POST"; -#ifndef PALM - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6))) -#else - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) -#endif - return SOAP_OK; - if (soap->proxy_host) - sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); - else - sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, path, soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return soap->error; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((soap->error = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (soap->error = soap->fposthdr(soap, "User-Agent", "gSOAP/2.6")) - || (soap->error = soap_puthttphdr(soap, SOAP_OK, count))) - return soap->error; -#ifdef WITH_ZLIB -#ifdef WITH_GZIP - if ((soap->error = soap->fposthdr(soap, "Accept-Encoding", "gzip, deflate"))) -#else - if ((soap->error = soap->fposthdr(soap, "Accept-Encoding", "deflate"))) -#endif - return soap->error; -#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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Authorization", soap->tmpbuf))) - return soap->error; - } - 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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - return soap->error; - } -#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 (action) - { sprintf(soap->tmpbuf, "\"%s\"", action); - if ((soap->error = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf))) - return soap->error; - } - return soap->error = soap->fposthdr(soap, NULL, NULL); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -http_post_header(struct soap *soap, const char *key, const char *val) -{ if (key) - { if (soap_send(soap, key)) - return soap->error; - if (val && (soap_send(soap, ": ") || soap_send(soap, val))) - return soap->error; - } - return soap_send(soap, "\r\n"); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -http_response(struct soap *soap, int status, size_t count) -{ -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - { - httpOutputEnable(soap->rpmreqid); - } -#endif /* WMW_RPM_IO */ -/* ]WR */ - if (!status || status == SOAP_HTML || status == SOAP_FILE) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "OK 200\n")); -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ -#else -/* ]WR */ - if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ -/* WR[ */ -#endif /* WMW_RPM_IO */ -/* ]WR */ - { sprintf(soap->tmpbuf, "HTTP/%s 200 OK", soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return soap->error; - } - else if ((soap->error = soap->fposthdr(soap, "Status", "200 OK"))) - return soap->error; - } - else if (status > 200 && status < 600) - { sprintf(soap->tmpbuf, "HTTP/%s %d %s", soap->http_version, status, http_error(soap, status)); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return soap->error; - if (status == 401) - if ((soap->error = soap->fposthdr(soap, "WWW-Authenticate", "Basic realm=\"gSOAP Service\""))) - return soap->error; - } - else - { const char *s = *soap_faultcode(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Error\n")); - if (soap->version == 2 && !strcmp(s, "SOAP-ENV:Sender")) - s = "400 Bad Request"; - else - s = "500 Internal Server Error"; -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ -#else -/* ]WR */ - if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ -/* WR[ */ -#endif /* WMW_RPM_IO */ -/* ]WR */ - { sprintf(soap->tmpbuf, "HTTP/%s %s", soap->http_version, s); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return soap->error; - } - else if ((soap->error = soap->fposthdr(soap, "Status", s))) - return soap->error; - } - if ((soap->error = soap->fposthdr(soap, "Server", "gSOAP/2.6")) - || (soap->error = soap_puthttphdr(soap, status, count))) - return soap->error; -#ifdef WITH_COOKIES - if (soap_putsetcookies(soap)) - return soap->error; -#endif - return soap->error = soap->fposthdr(soap, NULL, NULL); -} -#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_IO; - soap->omode |= SOAP_IO_STORE; - } - soap->status = status; - count = soap_begin_dime(soap); - if (soap_begin_send(soap)) - return soap->error; - 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; - if ((n & SOAP_IO) == SOAP_IO_CHUNK) - { if (soap_flush(soap)) - return soap->error; - } - soap->mode = n; - } -#ifndef WITH_LEANER - if (soap->mode & SOAP_ENC_DIME) - return soap_putdimehdr(soap); -#endif - return SOAP_OK; -} -#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 (!*c) - { if (soap->version == 2) - *c = "SOAP-ENV:Sender"; - else - *c = "SOAP-ENV:Client"; - } - if (*s) - return; - switch (soap->error) - { case SOAP_CLI_FAULT: - *s = "Client fault"; - break; - case SOAP_SVR_FAULT: - *s = "Server fault"; - break; - case SOAP_TAG_MISMATCH: - sprintf(soap->msgbuf, "Tag mismatch: element '%s' does not correspond to expected element", soap->tag); - *s = soap->msgbuf; - break; - case SOAP_TYPE: - sprintf(soap->msgbuf, "Data type '%s' mismatch in element '%s'", soap->type, soap->tag); - *s = soap->msgbuf; - break; - case SOAP_SYNTAX_ERROR: - *s = "XML syntax error"; - break; - case SOAP_NO_TAG: - *s = "No XML element tag found"; - 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 = "SOAP version mismatch or invalid SOAP message"; - break; - case SOAP_DATAENCODINGUNKNOWN: - *c = "SOAP-ENV:DataEncodingUnknown"; - *s = "Unsupported SOAP data encoding"; - break; - case SOAP_DIME_MISMATCH: - *s = "DIME version mismatch"; - break; - case SOAP_NAMESPACE: - sprintf(soap->msgbuf, "Namespace URI mismatch in element '%s'", soap->tag); - *s = soap->msgbuf; - break; - case SOAP_OBJ_MISMATCH: - *s = "Object mismatch"; - break; - case SOAP_FATAL_ERROR: - *s = "Fatal error"; - break; - case SOAP_NO_METHOD: - sprintf(soap->msgbuf, "Method '%s' not implemented", soap->tag); - *s = soap->msgbuf; - break; - case SOAP_GET_METHOD: - *s = "HTTP GET method not implemented"; - break; - case SOAP_EOM: - *s = "Out of memory"; - break; - case SOAP_IOB: - *s = "Array index out of bounds"; - break; - case SOAP_NULL: - sprintf(soap->msgbuf, "Cannot create nilable object for type '%s' in element '%s'", soap->type, soap->tag); - *s = soap->msgbuf; - break; - case SOAP_MULTI_ID: - *s = "Non-unique id attribute"; - break; - case SOAP_MISSING_ID: - *s = "Missing id: referenced data is missing or had to be ignored"; - break; - case SOAP_HREF: - *s = "Invalid XML: object reference with href attribute is incompatible with actual object referred to"; - break; - case SOAP_FAULT: - break; - case SOAP_TCP_ERROR: - *s = tcp_error(soap); - break; - case SOAP_HTTP_ERROR: - *s = "HTTP error"; - break; - case SOAP_SSL_ERROR: - *s = "SSL error"; - break; - case SOAP_PLUGIN_ERROR: - *s = "Plugin registry error"; - break; - case SOAP_DIME_ERROR: - *s = "DIME error"; - break; - case SOAP_ZLIB_ERROR: -#ifdef WITH_ZLIB - sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream.msg?soap->d_stream.msg:""); - *s = soap->msgbuf; -#else - *s = "Zlib not installed for required message (de)compression"; -#endif - break; - case SOAP_EOD: - *s = "End of DIME error"; - break; - case SOAP_REQUIRED: - *s = "Validation failure: XML attribute required"; - break; - case SOAP_OCCURS: - *s = "Validation failure: XML element occurs count"; - break; - case SOAP_EOF: - sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); - *s = soap->msgbuf; - break; - default: - if (soap->error > 200 && soap->error < 600) - { sprintf(soap->msgbuf, "HTTP Error: '%s'", http_error(soap, soap->error)); - *s = soap->msgbuf; - } - else - *s = "Unknown error code"; - } -} -#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)) && soap_poll(soap) == SOAP_OK) - { 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); - } - 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_closesock(soap); - return soap->error = status; -} -#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 PALM_1 -static const char* -soap_strerror(struct soap *soap) -{ int err = soap->errnum; - if (!err) - err = soap_errno; - if (err) - { -#ifndef UNDER_CE - return strerror(err); -#else - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)&soap->werrorstr, 256, NULL); - wcstombs(soap->errorstr, soap->werrorstr, 256); - return soap->errorstr; -#endif - } - return "Operation interrupted or timed out"; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -soap_set_error(struct soap *soap, const char *faultcode, const char *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - return soap->error = soaperror; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_sender_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultstring, const char *faultdetail) -{ char *s = NULL, *t = NULL; - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - return soap_set_error(soap, faultcode, s, t, SOAP_FAULT); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault(struct soap *soap, FILE *fd) -{ if (soap->error) - { const char **s; - if (!*soap_faultcode(soap)) - soap_set_fault(soap); - fprintf(fd, "SOAP FAULT: %s\n\"%s\"\n", *soap_faultcode(soap), *soap_faultstring(soap)); - s = soap_faultdetail(soap); - if (s && *s) - fprintf(fd, "Detail: %s\n", *s); - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault_location(struct soap *soap, FILE *fd) -{ -#ifndef WITH_LEAN - int c; - if (soap->error && soap->buflen > 0) - { if (soap->bufidx == 0) - soap->bufidx = 1; - c = soap->buf[soap->bufidx - 1]; - soap->buf[soap->bufidx - 1] = '\0'; - soap->buf[soap->buflen - 1] = '\0'; - if (soap->bufidx < soap->buflen) - fprintf(fd, "%s%c\n** HERE **\n%s\n", soap->buf, c, soap->buf + soap->bufidx); - else - fprintf(fd, "%s%c\n** HERE **\n", soap->buf, c); - } -#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(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(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_1 -SOAP_FMAC1 -void * -SOAP_FMAC2 -soap_lookup_plugin(struct soap *soap, const char *id) -{ return soap->fplugin(soap, id); -} -#endif - -/******************************************************************************/ -#ifdef __cplusplus -} -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.h deleted file mode 100644 index 15a47fa..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.6.2.h +++ /dev/null @@ -1,1647 +0,0 @@ -/* - -stdsoap2.h 2.6.2 - -Runtime environment. - -gSOAP XML Web services tools -Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc. All Rights Reserved. - -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]) : - - vxWorks compatible - - Support for IPv6. - --------------------------------------------------------------------------------- -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-2004 Robert A. 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 --------------------------------------------------------------------------------- -*/ - -#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_BEGIN_NAMESPACE -# define SOAP_BEGIN_NAMESPACE(name) -#endif - -#ifndef SOAP_END_NAMESPACE -# define SOAP_END_NAMESPACE(name) -#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_FMAC4 /* (de)serializer declaration macro */ -# define 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 - -#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 - -/* WR[ */ -#if (defined(__vxworks) || defined(__VXWORKS__)) -# define VXWORKS -#endif -/* ]WR */ - -#ifdef _WIN32 -# ifndef WIN32 -# define WIN32 -# 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 -#endif - -#ifdef __palmos__ -# define PALM -#endif - -#ifdef PALM_GCC -# define PALM -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -#else -# if defined(UNDER_CE) -# define WITH_LEAN -# elif defined(WIN32) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_SYS_TIMEB_H -# define HAVE_FTIME -# define HAVE_WCTOMB -# define HAVE_MBTOWC -# elif defined(CYGWIN) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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_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(_AIXVERSION_431) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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(HP_UX) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_GETTIMEOFDAY -# define HAVE_RAND_R -# define HAVE_GMTIME_R -# define HAVE_LOCALTIME_R -# define HAVE_WCTOMB -# define HAVE_MBTOWC -# elif defined(__VMS) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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__) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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_TIMEGM -# define HAVE_WCTOMB -# define HAVE_MBTOWC -# elif defined(TRU64) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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 HAVE_WCTOMB -# define HAVE_MBTOWC -# elif defined(MAC_CARBON) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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 HAVE_STRTOD /* strtod() is defined in palmmissing.h */ -# ifndef CONST2 -# define CONST2 -# endif -# define WITH_LEAN -# define WITH_NONAMESPACES -# define _LINUX_CTYPE_H -# include - typedef WChar wchar_t; -# define IGNORE_STDIO_STUBS - typedef Int32 time_t; -# define tm HostTmType -# define strftime HostStrFTime -# define mktime HostMkTime -# define localtime HostLocalTime -# define tm_year tm_year_ -# define tm_hour tm_hour_ -# define tm_mon tm_mon_ -# define tm_min tm_min_ -# define tm_sec tm_sec_ -# define tm_mday tm_mday_ -# define tm_isdst tm_isdst_ -# include -# define O_NONBLOCK FNONBIO -# include -# if 1 - void displayText(char *text); -# define pdebug(s) displayText(s) -# define pdebugV(s,p) sprintf(buff,s,p); displayText(buff) -# else -# define pdebug(s) WinDrawChars(s,strlen(s),10,10) -# define pdebugV(s,p) sprintf(buff,s,p); WinDrawChars(buff,strlen(buff),10,10) -# endif -# include "palmmissing.h" -# include "slib_socket.h" -# elif defined(SYMBIAN) -# define WITH_LEAN -# define WITH_NONAMESPACES -# define CONST2 const -# undef SOAP_FMAC1 -# define SOAP_FMAC1 EXPORT_C -# ifdef __cplusplus -# include -# else -# define TInt64 long -# endif -/* WR[ */ -# elif defined(VXWORKS) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_RAND_R -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# define HAVE_MKTIME -/* ]WR */ -# else -/* Default asumptions on supported functions */ -# define HAVE_STRRCHR -# define HAVE_STRTOD -# 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 - -#if defined(TRU64) -# define SOAP_LONG_FORMAT "%ld" -# define SOAP_ULONG_FORMAT "%lu" -#elif defined(WIN32) -# define SOAP_LONG_FORMAT "%I64d" -# define SOAP_ULONG_FORMAT "%I64u" -#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 - -#ifndef SOAP_MALLOC /* use libc malloc */ -# define SOAP_MALLOC(n) malloc(n) -#endif - -#ifndef SOAP_FREE /* use libc free */ -# define SOAP_FREE(p) free(p) -#endif - -#include - -#ifndef PALM -# include -#endif - -#ifndef PALM_GCC -# include -#endif - -#include /* for tolower() */ -#include - -#if defined(__cplusplus) && !defined(UNDER_CE) -# include -# include - using namespace std; -#endif - -#ifndef UNDER_CE -# ifndef PALM -# include -# ifndef MAC_CARBON -# 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 MAC_CARBON -# ifndef WIN32 -# ifndef PALM -# include -/* WR[ */ -# ifdef VXWORKS -# include -# endif -# ifndef VXWORKS -/* ]WR */ -# ifndef SYMBIAN -# include -# endif -/* WR[ */ -# endif -/* ]WR */ -# ifdef SUN_OS -# include /* SUN */ -# include /* SUN < 2.8 (?) */ -# endif -/* WR[ */ -# ifdef VXWORKS -# include -# else -/* ]WR */ -# include -/* WR[ */ -# endif -/* ]WR */ -# include -# include /* TCP_NODELAY */ -# include -# endif -# endif -#endif - -#ifdef WITH_FASTCGI -# include -#endif - -#ifdef WITH_OPENSSL -# define OPENSSL_NO_KRB5 -# 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 PALM_GCC -# include /* for isnan() */ -#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 - -#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++]) -#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)->mode = (soap)->imode |= (n)) -#define soap_clr_imode(soap, n) ((soap)->mode = (soap)->imode &= ~(n)) -#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) -#define soap_set_omode(soap, n) ((soap)->mode = (soap)->omode |= (n)) -#define soap_clr_omode(soap, n) ((soap)->mode = (soap)->omode &= ~(n)) -#define soap_destroy(soap) soap_delete((soap), NULL) - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -/* WR[ */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -/* ]WR */ -# ifndef MAC_CARBON -# ifndef PALM -# include -# include -# endif -# include -# include -# endif -#endif - -#ifdef WIN32 -# define SOAP_SOCKET SOCKET -#else -# define SOAP_SOCKET int -# define closesocket(n) close(n) -#endif - -#define soap_valid_socket(n) ((n) >= 0) -#define SOAP_INVALID_SOCKET (-1) - -/* WR[ */ -#ifdef VXWORKS -# ifdef __INCmathh -# define _MATH_H -# include -# define isnan(num) isNan(num) -# endif -#endif - -#ifdef WIN32 -# define _MATH_H -# include -# define isnan(num) _isnan(num) -#endif -/* ]WR */ - -#if (!defined(_MATH_H) && !defined(_MATH_INCLUDED)) -# ifndef isnan -# define isnan(_) (0) -# endif -#endif - -extern const struct soap_double_nan { unsigned int n1, n2; } soap_double_nan; - -#if defined(SYMBIAN) -# define LONG64 TInt64 -# define ULONG64 TInt64 -#elif !defined(WIN32) -# define LONG64 long long -# define ULONG64 unsigned LONG64 -#elif defined(UNDER_CE) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#elif defined(__BORLANDC__) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#endif - -#ifdef WIN32 -# define SOAP_EINTR WSAEINTR -# define SOAP_EAGAIN WSAEWOULDBLOCK -# define SOAP_EWOULDBLOCK WSAEWOULDBLOCK -# define SOAP_EINPROGRESS WSAEINPROGRESS -#else -# define SOAP_EINTR EINTR -# define SOAP_EAGAIN EAGAIN -# 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 GetLastError() -# else -# define soap_errno GetLastError() -# define soap_socket_errno WSAGetLastError() -# endif -#else -# define soap_errno errno -# define soap_socket_errno errno -#endif - -#ifndef SOAP_BUFLEN -# ifndef WITH_LEAN -# define SOAP_BUFLEN (32768) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -#endif -#ifndef SOAP_LABLEN -# ifndef WITH_LEAN -# define SOAP_LABLEN (256) /* initial look-aside buffer length */ -# else -# define SOAP_LABLEN (64) -# endif -#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 (16) -# endif -#endif -#ifndef SOAP_IDHASH -# ifndef WITH_LEAN -# define SOAP_IDHASH (256) /* size of hash table for receiving id/href's */ -# else -# define SOAP_IDHASH (16) -# endif -#endif -#ifndef SOAP_BLKLEN -# define SOAP_BLKLEN (256) /* size of blocks to collect long strings and XML attributes */ -#endif -#ifndef SOAP_TAGLEN -# define SOAP_TAGLEN (256) /* maximum length of XML element tag/attribute name + 1 */ -#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 -# define SOAP_MAXDIMS (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */ -#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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#endif - -/* WR[ */ -#ifdef VXWORKS -# ifndef FLT_MAX -# define FLT_MAX _ARCH_FLT_MAX -# endif -# ifndef DBL_MAX -# define DBL_MAX _ARCH_DBL_MAX -# endif -#endif -/* ]WR */ - -#ifndef FLT_NAN -# if (defined(_MATH_H) || defined(_MATH_INCLUDED)) -# define FLT_NAN (*(float*)&soap_double_nan) -# else -# define FLT_NAN (0.0) -# endif -#endif - -#ifndef FLT_PINFTY -# ifdef FLT_MAX -# define FLT_PINFTY FLT_MAX -# else -# ifdef HUGE_VAL -# define FLT_PINFTY (float)HUGE_VAL -# else -# ifdef FLOAT_MAX -# define FLT_PINFTY FLOAT_MAX -# else -# define FLT_PINFTY (3.40282347e+38) -# endif -# endif -# endif -#endif - -#ifndef FLT_NINFTY -# define FLT_NINFTY (-FLT_PINFTY) -#endif - -#ifndef DBL_NAN -# if (defined(_MATH_H) || defined(_MATH_INCLUDED)) -# define DBL_NAN (*(double*)&soap_double_nan) -# else -# define DBL_NAN (0.0) -# endif -#endif -#ifndef DBL_PINFTY -# ifdef DBL_MAX -# define DBL_PINFTY DBL_MAX -# else -# ifdef HUGE_VAL -# define DBL_PINFTY (double)HUGE_VAL -# else -# ifdef DOUBLE_MAX -# define DBL_PINFTY DOUBLE_MAX -# else -# define DBL_PINFTY (1.7976931348623157e+308) -# endif -# endif -# endif -#endif - -#ifndef DBL_NINFTY -# define DBL_NINFTY (-DBL_PINFTY) -#endif - -/* 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_OBJ_MISMATCH 10 -#define SOAP_FATAL_ERROR 11 -#define SOAP_FAULT 12 -#define SOAP_NO_METHOD 13 -#define SOAP_GET_METHOD 14 -#define SOAP_EOM 15 -#define SOAP_NULL 16 -#define SOAP_MULTI_ID 17 -#define SOAP_MISSING_ID 18 -#define SOAP_HREF 19 -#define SOAP_TCP_ERROR 20 -#define SOAP_HTTP_ERROR 21 -#define SOAP_SSL_ERROR 22 -#define SOAP_ZLIB_ERROR 23 -#define SOAP_DIME_ERROR 24 -#define SOAP_EOD 25 -#define SOAP_VERSIONMISMATCH 26 -#define SOAP_DIME_MISMATCH 27 -#define SOAP_PLUGIN_ERROR 28 -#define SOAP_DATAENCODINGUNKNOWN 29 -#define SOAP_REQUIRED 30 -#define SOAP_OCCURS 31 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_MULTI_ID || (e) == SOAP_MISSING_ID || (e) == SOAP_REQUIRED || (e) == SOAP_OCCURS) -#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 || (e) == SOAP_OBJ_MISMATCH || (e) == SOAP_NULL) -#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_dime_error_check(e) ((e) == SOAP_DIME_ERROR || (e) == SOAP_DIME_MISMATCH) -#define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || (e) == SOAP_GET_METHOD || ((e) >= 100 && (e) < 600)) - -/* gSOAP HTTP response status codes 100 to 600 are reserved */ - -/* Special gSOAP HTTP response status codes */ - -#define SOAP_STOP 1000 /* No HTTP response */ -#define SOAP_HTML 1001 /* Custom HTML response */ -#define SOAP_FILE 1002 /* Custom file-based response */ - -/* gSOAP HTTP request status codes */ - -#define SOAP_POST 1003 -#define SOAP_GET 1104 - -/* 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 */ - -#define SOAP_IO 0x000003 -#define SOAP_IO_FLUSH 0x000000 /* flush output immediately, no buffering */ -#define SOAP_IO_BUFFER 0x000001 /* buffer output in packets of size SOAP_BUFLEN */ -#define SOAP_IO_STORE 0x000002 /* store entire output to determine length for transport */ -#define SOAP_IO_CHUNK 0x000003 /* use HTTP chunked transfer AND buffer packets */ - -#define SOAP_IO_LENGTH 0x000004 -#define SOAP_IO_KEEPALIVE 0x000008 - -#define SOAP_ENC_XML 0x000010 /* plain XML encoding, no HTTP header */ -#define SOAP_ENC_DIME 0x000020 -#define SOAP_ENC_ZLIB 0x000040 -#define SOAP_ENC_SSL 0x000080 - -#define SOAP_XML_STRICT 0x000100 /* input mode flag */ -#define SOAP_XML_CANONICAL 0x000200 /* output mode flag */ -#define SOAP_XML_TREE 0x000400 -#define SOAP_XML_GRAPH 0x000800 -#define SOAP_XML_NIL 0x001000 -#define SOAP_XML_DOM 0x002000 - -#define SOAP_C_NOIOB 0x010000 -#define SOAP_C_UTFSTRING 0x020000 -#define SOAP_C_MBSTRING 0x040000 -#define SOAP_C_LATIN 0x080000 - -#define SOAP_DOM_TREE 0x100000 -#define SOAP_DOM_NODE 0x200000 - -#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_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION - -/* */ - -#define SOAP_BEGIN 0 -#define SOAP_IN_ENVELOPE 2 -#define SOAP_IN_HEADER 3 -#define SOAP_END_HEADER 4 -#define SOAP_IN_BODY 5 -#define SOAP_END_BODY 6 -#define SOAP_END_ENVELOPE 7 -#define SOAP_END 8 - -/* DEBUG macros */ - -#ifndef WITH_LEAN -# ifdef DEBUG -# ifndef SOAP_DEBUG -# define SOAP_DEBUG -# endif -# endif -#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(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(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 -#else -# define DBGLOG(DBGFILE, CMD) -# define DBGMSG(DBGFILE, MSG, LEN) -#endif - -typedef long wchar; /* 32 bit, for compatibility */ - -struct Namespace -{ const char *id; - const char *ns; - const char *in; - char *out; -}; - -struct soap_nlist -{ struct soap_nlist *next; - unsigned int 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 overflows into allocated region below this struct */ -}; - -struct soap_blist -{ struct soap_blist *next; - char *ptr; - size_t size; -}; - -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; -}; - -/* class allocation list */ -struct soap_clist -{ struct soap_clist *next; - void *ptr; - int type; - int size; - void (*fdelete)(struct soap_clist*); -}; - -/* 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 overflows into allocated region below this struct */ -}; - -struct soap_attribute -{ struct soap_attribute *next; - short visible; - char *value; - size_t size; - char *ns; - char name[1]; /* the actual name string overflows into allocated region below this struct */ -}; - -struct soap_cookie -{ struct soap_cookie *next; - char *name; - char *value; - char *domain; - char *path; - long expire; /* client-side: local time to expire; server-side: seconds to expire */ - unsigned int version; - short secure; - short session; /* server-side */ - short env; /* server-side: got cookie from client */ - short modified; /* server-side: client cookie was modified */ -}; - -struct soap_dom_attribute -{ struct soap_dom_attribute *next; - const char *nstr; - char *name; - char *data; - wchar_t *wide; - struct soap *soap; -#ifdef __cplusplus - 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 - 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 -}; - -#ifdef __cplusplus -class soap_dom_iterator -{ public: - struct soap_dom_element *elt; - const char *nstr; - const char *name; - int type; - bool operator==(const soap_dom_iterator&) const; - bool operator!=(const soap_dom_iterator&) const; - struct soap_dom_element &operator*() const; - soap_dom_iterator &operator++(); - soap_dom_iterator(); - soap_dom_iterator(struct soap_dom_element*); - ~soap_dom_iterator(); -}; -#endif - -struct soap_dom_element -{ struct soap_dom_element *next; /* next sibling */ - struct soap_dom_element *prnt; /* parent */ - struct soap_dom_element *elts; /* first child element */ - struct soap_dom_attribute *atts; /* first child attribute */ - 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 */ - struct soap *soap; -#ifdef __cplusplus - typedef soap_dom_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_iterator begin(); - soap_dom_iterator end(); - soap_dom_iterator find(const char *nstr, const char *name); - soap_dom_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 -}; - -#if defined(__cplusplus) && !defined(UNDER_CE) -} -extern ostream &operator<<(ostream&, const struct soap_dom_element&); -extern istream &operator>>(istream&, struct soap_dom_element&); -extern "C" { -#endif - -struct soap -{ short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ - unsigned int mode; - unsigned int imode; - unsigned int omode; - short copy; /* 1 = copy of another soap struct */ - const char *float_format; /* points to user-definable format string for floats (<1024 chars) */ - const char *double_format; /* points to user-definable format string for doubles (<1024 chars) */ - const char *dime_id_format; /* points to 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 */ - 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 list */ - struct soap_ilist *iht[SOAP_IDHASH]; - struct soap_plist *pht[SOAP_PTRHASH]; - struct SOAP_ENV__Header *header; - struct SOAP_ENV__Fault *fault; - 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 (*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 (*fconnect)(struct soap*, const char*, const char*, int); - int (*fdisconnect)(struct soap*); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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 (*fprepare)(struct soap*, const char*, size_t); - int (*fignore)(struct soap*, const char*); - void *(*fplugin)(struct soap*, const char*); - 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); - int master; - int socket; -#if defined(__cplusplus) && !defined(UNDER_CE) - ostream *os; - istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#endif -#ifndef UNDER_CE - int sendfd; - int recvfd; -#else - FILE *sendfd; - FILE *recvfd; - char errorstr[256]; - wchar_t werrorstr[256]; -#endif - size_t bufidx; - size_t buflen; - wchar ahead; - short cdata; - short body; - unsigned int 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]; /* output buffer for (error) messages <=1024 bytes */ - char tmpbuf[1024]; /* output buffer for HTTP headers, simpleType values, attribute names, and DIME >=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 root; - short position; - int positions[SOAP_MAXDIMS]; - struct soap_attribute *attributes; /* attribute list */ - short encoding; - short mustUnderstand; - short null; - short ns; - short part; - short alloced; - short peeked; - short dot_net_bug; - short keep_alive; - size_t chunksize; - size_t chunkbuflen; - char endpoint[SOAP_TAGLEN]; - char path[SOAP_TAGLEN]; - char host[SOAP_TAGLEN]; - char *action; - int port; - unsigned int max_keep_alive; - 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 */ - int status; /* -1 when request, else error code to be returned by server */ - int error; - int errmode; - int errnum; - unsigned long idnum; - unsigned long ip; - size_t dime_count; - int dime_flags; - size_t dime_size; - size_t dime_chunksize; - size_t dime_buflen; - char *dime_ptr; - char *dime_id; - char *dime_type; - char *dime_options; - struct soap_dom_element *dom; -#ifndef WITH_LEAN - const char *logfile[SOAP_MAXLOGS]; - FILE *fdebug[SOAP_MAXLOGS]; - struct soap_cookie *cookies; - const char *cookie_domain; - const char *cookie_path; - int cookie_max; -#endif -#ifdef WITH_OPENSSL - int (*fsslauth)(struct soap*); - int (*fsslverify)(int, X509_STORE_CTX*); - BIO *bio; - SSL *ssl; - SSL_CTX *ctx; - short require_server_auth; - short require_client_auth; - short rsa; /* when set, use RSA instead of DH */ - const char *keyfile; - const char *password; - const char *dhfile; - const char *cafile; - const char *capath; - const char *randfile; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - unsigned long z_crc; /* internal gzip crc */ - 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 */ -#endif -#ifdef PALM - UInt16 stdLibNum; - UInt16 stdLib2Num; - UInt16 stdLib3Num; - UInt16 genLibNum; - Err fH_errno; - Err fErrno; - Int32 timeout; - NetHostInfoBufType hostInfo; - UInt16 socketLibNum; -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - void *rpmreqid; -#endif /* WMW_RPM_IO */ -/* ]WR */ -}; - -struct soap_code_map -{ long code; - const char *string; -}; - -/* forwarding list for container elements */ -struct soap_flist -{ struct soap_flist *next; - int type; - void *ptr; - unsigned int level; - void (*finsert)(struct soap*, int, void*, void*); -}; - -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 - -#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 - -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_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 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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_accept(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); - -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 int 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 wchar SOAP_FMAC2 soap_get(struct soap*); -SOAP_FMAC1 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_receiver_fault(struct soap*, 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_send(struct soap*, const char*); -SOAP_FMAC1 int SOAP_FMAC2 soap_recv(struct soap*); - -SOAP_FMAC1 int SOAP_FMAC2 soap_pututf8(struct soap*, unsigned long); -SOAP_FMAC1 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*); - - -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 void SOAP_FMAC2 soap_resolve_ptr(struct soap_ilist*); -SOAP_FMAC1 int SOAP_FMAC2 soap_resolve(struct soap*); - -SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_lookup(struct soap*, const void *p, 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_pointer_lookup_id(struct soap*, void *p, int t, struct soap_plist**); -SOAP_FMAC1 int SOAP_FMAC2 soap_pointer_enter(struct soap*, const void *p, int t, struct soap_plist**); -SOAP_FMAC1 int SOAP_FMAC2 soap_array_pointer_enter(struct soap*, const void *p, const struct soap_array *a, int t, struct soap_plist**); - -SOAP_FMAC1 int SOAP_FMAC2 soap_embed_element(struct soap *soap, const void *p, const char *tag, int type); -SOAP_FMAC1 int SOAP_FMAC2 soap_embed_array(struct soap *soap, const void *p, const struct soap_array *a, int n, const char *tag, int type); - -SOAP_FMAC1 void SOAP_FMAC2 soap_begin_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 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 int SOAP_FMAC2 soap_is_multi(struct soap*, struct soap_plist*); -SOAP_FMAC1 void SOAP_FMAC2 soap_set_embedded(struct soap*, struct soap_plist*); - -SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char *str); -SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code); - -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, void (*fdelete)(struct soap_clist*)); -SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); -SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); - -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, int t, size_t n); -SOAP_FMAC1 void* SOAP_FMAC2 soap_id_enter(struct soap*, const char *id, void *p, int t, size_t n, int k); - -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(int); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(int, int); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*,struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, int, int); -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*); - -#ifndef WITH_LEAN -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 char* SOAP_FMAC2 soap_value(struct soap*); - -SOAP_FMAC1 wchar SOAP_FMAC2 soap_advance(struct soap*); -SOAP_FMAC1 wchar SOAP_FMAC2 soap_skip(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 *href); -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_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); - -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 int SOAP_FMAC2 soap_string_out(struct soap*, const char *s, int flag); -SOAP_FMAC1 char* SOAP_FMAC2 soap_string_in(struct soap*, int); -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); - -SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, int n1, int n2); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_default_namespace(struct soap*); - -SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, struct Namespace*); - -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 int SOAP_FMAC2 soap_push_default_namespace(struct soap*, const char *, int); - -SOAP_FMAC1 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_store_block(struct soap*, char*); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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_fault(struct soap*); - -SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*); - -SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*); -SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*); - -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_s2dateTime(struct soap*, const char*, time_t*); -SOAP_FMAC1 int SOAP_FMAC2 soap_s2string(struct soap*, const char*, char**); -SOAP_FMAC1 int SOAP_FMAC2 soap_s2QName(struct soap*, const char*, char**); -SOAP_FMAC1 int SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, size_t); - -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_dateTime2s(struct soap*, time_t); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, size_t*); - -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 time_t* SOAP_FMAC2 soap_indateTime(struct soap*, const char *tag, time_t *p, const char *, int); -SOAP_FMAC1 char** SOAP_FMAC2 soap_instring(struct soap*, const char *tag, char **p, const char *, int, int); -SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwstring(struct soap*, const char *tag, wchar_t **p, const char *, int); -SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p); -SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwliteral(struct soap*, const char *tag, wchar_t **p); - -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_outdateTime(struct soap*, const char *tag, int id, const time_t *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_outwstring(struct soap*, const char *tag, int id, wchar_t *const*p, const char *, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap*, const char *tag, char *const*p); -SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p); - -#ifndef WITH_LEANER -SOAP_FMAC1 void SOAP_FMAC2 soap_set_attached(struct soap*, struct soap_plist*, const char*, const char*, const char*, size_t); -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*, int, char*, char*, char*, void*, size_t); -#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 struct soap_attribute * SOAP_FMAC2 soap_attr(struct soap *soap, const char *name); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_attr_value(struct soap *soap, const char *name); -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 int SOAP_FMAC2 soap_encode_cookie(const char*, char*, int); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_decode_cookie(char*, int, const char*); -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 long 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*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#if defined(PALM) && !defined(NOSHAREDLIB) && !(defined(BUILDING_STDSOAP) || defined(BUILDING_STDSOAP2) || defined(BUILDING_STDLIB) || defined(BUILDING_STDLIB2) || defined(PALM_1) || defined(PALM_2)) -# include "palmSharedLib.h" -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.c deleted file mode 100644 index fab9eee..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.c +++ /dev/null @@ -1,11692 +0,0 @@ -/* - -stdsoap2.c[pp] 2.7.0d - -Runtime environment. - -gSOAP XML Web services tools -Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved. - -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - vxWorks compatible - - Support for IPv6. - --------------------------------------------------------------------------------- -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-2004, 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 --------------------------------------------------------------------------------- - -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. - -*/ - -#include "stdsoap2.h" - -#ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.0c 2004-09-27 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.0c 2004-09-27 12:00:00 GMT") -#endif - -/* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale) */ -#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) -#define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) - -static int soap_isxdigit(int); -static soap_wchar soap_char(struct soap*); -static soap_wchar soap_getchunkchar(struct soap*); -static void soap_update_ptrs(struct soap*, char*, char*, long); -static int soap_has_copies(struct soap*, const char*, const char*); -static struct soap_ilist *soap_hlookup(struct soap*, 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*); -static int soap_set_error(struct soap*, const char*, const char*, const char*, int); -static const char *soap_set_validation_fault(struct soap*, const char*, const char*); -static int soap_copy_fault(struct soap*, const char*, const char*, const char*); -static int soap_getattrval(struct soap*, char*, size_t, soap_wchar); -static void soap_set_local_namespaces(struct soap*); -static int soap_isnumeric(struct soap*, const char*); -static void *fplugin(struct soap*, const char*); -static const char *soap_decode(char*, size_t, const char*, const char*); - -#ifndef WITH_LEAN -static time_t soap_timegm(struct tm*); -#endif - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -static void soap_close_logfile(struct soap*, int); -static void soap_set_logfile(struct soap*, int, const char*); -#endif - -#ifdef WITH_FAST -static int soap_append_lab(struct soap*, const char*, size_t); -#endif - -#ifndef WITH_LEANER -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*); -#endif - -#ifdef WITH_GZIP -static int soap_getgziphdr(struct soap*); -#endif - -#ifdef WITH_OPENSSL -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -static const char *ssl_error(struct soap*, int); -/* This callback is included for future references. It should not be deleted -static DH *ssl_tmp_dh(SSL*, int, int); -*/ -#endif - -static const char *soap_strerror(struct soap*); -static const char *tcp_error(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_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*); -#ifndef MAC_CARBON -static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr); -static int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); -static int tcp_accept(struct soap*, int, 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 int fsend(struct soap*, const char*, size_t); -static size_t frecv(struct soap*, char*, size_t); -#endif - -/* WR[ */ -#ifdef VXWORKS -static int vx_nonblocking = TRUE; /* ioctl argument */ -#endif -/* ]WR */ - -#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 - -static const char soap_padding[3] = "\0\0"; -#define SOAP_STR_PADDING (soap_padding) -#define SOAP_STR_EOS (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_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 - -#ifndef WITH_LEAN -static const struct soap_code_map h_http_error_codes[] = -{ { 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 - -#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 - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -fsend(struct soap *soap, const char *s, size_t n) -{ register int nwritten; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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)soap->socket, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return SOAP_EOF; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else -#endif -#ifndef PALM - nwritten = send((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { -#ifdef WITH_OPENSSL - int err; - if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return SOAP_EOF; -#endif - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EWOULDBLOCK && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - 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 -/* WR[ */ -#ifdef VXWORKS -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - { - httpBlockPut(soap->rpmreqid, s, n); - nwritten = n; - } - else - { - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); - } -#else - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); -#endif /* WMW_RPM_IO */ -#else -/* ]WR */ - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -/* WR[ */ -#endif -/* ]WR */ -#endif -#endif - if (nwritten <= 0) - { if (soap_errno != SOAP_EINTR && soap_errno != SOAP_EWOULDBLOCK && soap_errno != SOAP_EAGAIN) - { soap->errnum = soap_errno; - 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_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, n))) - return soap->error = SOAP_EOM; - memcpy(t, s, n); - if (soap->fpreparesend) - return soap->fpreparesend(soap, s, n); - return SOAP_OK; - } - 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); - return soap->error = soap->fsend(soap, s, n); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_flush(struct soap *soap) -{ if (soap->bufidx) - { -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { soap->d_stream.next_in = (Byte*)soap->buf; - soap->d_stream.avail_in = (unsigned int)soap->bufidx; -#ifdef WITH_GZIP - soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->bufidx); -#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:"")); - 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 - if (soap_flush_raw(soap, soap->buf, soap->bufidx)) - return soap->error; - soap->bufidx = 0; - } - return SOAP_OK; -} -#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; - if (soap->fpreparesend && (soap->mode & SOAP_IO) != SOAP_IO_STORE) - return soap->fpreparesend(soap, s, n); - 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_send(struct soap *soap, const char *s) -{ if (s) - return soap_send_raw(soap, s, strlen(s)); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static size_t -frecv(struct soap *soap, char *s, size_t n) -{ register int r; - soap->errnum = 0; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifndef WITH_LEAN - struct timeval timeout; - fd_set fd; - if (soap->recv_timeout) - { 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)soap->socket, &fd); - for (;;) - { r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r > 0) - break; - if (r == 0) - return 0; - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { int err; - r = SSL_read(soap->ssl, s, n); - if ((err = SSL_get_error(soap->ssl, r)) == SSL_ERROR_NONE) - return (size_t)r; - if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return 0; - } - else -#endif - { r = recv((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); - if (r >= 0) - return (size_t)r; - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#ifndef WITH_LEAN - { struct timeval timeout; - fd_set fd; - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#endif - } - } -#ifdef WITH_FASTCGI - return fread(s, 1, n, stdin); -#else -#ifdef UNDER_CE - return fread(s, 1, n, soap->recvfd); -#else -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - r = httpBlockRead(soap->rpmreqid, s, n); - else - r = read(soap->recvfd, s, n); - if (r >= 0) - return r; - return 0; -#else -/* ]WR */ - r = read((SOAP_SOCKET)soap->recvfd, s, n); - if (r >= 0) - return (size_t)r; - soap->errnum = soap_errno; - return 0; -/* WR[ */ -#endif -/* ]WR */ -#endif -#endif -} -#endif -#endif - -/******************************************************************************/ -#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\n", (unsigned int)soap->buflen)); - DBGMSG(RECV, soap->buf, soap->buflen); - if (soap->buflen) - return soap->buf[soap->bufidx++]; - return EOF; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static int -soap_isxdigit(int c) -{ switch (c) - { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - return 1; - } - return 0; -} -#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; - 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); - 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 (soap->buflen) - { soap->count += soap->buflen; - 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->d_stream.next_out = Z_NULL; - 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; - } - } -#endif - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ - { -chunk_again: - 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; - } - else - { register soap_wchar c; - char *t, tmp[8]; - t = tmp; - if (!soap->chunkbuflen) - { soap->chunkbuflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes\n", (unsigned int)ret)); - DBGMSG(RECV, soap->buf, ret); - soap->bufidx = 0; - if (!ret) - return EOF; - } - else - soap->bufidx = soap->buflen; - soap->buflen = soap->chunkbuflen; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (%u %u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen)); - while (!soap_isxdigit((int)(c = soap_getchunkchar(soap)))) - if ((int)c == EOF) - return 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 EOF; - *t = '\0'; - 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); - return EOF; - } - soap->buflen = soap->bufidx + soap->chunksize; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to %u (%u %s)\n", (unsigned int)soap->buflen, (unsigned int)soap->bufidx, 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 (%lu bytes left)\n", (unsigned long)(soap->buflen - soap->bufidx))); - } - else if (soap->chunkbuflen) - soap->chunksize = 0; - ret = soap->buflen - soap->bufidx; - if (!ret) - goto chunk_again; - } - } - else - { soap->bufidx = 0; - soap->buflen = ret = soap->frecv(soap, soap->buf, SOAP_BUFLEN); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Read %u bytes\n", (unsigned int)ret)); - DBGMSG(RECV, soap->buf, ret); - } - if (soap->fpreparerecv && (soap->error = soap->fpreparerecv(soap, soap->buf, ret))) - return soap->error; -#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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - } - else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:"")); - soap->d_stream.next_out = Z_NULL; - 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; - if (soap->ahead) - { c = soap->ahead; - 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 *map, const char *str) -{ while (map->string) - { if (!strcmp(str, map->string)) /* case sensitive */ - return map; - map++; - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -long -SOAP_FMAC2 -soap_int_code(const struct soap_code_map *map, const char *str, long other) -{ while (map->string) - { if (!soap_tag_cmp(str, map->string)) /* case insensitive */ - return map->code; - map++; - } - return other; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_str_code(const struct soap_code_map *map, long code) -{ while (map->code != code && map->string) - map++; - return map->string; -} -#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_int_code(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR); -#else - return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ -#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) - soap->ahead = 0; - else - c = soap_get1(soap); - for (;;) - { if (soap->cdata) - { if (c == ']') - { c = soap_get1(soap); - if (c == ']') - { soap->cdata = 0; - soap_get1(soap); /* skip > */ - c = soap_get1(soap); - } - else - { soap_revget1(soap); - return ']'; - } - } - else - return c; - } - switch (c) - { case '<': - do c = soap_get1(soap); - while (soap_blank(c)); - if (c == '!' || c == '?' || c == '%') - { 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); - } - } - while ((int)c != EOF && c != '>') - 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 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_advance(struct soap *soap) -{ register soap_wchar c; - while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) - ; - return c; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_skip(struct soap *soap) -{ register soap_wchar c; - do c = soap_get(soap); - while (soap_blank(c)); - 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 > 0 && c < 0x80) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - 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_get(soap); - if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN)) - return c; - c1 = soap_get(soap); - if (c1 < 0x80) - { soap_unget(soap, c1); - return c; - } - c1 &= 0x3F; - if (c < 0xE0) - return ((soap_wchar)(c & 0x1F) << 6) | c1; - c2 = (soap_wchar)soap_get1(soap) & 0x3F; - 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) -{ /* TODO: serialize to DOM (as an option) using new soap_s2hex() */ - char d[2]; - register int i; - 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_FAST - soap->labidx = 0; - for (;;) - { register char *s; - register int 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, 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, soap->dom->data, 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_FAST - soap->labidx = 0; - for (;;) - { register int i, k; - register char *s; - if (soap_append_lab(soap, NULL, 2)) - return NULL; - s = soap->labbuf + soap->labidx; - k = 3 * ((soap->lablen - soap->labidx) / 3); - soap->labidx = 3 * (soap->lablen / 3); - if (!s) - return NULL; - for (i = 0; i < k; 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#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 -int -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(sizeof(struct soap_blist)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->ptr = *(char**)p; - SOAP_FREE(p); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -soap_update_ptrs(struct soap *soap, char *start, char *end, long offset) -{ int i; - register struct soap_ilist *ip; - register struct soap_flist *fp; - 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 + offset)); - ip->ptr = (char*)ip->ptr + offset; - } - 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 + offset; - } - } - 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 + offset; - } - } - 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 + offset; - } - } - } -} -#endif - -/******************************************************************************/ -#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; - register struct soap_flist *fp; - 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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_resolve(struct soap *soap) -{ register int i; - register struct soap_ilist *ip; - register struct soap_flist *fp; - 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, p, ip->size); - else - soap_fcopy(soap, ip->type, fp->type, fp->ptr, p, ip->size); - ip->flist = fp->next; - SOAP_FREE(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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_size_block(struct soap *soap, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(p); - } - soap->blist = bp->next; - SOAP_FREE(bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); - if (flag) - soap_update_ptrs(soap, q, q + n, (long)s - (long)q); /* pointers s and q may or may not be related */ - 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); - 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; - n = 1; - do - { attr1++; - 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; - } - } while (attr1 && *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 = 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; - np = (struct soap_nlist*)SOAP_MALLOC(sizeof(struct soap_nlist) + strlen(id)); - if (!np) - return soap->error = SOAP_EOM; - np->next = soap->nlist; - soap->nlist = np; - strcpy(np->id, id); - np->level = soap->level; - np->index = -1; - np->ns = NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns)); - p = soap->local_namespaces; - if (p) - { register short i = 0; - for (; p->id; p++, i++) - { if (p->ns && !strcmp(ns, p->ns)) - { if (p->out) - { SOAP_FREE(p->out); - p->out = NULL; - } - break; - } - if (p->out) - { if (!SOAP_STRCMP(ns, p->out)) - break; - } - else if (p->in) - { if (!soap_tag_cmp(ns, p->in)) - { if ((p->out = (char*)SOAP_MALLOC(strlen(ns) + 1))) - strcpy(p->out, ns); - break; - } - } - } - if (p && p->id) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push OK ('%s' matches '%s' in namespace table)\n", id, p->id)); - np->index = i; - } - } - if (!p || !p->id) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); - np->ns = (char*)SOAP_MALLOC(strlen(ns) + 1); - if (!np->ns) - return soap->error = SOAP_EOM; - strcpy(np->ns, ns); - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_namespace(struct soap *soap) -{ register struct soap_nlist *np; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - if (soap->nlist->ns) - SOAP_FREE(soap->nlist->ns); - SOAP_FREE(soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int 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 || (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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - return SOAP_OK; - return SOAP_SYNTAX_ERROR; -} -#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) - if (!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; - 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; - if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - } - else if (SOAP_STRCMP(tag1, t + 1)) - return SOAP_TAG_MISMATCH; - else if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - 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 - -/******************************************************************************/ - -#ifdef WITH_OPENSSL -/******************************************************************************/ -#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; - if (dhfile) - { soap->dhfile = dhfile; - soap->rsa = 0; - } - else - { soap->dhfile = NULL; - soap->rsa = 1; - } - soap->randfile = randfile; - soap->require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION); - if (!(err = soap->fsslauth(soap))) - if (sid) - SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, 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->rsa = 0; - soap->randfile = randfile; - soap->require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION); - return soap->fsslauth(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static void -ssl_init() -{ static int done = 0; - if (!done) - { done = 1; - SSL_library_init(); -#ifndef WITH_LEAN - SSL_load_error_strings(); -#endif - if (!RAND_load_file("/dev/urandom", 1024)) - { int r; -#ifdef HAVE_RAND_R - unsigned int s = (unsigned int)time(NULL); -#endif - char buf[SOAP_BUFLEN]; - RAND_seed(buf, sizeof(buf)); - while (!RAND_status()) - { -#ifdef HAVE_RAND_R - r = rand_r(&s); -#else - r = rand(); -#endif - RAND_seed(&r, sizeof(int)); - } - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static const char * -ssl_error(struct soap *soap, int ret) -{ int err = SSL_get_error(soap->ssl, ret); - const char *msg = soap_str_code(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 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) -{ ssl_init(); - 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); - 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/or directory", SOAP_SSL_ERROR); - 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); - 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); - } - } - if (soap->rsa) - { RSA *rsa = RSA_generate_key(512, 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); - } - SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); - SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, 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 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 - /* return 1 to always continue, but unsafe progress will be terminated by SSL */ - return ok; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ int i, r; - 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->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; -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - soap->bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, soap->bio, soap->bio); - i = 100; /* 100 * 0.1 ms retries */ - while ((r = SSL_accept(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - if (i-- <= 0) - break; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - else - { soap->errnum = err; - break; - } - } -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - if (r <= 0) - { soap_set_receiver_error(soap, ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); - soap_closesock(soap); - return SOAP_SSL_ERROR; - } - if (soap->require_client_auth) - { 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 /* WITH_OPENSSL */ - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_done(struct soap *soap) -{ -#ifdef SOAP_DEBUG - int i; -#endif - soap_free(soap); - while (soap->clist) - { struct soap_clist *p = soap->clist->next; - SOAP_FREE(soap->clist); - soap->clist = p; - } - 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->copy) - soap->plugins->fdelete(soap, soap->plugins); - SOAP_FREE(soap->plugins); - soap->plugins = p; - } - soap->fplugin = fplugin; - soap->fpost = http_post; - soap->fget = http_get; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#ifndef MAC_CARBON -#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->fpoll = NULL; -#endif - soap->fprepareinit = NULL; - soap->fpreparesend = NULL; - soap->fpreparerecv = NULL; - soap->fignore = NULL; - soap->fserveloop = NULL; -#ifdef WITH_OPENSSL - if (soap->session) - { SSL_SESSION_free(soap->session); - soap->session = NULL; - } -#endif - if (!soap->copy) - { if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = NULL; - } -#endif - } -#ifdef SOAP_DEBUG - for (i = 0; i < SOAP_MAXLOGS; i++) - { soap_close_logfile(soap, i); - if (soap->logfile[i]) - { SOAP_FREE((void*)soap->logfile[i]); - soap->logfile[i] = NULL; - } - } -#endif -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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_str_code(h_error_codes, soap->errnum); - if (!msg) -#endif - { sprintf(soap->msgbuf, "TCP error %d", soap->errnum); - msg = soap->msgbuf; - } - } - } - return msg; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static const char* -http_error(struct soap *soap, int status) -{ register const char *msg = NULL; -#ifndef WITH_LEAN - msg = soap_str_code(h_http_error_codes, status); - if (!msg) -#endif - { sprintf(soap->msgbuf, "HTTP error %d", status); - msg = soap->msgbuf; - } - return msg; -} -#endif - -/******************************************************************************/ -/* WR[ */ -#ifndef WITH_IPV6 -/* ]WR */ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_gethost(struct soap *soap, const char *addr, struct in_addr *inaddr) -{ unsigned long iadd; - struct hostent hostent, *host = &hostent; -/* WR[ */ -#ifdef VXWORKS - int hostint; - char *addrcopy = (char*)malloc(strlen(addr) + 1); /*copy of addr. */ - /* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */ - strncpy(addrcopy, addr, strlen(addr)+1); - iadd = inet_addr(addrcopy); -#else -/* ]WR */ -#if defined(_AIXVERSION_431) || defined(TRU64) - struct hostent_data ht_data; -#endif - iadd = inet_addr(addr); -/* WR[ */ -#endif -/* ]WR */ - if ((int)iadd != -1) - { memcpy(inaddr, &iadd, sizeof(iadd)); -/* WR[ */ -#ifdef VXWORKS - free(addrcopy); -#endif -/* ]WR */ - return SOAP_OK; - } -#if defined(__GLIBC__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - 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); -/* WR[ */ -#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(addrcopy); - if (hostint == ERROR) - { host = NULL; - soap->errnum = soap_errno; - } - free(addrcopy); /*free() is placed after the error checking to assure that - * errno captured is that from hostGetByName() */ -/* ]WR */ -#else - if (!(host = gethostbyname(addr))) - soap->errnum = h_errno; -#endif - if (!host) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Host name not found\n")); - return SOAP_ERR; - } -/* WR[ */ -#ifdef VXWORKS - inaddr->s_addr = hostint; -#else -/* ]WR */ - memcpy(inaddr, host->h_addr, host->h_length); -/* WR[ */ -#endif -/* ]WR */ - return SOAP_OK; -} -#endif -#endif -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ struct sockaddr_in sockaddr; -/* WR[ */ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo resaddr; - struct sockaddr_storage addrstorage; - int err; -#endif /* WITH_IPV6 */ -/* ]WR */ - register int fd; -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->socket)) - soap->fclosesocket(soap, (SOAP_SOCKET)soap->socket); - soap->socket = SOAP_INVALID_SOCKET; - if (tcp_init(soap)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP initialization failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } - soap->errmode = 0; -/* WR[ */ -#ifdef WITH_IPV6 - memset((void*)&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - soap->errmode = 2; - if (soap->proxy_host) - err = getaddrinfo(soap->proxy_host, soap_int2s(soap, soap->proxy_port), &hints, &addrinfo); - else - err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); - if (addrinfo) - { resaddr = *addrinfo; - addrstorage = *((struct sockaddr_storage*)addrinfo->ai_addr); - resaddr.ai_addr = (struct sockaddr*)&addrstorage; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_sender_error(soap, gai_strerror(err), - "TCP getaddrinfo on proxy host failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } - fd = (int)socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol); /* modified to use fd */ - soap->errmode = 0; -#else /* WITH_IPV6 */ -/* ]WR */ - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - if (fd < 0) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP socket failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } -#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 = 0; - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - } - if ((soap->connect_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } -#endif -#endif -/* WR[ */ -#ifndef WITH_IPV6 -/* ]WR */ - memset((void*)&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Open socket %d to host='%s'\n", fd, host)); - soap->errmode = 2; - if (soap->proxy_host) - { if (soap->fresolve(soap, soap->proxy_host, &sockaddr.sin_addr)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - sockaddr.sin_port = htons((short)soap->proxy_port); - } - else - { if (soap->fresolve(soap, host, &sockaddr.sin_addr)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP get host by name failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - sockaddr.sin_port = htons((short)port); - } - soap->errmode = 0; -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -/* WR[ */ -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, resaddr.ai_addr, resaddr.ai_addrlen)) /* modified to use fd */ -#else /* WITH_IPV6 */ - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr))) -#endif /* WITH_IPV6 */ -/* ]WR */ - { -#ifndef WITH_LEAN - if (soap->connect_timeout && (soap_socket_errno == SOAP_EINPROGRESS || soap_socket_errno == SOAP_EWOULDBLOCK)) - { struct timeval timeout; -#if defined(SOCKLEN_T) - SOCKLEN_T n = sizeof(struct sockaddr_in); -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) - socklen_t n = sizeof(struct sockaddr_in); -#elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) - int n = sizeof(struct sockaddr_in); -#else - size_t n = sizeof(struct sockaddr_in); -#endif - fd_set fds; - 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((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(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", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - } - n = sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &n) && !soap->errnum) - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - else -#endif - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return -1; - } - } - else - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - soap->socket = fd; -#ifdef WITH_OPENSSL - soap->imode &= ~SOAP_ENC_SSL; - soap->omode &= ~SOAP_ENC_SSL; - if (!strncmp(endpoint, "https:", 6)) - { int r; - if (soap->proxy_host) - { unsigned int k = soap->omode; /* make sure we only parse HTTP */ - size_t n = soap->count; /* save the content length */ - soap->omode &= ~0xFF; /* mask IO and ENC */ - soap->omode |= SOAP_IO_BUFFER; - soap_begin_send(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to proxy server\n")); - sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return -1; -#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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - return soap->error; - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - return -1; - soap->omode = k; - k = soap->imode; - soap->imode &= ~0xFF; /* mask IO and ENC */ - if (soap_begin_recv(soap)) - return -1; - soap->imode = k; - soap->count = n; - soap_begin_send(soap); - } - 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); - return -1; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->error = SOAP_SSL_ERROR; - return -1; - } - 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; - soap->bio = BIO_new_socket((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, soap->bio, soap->bio); -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - { soap_set_sender_error(soap, ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); - return -1; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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((SOAP_SOCKET)(soap->socket), &fds); - for (;;) - { int r = select((SOAP_SOCKET)(soap->socket + 1), &fds, NULL, &fds, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); - soap_set_sender_error(soap, "Timeout", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - return -1; - } - } - continue; - } - } - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if (soap->require_server_auth) - { X509 *peer; - 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); - return -1; - } - 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); - return -1; - } - X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); - X509_free(peer); - if (soap_tag_cmp(soap->msgbuf, host)) - { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); - return -1; - } - } - } -#endif - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_bind(struct soap *soap, const char *host, int port, int backlog) -{ struct sockaddr_in sockaddr; -/* WR[ */ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo resaddr; - struct sockaddr_storage addrstorage; - int err; -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)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 -1; - } -/* WR[ */ -#ifdef WITH_IPV6 - memset((void*)&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; - soap->errmode = 2; - if (host) - err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); - else - err = getaddrinfo(NULL, soap_int2s(soap, port), &hints, &addrinfo); - if (NULL != addrinfo) - { - resaddr = *addrinfo; - addrstorage = *((struct sockaddr_storage *) addrinfo->ai_addr); - resaddr.ai_addr = (struct sockaddr *) &addrstorage; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "TCP getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - soap->errmode = 0; - if ((soap->master = socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol)) < 0) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#else /* WITH_IPV6 */ -/* ]WR */ - soap->errmode = 0; - if ((soap->master = (int)socket(AF_INET, SOCK_STREAM, 0)) < 0) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#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_SOCKET)soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#endif -#endif -/* WR[ */ -#ifdef WITH_IPV6 - soap->errmode = 0; - if (bind(soap->master, resaddr.ai_addr, resaddr.ai_addrlen) || listen(soap->master, backlog)) - { - soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); - soap_closesock(soap); - soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -#else /* WITH_IPV6 */ -/* ]WR */ - memset((void*)&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - soap->errmode = 2; - if (host) - { if (soap->fresolve(soap, host, &sockaddr.sin_addr)) - { soap_set_receiver_error(soap, tcp_error(soap), "TCP get host by name failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } - } - else - sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); - sockaddr.sin_port = htons((short)port); - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) || listen((SOAP_SOCKET)soap->master, backlog)) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); - soap_closesock(soap); - soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); - return -1; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifdef WITH_OPENSSL - if (!soap->ctx && (soap->error = soap->fsslauth(soap))) - return -1; -#endif - return soap->master; -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_poll(struct soap *soap) -{ -#ifndef WITH_LEAN - struct timeval timeout; - fd_set sfd,rfd; - int r; - timeout.tv_sec = 0; - timeout.tv_usec = 0; - FD_ZERO(&rfd); - FD_ZERO(&sfd); - if (soap->socket >= 0) - { FD_SET(soap->socket, &rfd); - FD_SET(soap->socket, &sfd); - r = select(soap->socket + 1, &rfd, &sfd, NULL, &timeout); - } - else if (soap->master >= 0) - { FD_SET(soap->master, &rfd); - r = select(soap->master + 1, &rfd, &sfd, NULL, &timeout); - } - else - { FD_SET(soap->sendfd, &sfd); - FD_SET(soap->recvfd, &rfd); - r = select((soap->sendfd > soap->recvfd ? soap->sendfd : soap->recvfd) + 1, &rfd, &sfd, NULL, &timeout); - } - if (r > 0) - { -#ifdef WITH_OPENSSL - if (soap->ssl) - { if ((soap->socket >= 0) && FD_ISSET(soap->socket, &rfd)) - { char buf = '\0'; - if (SSL_peek(soap->ssl, &buf, 1) <= 0) - return SOAP_EOF; - } - } -#endif - return SOAP_OK; - } - if (r < 0 && (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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 = soap_errno; - return SOAP_EOF; -#else - return SOAP_OK; -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ int fd; -#if defined(SOCKLEN_T) - fd = (int)accept((SOAP_SOCKET)s, a, (SOCKLEN_T*)n); -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) - fd = (int)accept((SOAP_SOCKET)s, a, (socklen_t*)n); -#elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) - fd = (int)accept((SOAP_SOCKET)s, a, n); -#else - fd = (int)accept((SOAP_SOCKET)s, a, (size_t*)n); -#endif -#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 MAC_CARBON -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_accept(struct soap *soap) -{ -/* WR[ */ -#ifdef WITH_IPV6 - struct sockaddr_storage sockaddr; -#else /* WITH_IPV6 */ -/* ]WR */ - struct sockaddr_in sockaddr; -/* WR[ */ -#endif -/* ]WR */ - int n = (int)sizeof(sockaddr); -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - soap->error = SOAP_OK; - memset((void*)&sockaddr, 0, sizeof(sockaddr)); - soap->socket = SOAP_INVALID_SOCKET; - soap->errmode = 0; - if (soap_valid_socket(soap->master)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->accept_timeout) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - soap_closesock(soap); - soap_set_sender_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - } -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if ((soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&sockaddr, &n)) >= 0) - { -/* WR[ */ -#ifdef WITH_IPV6 -/* Use soap->host to store the numeric form of the remote host */ - getnameinfo((struct sockaddr*)&sockaddr, 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->host */ - soap->port = 0; /* info stored in soap->host */ -#else /* WITH_IPV6 */ -/* ]WR */ - soap->ip = ntohl(sockaddr.sin_addr.s_addr); - soap->port = (int)ntohs(sockaddr.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)); -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - soap->keep_alive = ((soap->imode & SOAP_IO_KEEPALIVE) != 0); -#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 = 0; - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - } - if ((soap->accept_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } -#endif -#endif - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -/* WR[ */ -#elif defined(VXWORKS) - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&vx_nonblocking)); -/* ]WR */ -#elif defined(PALM) - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); -#elif defined(SYMBIAN) - long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - } - return soap->socket; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return -1; - } - } - } - else - { soap_set_receiver_error(soap, tcp_error(soap), "TCP no master socket in soap_accept()", SOAP_TCP_ERROR); - return -1; - } -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#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); - 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 != 1) - { s = ERR_get_error(); - if (s) - { if (soap_valid_socket(soap->socket)) - { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); - soap->socket = SOAP_INVALID_SOCKET; - } - r = SSL_shutdown(soap->ssl); - } - } - DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); - SSL_free(soap->ssl); - soap->ssl = NULL; - if (s) - return SOAP_SSL_ERROR; - ERR_remove_state(0); - } -#endif - if (soap_valid_socket(soap->socket)) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Closing socket %d\n", soap->socket)); - soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 2); - soap->fclosesocket(soap, (SOAP_SOCKET)soap->socket); - soap->socket = SOAP_INVALID_SOCKET; - } - return SOAP_OK; -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_closesocket(struct soap *soap, SOAP_SOCKET fd) -{ return closesocket(fd); -} -#endif -#endif - -/******************************************************************************/ -#ifndef MAC_CARBON -#ifndef PALM_1 -static int -tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET fd, int 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; -#ifndef MAC_CARBON - if (status == SOAP_EOF || status == SOAP_TCP_ERROR || status == SOAP_SSL_ERROR || !soap->keep_alive) - { if ((soap->error = soap->fclose(soap))) - return soap->error; - soap->socket = SOAP_INVALID_SOCKET; - } -#endif -#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 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 - -/******************************************************************************/ -#ifndef PALM_1 -static void -soap_init_pht(struct soap *soap) -{ register int i; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing pointer hashtable\n")); - for (i = 0; i < (int)SOAP_PTRHASH; i++) - soap->pht[i] = NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new() -{ struct soap *soap = (struct soap*)SOAP_MALLOC(sizeof(struct soap)); - if (soap) - soap_init(soap); - return soap; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new1(int mode) -{ return soap_new2(mode, mode); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_new2(int imode, int omode) -{ struct soap *soap = (struct soap*)SOAP_MALLOC(sizeof(struct soap)); - if (soap) - soap_init2(soap, imode, omode); - return soap; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -soap_free_pht(struct soap *soap) -{ register struct soap_plist *pp, *next; - register int i; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free pointer hashtable\n")); - for (i = 0; i < (int)SOAP_PTRHASH; i++) - { for (pp = soap->pht[i]; pp; pp = next) - { next = pp->next; - SOAP_FREE(pp); - } - soap->pht[i] = NULL; - } -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 int h; - register struct soap_plist *pp = *ppp = (struct soap_plist*)SOAP_MALLOC(sizeof(struct soap_plist)); - if (!pp) - return 0; - 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=%lu\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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_begin_count(struct soap *soap) -{ soap_clr_attr(soap); - soap_set_local_namespaces(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)) && !soap->fpreparesend)) - soap->mode &= ~SOAP_IO_LENGTH; - else - soap->mode |= SOAP_IO_LENGTH; - } - 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; - } - if (!soap->encodingStyle && !(soap->mode & SOAP_XML_GRAPH)) - soap->mode |= SOAP_XML_TREE; -#ifndef WITH_LEANER - 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->dime.count = 0; /* count # of attachments */ - soap->dime.size = 0; /* accumulate total size of attachments */ - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); - if (soap->fprepareinit && (soap->mode & SOAP_IO) != SOAP_IO_STORE) - soap->fprepareinit(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_begin_send(struct soap *soap) -{ soap->error = SOAP_OK; - soap_clr_attr(soap); - soap_set_local_namespaces(soap); - soap->mode = (soap->omode & ~SOAP_IO_LENGTH) | (soap->mode & SOAP_ENC_DIME); - 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; - } - if ((soap->mode & SOAP_IO) == SOAP_IO_FLUSH && soap_valid_socket(soap->socket)) - { if (soap->count || (soap->mode & SOAP_ENC_XML)) - soap->mode |= SOAP_IO_BUFFER; - else - soap->mode |= SOAP_IO_STORE; - } - if ((soap->mode & SOAP_IO) == SOAP_IO_STORE) - soap_new_block(soap); - 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_MIME) - soap_select_mime_boundary(soap); -#endif -#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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)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->part = SOAP_BEGIN; - soap->idnum = 0; - soap->level = 0; -#ifdef WITH_ZLIB - soap->z_ratio_out = 1.0; - if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); - if (soap->fprepareinit && (soap->mode & SOAP_IO) == SOAP_IO_STORE) - soap->fprepareinit(soap); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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) - 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 - -/******************************************************************************/ -#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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id %p type=%d id=%d\n", p, t, id)); - if (soap->mode & SOAP_XML_TREE) - return 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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef WITH_LEANER -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element_dime(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) -{ struct soap_plist *pp; - 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:"", id, atype?atype:"")); - if (id < 0) - id = soap_array_pointer_lookup(soap, p, a, n, t, &pp); - if (!aid) - { sprintf(soap->tmpbuf, soap->dime_id_format, id); - aid = soap_strdup(soap, soap->tmpbuf); - } - 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 = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, (char*)a->__ptr, a->__size); - if (!content) - return soap->error = SOAP_EOM; - content->id = aid; - content->type = atype; - content->options = aoptions; - pp->mark1 = 3; - } - } - else - pp->mark2 = 3; - return SOAP_OK; -} -#endif -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef PALM_1 -static void -soap_free_iht(struct soap *soap) -{ register int i; - register struct soap_ilist *ip, *p; - register struct soap_flist *fp, *fq; - 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(fp); - } - p = ip->next; - SOAP_FREE(ip); - } - soap->iht[i] = NULL; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static struct soap_ilist * -soap_hlookup(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - for (ip = soap->iht[soap_hash(id)]; ip; ip = ip->next) - if (!strcmp(ip->id, id)) - return ip; - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_ilist * -SOAP_FMAC2 -soap_lookup(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - ip = soap_hlookup(soap, id); -#ifndef WITH_LEANER - if (!ip && *id != '#' && !strchr(id, ':')) /* try content id "cid:" with DIME attachments */ - { char cid[SOAP_TAGLEN]; - strcpy(cid, "cid:"); - strncat(cid + 4, id, sizeof(cid) - 5); - cid[sizeof(cid) - 1] = '\0'; - ip = soap_hlookup(soap, cid); - } -#endif - return ip; -} -#endif - -/******************************************************************************/ -#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(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; - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_malloc(struct soap *soap, size_t n) -{ register char *p; - if (!n) - return NULL; - if (!soap) - return SOAP_MALLOC(n); - n += (-(long)n) & 7; - if (!(p = (char*)SOAP_MALLOC(n + sizeof(void*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - /* keep chain of alloced cells for later destruction */ - soap->alloced = 1; - *(void**)(p + n) = soap->alist; - *(size_t*)(p + n + sizeof(void*)) = n; - soap->alist = p + n; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Malloc %u bytes at location %p\n", (unsigned int)n, p)); - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_dealloc(struct soap *soap, void *p) -{ if (!soap) - return; - if (p) - { register char **q; - 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, "Freed data at %p\n", p)); - SOAP_FREE(p); - return; - } - } - soap_delete(soap, p); - } - else - { register char *q; - while (soap->alist) - { q = (char*)soap->alist; - soap->alist = *(void**)q; - q -= *(size_t*)(q + sizeof(void*)); - SOAP_FREE(q); - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Dealloc all data done\n")); - } - /* we must assume these were deallocated: */ - soap->action = NULL; - soap->fault = NULL; - soap->header = NULL; - soap->authrealm = 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 = &soap->clist; - if (p) - { while (*cp) - { if (p == (*cp)->ptr) - { register struct soap_clist *q = *cp; - *cp = q->next; - q->fdelete(q); - SOAP_FREE(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->ptr == (void*)soap->fault) - soap->fault = NULL; /* this was deallocated */ - else if (q->ptr == (void*)soap->header) - soap->header = NULL; /* this was deallocated */ - q->fdelete(q); - SOAP_FREE(q); - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_clist * -SOAP_FMAC2 -soap_link(struct soap *soap, void *p, int t, int n, void (*fdelete)(struct soap_clist*)) -{ register struct soap_clist *cp; - if ((cp = (struct soap_clist*)SOAP_MALLOC(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)); - 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(q); - return; - } - } -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 (!id || !*id) - return p; - soap->alloced = 0; - if (!p) - p = (void**)soap_malloc(soap, sizeof(void*)); - ip = soap_lookup(soap, id); /* lookup pointer to hash table entry for string id */ - if (!ip) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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: id type=%d href type=%d\n", 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*)); - 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*)); - *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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_id_forward(struct soap *soap, const char *href, void *p, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, 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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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(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; - 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 href='%s'\n", st, tt, (unsigned long)n, p, k, 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 - -/******************************************************************************/ -#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*)) -{ struct soap_ilist *ip; - 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; - } - if (!id || !*id) - return p; - 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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_MULTI_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 - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_fcopy(struct soap *soap, int st, int tt, void *p, 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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; - 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++; - } - for (p = soap_first_block(soap); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } - 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; - } - } -#ifdef WITH_OPENSSL - if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive) - soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ -#else - if (soap_valid_socket(soap->socket) && !soap->keep_alive) - soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send message ok\n")); - soap->part = SOAP_END; - soap->count = 0; - 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_MIME) && soap_getmime(soap)) - return soap->error; - soap->mime.list = soap->mime.first; - soap->mime.first = NULL; - soap->mime.last = NULL; - soap->dime.list = soap->dime.first; - soap->dime.first = NULL; - soap->dime.last = NULL; -#endif - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { soap_wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(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; - } - } -#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; - return soap_resolve(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free(struct soap *soap) -{ register struct soap_nlist *np; - register struct soap_attribute *tp; - register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { np = soap->nlist->next; - if (soap->nlist->ns) - SOAP_FREE(soap->nlist->ns); - SOAP_FREE(soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attributes\n")); - while (soap->attributes) - { tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap->attributes->value); - SOAP_FREE(soap->attributes); - soap->attributes = tp; - } -#ifdef WITH_FAST - if (soap->labbuf) - SOAP_FREE(soap->labbuf); - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; -#endif - soap_free_pht(soap); - soap_free_iht(soap); - ns = soap->local_namespaces; - if (ns) - { for (; ns->id; ns++) - { if (ns->out) - { SOAP_FREE(ns->out); - if (soap->encodingStyle == ns->out) - soap->encodingStyle = SOAP_STR_EOS; - ns->out = NULL; - } - if (soap->encodingStyle == ns->ns) - soap->encodingStyle = SOAP_STR_EOS; - } - SOAP_FREE(soap->local_namespaces); - soap->local_namespaces = NULL; - } -} -#endif - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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) -{ char *s = NULL; - soap_close_logfile(soap, i); - if (soap->logfile[i]) - SOAP_FREE((void*)soap->logfile[i]); - if (logfile) - if ((s = (char*)SOAP_MALLOC(strlen(logfile) + 1))) - strcpy(s, logfile); - soap->logfile[i] = s; -} -#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(struct soap *soap) -{ return soap_copy_context((struct soap*)SOAP_MALLOC(sizeof(struct soap)), soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_copy_context(struct soap *copy, struct soap *soap) -{ if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - copy->copy = 1; - copy->user = NULL; - copy->userid = NULL; - copy->passwd = NULL; - copy->nlist = NULL; - copy->blist = NULL; - copy->clist = NULL; - copy->alist = NULL; - copy->attributes = NULL; - copy->local_namespaces = NULL; - soap_set_local_namespaces(copy); - soap_init_iht(copy); - soap_init_pht(copy); - copy->header = NULL; - copy->fault = NULL; - copy->action = NULL; - *copy->host = '\0'; -#ifndef WITH_LEAN -#ifdef WITH_COOKIES - copy->cookies = soap_copy_cookies(soap); -#else - copy->cookies = NULL; -#endif -#endif -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, "RECV.log"); - soap_set_sent_logfile(copy, "SENT.log"); - soap_set_test_logfile(copy, "TEST.log"); -#endif - copy->plugins = NULL; - for (p = soap->plugins; p; p = p->next) - { register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC(sizeof(struct soap_plugin)); - if (!q) - return NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying plugin '%s'\n", p->id)); - *q = *p; - if (p->fcopy && (soap->error = p->fcopy(soap, q, p))) - { SOAP_FREE(q); - return NULL; - } - q->next = copy->plugins; - copy->plugins = q; - } - } - else - soap->error = SOAP_EOM; - return copy; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init(struct soap *soap) -{ soap->version = 0; - soap_imode(soap, SOAP_IO_DEFAULT); - soap_omode(soap, SOAP_IO_DEFAULT); - soap->copy = 0; - soap->plugins = NULL; - soap->user = NULL; - soap->userid = NULL; - soap->passwd = NULL; - soap->fpost = http_post; - soap->fget = http_get; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; - soap->fconnect = NULL; - soap->fdisconnect = NULL; -#ifndef MAC_CARBON -#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->fpoll = NULL; -#endif - soap->fprepareinit = NULL; - soap->fpreparesend = NULL; - soap->fpreparerecv = NULL; - soap->fignore = NULL; - soap->fserveloop = NULL; - soap->fplugin = fplugin; - soap->fdimereadopen = NULL; - soap->fdimewriteopen = NULL; - soap->fdimereadclose = NULL; - soap->fdimewriteclose = NULL; - soap->fdimeread = NULL; - soap->fdimewrite = NULL; - soap->float_format = "%.8g"; /* .8 preserves single FP precision as much as possible, but might not be very efficient */ - soap->double_format = "%.17lg"; /* .17 preserves double FP precision as much as possible, but might not be very efficient */ - soap->dime_id_format = "cid:id%d"; /* default DIME id format */ - soap->http_version = "1.1"; - soap->actor = NULL; - soap->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->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; - 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; -#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_OPENSSL - soap->fsslauth = ssl_auth_init; - soap->fsslverify = ssl_verify_callback; - soap->bio = NULL; - soap->ssl = NULL; - soap->ctx = NULL; - soap->require_server_auth = 0; - soap->require_client_auth = 0; - soap->rsa = 0; - soap->keyfile = NULL; - soap->password = NULL; - soap->dhfile = NULL; - soap->cafile = NULL; - soap->capath = NULL; - soap->randfile = NULL; - soap->session = NULL; -#endif -#ifdef WITH_ZLIB - soap->zlib_state = SOAP_ZLIB_NONE; - soap->zlib_in = SOAP_ZLIB_NONE; - soap->zlib_out = SOAP_ZLIB_NONE; - soap->d_stream.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = NULL; - soap->z_level = 6; -#endif -#ifndef WITH_LEAN - soap->cookies = NULL; - soap->cookie_domain = NULL; - soap->cookie_path = NULL; - soap->cookie_max = 32; -#endif -#ifdef SOAP_DEBUG - soap_init_logs(soap); - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, NULL); -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - soap->rpmreqid = NULL; -#endif /* WMW_RPM_IO */ -/* ]WR */ -#ifdef PALM - palmNetLibOpen(); -#endif - soap_init_iht(soap); - soap_init_pht(soap); - soap_begin(soap); -#ifdef SOAP_DEBUG - soap_set_test_logfile(soap, "TEST.log"); -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init1(struct soap *soap, int mode) -{ soap_init2(soap, mode, mode); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init2(struct soap *soap, int imode, int 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, "Initializing\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_BEGIN; - 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'; - soap->dime.chunksize = 0; - soap->dime.buflen = 0; - soap_free(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end(struct soap *soap) -{ register struct soap_clist *cp; - soap_free(soap); - soap_dealloc(soap, NULL); - while (soap->clist) - { cp = soap->clist->next; - SOAP_FREE(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, struct Namespace *p) -{ struct Namespace *ns = soap->local_namespaces; - struct soap_nlist *np, *nq, *nr; - unsigned int level = soap->level; - soap->namespaces = p; - soap->local_namespaces = NULL; - soap_set_local_namespaces(soap); - /* reverse the 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; - } - } - while (np) - { soap->level = np->level; /* preserve element nesting level */ - if (np->ns) - { if (soap_push_namespace(soap, np->id, np->ns)) - return soap->error; - } - else if (np->index >= 0 && ns) - { if (ns[np->index].out) - { if (soap_push_namespace(soap, np->id, ns[np->index].out)) - return soap->error; - } - else if (soap_push_namespace(soap, np->id, ns[np->index].ns)) - return soap->error; - } - if (np->ns) - SOAP_FREE(np->ns); - nq = np; - np = np->next; - SOAP_FREE(nq); - } - if (ns) - { int i; - for (i = 0; ns[i].id; i++) - { if (ns[i].out) - { SOAP_FREE(ns[i].out); - ns[i].out = NULL; - } - } - SOAP_FREE(ns); - } - soap->level = level; /* restore level */ - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -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++; - if (n > 3) - { n *= sizeof(struct Namespace); - ns2 = (struct Namespace*)SOAP_MALLOC(n); - if (ns2) - { memcpy(ns2, soap->namespaces, n); - ns2[0].id = "SOAP-ENV"; - ns2[1].id = "SOAP-ENC"; - ns2[2].id = "xsi"; - if (ns2[0].ns) - { if (!strcmp(ns2[0].ns, soap_env1)) - soap->version = 1; - else - soap->version = 2; - } - soap->local_namespaces = ns2; - } - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element(struct soap *soap, const char *tag, int id, const char *type) -{ struct Namespace *ns = soap->local_namespaces; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); -/**/ -#ifdef WITH_DOM - if (soap->mode & SOAP_XML_DOM) - { register struct soap_dom_element *p, *e = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); - e->next = NULL; - e->prnt = soap->dom; - e->nstr = NULL; - e->name = soap_strdup(soap, tag); /* check EOM? */ - e->data = NULL; - e->type = 0; - e->node = NULL; - e->elts = NULL; - e->atts = NULL; - if (soap->dom) - { p = soap->dom->elts; - if (p) - { while (p->next) - p = p->next; - p->next = e; - } - else - soap->dom->elts = e; - } - soap->dom = e; - } - else -#endif -{ - soap->level++; - if (!soap->ns && !(soap->mode & SOAP_XML_CANONICAL)) - if (soap_send(soap, soap->prolog ? soap->prolog : "")) - return soap->error; - if (soap_send_raw(soap, "<", 1) - || soap_send(soap, tag)) - return soap->error; -} -/**/ - if (!soap->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; - } - if (id > 0) - { sprintf(soap->tmpbuf, "_%d", id); - if (soap_attribute(soap, "id", soap->tmpbuf)) - return soap->error; - } - if (type && *type) - { if (soap_attribute(soap, "xsi:type", type)) - return soap->error; - } - if (soap->null && soap->position > 0) - { 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; - 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) - 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) - 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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } - 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; -/**/ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - a->next = soap->dom->atts; - a->nstr = NULL; - a->name = soap_strdup(soap, tp->name); /* check EOM */ - a->data = soap_strdup(soap, tp->value); /* check EOM */ - a->wide = NULL; - soap->dom->atts = a; - tp->visible = 0; - } - } - return SOAP_OK; - } -#endif -/**/ - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { if (soap_send2(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) - { soap->level--; -#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 - return soap_send_raw(soap, "/>", 2); - } - 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 -/**/ - soap->level--; - if (soap_send_raw(soap, "error; - 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; - if (soap->version == 2) - n = 1; - sprintf(soap->href, "#_%d", href); - return soap_element_href(soap, tag, id, "href" + n, 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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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) -{ struct soap_plist *pp; - if (!p || (a && !a->__ptr)) - { soap_element_null(soap, tag, id, type); - return -1; - } - if (soap->mode & SOAP_XML_TREE) - return 0; - if (id < 0) - { 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; -} -#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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_attribute(struct soap *soap, const char *name, const char *value) -{ -/**/ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - a->next = soap->dom->atts; - a->nstr = NULL; - a->name = soap_strdup(soap, name); /* check EOM */ - a->data = soap_strdup(soap, value); /* check EOM */ - a->wide = NULL; - soap->dom->atts = a; - return SOAP_OK; - } -#endif -/**/ -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { if (soap_set_attr(soap, name, value)) - return soap->error; - } - else -#endif - { if (soap_send2(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) -{ 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 (soap->body) - soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) - return soap->error = SOAP_NULL; - } - } - 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 const char *t; - if (tag && *tag == '-') - return SOAP_OK; - soap->level--; - soap_pop_namespace(soap); - if (soap->peeked) - { if (*soap->tag == '\0') - { soap->peeked = 0; - if (soap->error == SOAP_NO_TAG || soap->error == SOAP_TAG_END) - soap->error = SOAP_OK; - } - else - return soap->error = SOAP_TAG_END; - } - else - { while (((c = soap_get(soap)) != SOAP_TT)) - { if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (c == SOAP_LT) - return soap->error = SOAP_TAG_END; - } - } - s = soap->tag; - do c = soap_get(soap); - while (soap_blank(c)); - do - { *s++ = (char)c; - c = soap_get(soap); - } while (soap_notblank(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:"")); - if (!tag) - return SOAP_OK; - if ((s = strchr(soap->tag, ':'))) - s++; - else - s = soap->tag; - if ((t = strchr(tag, ':'))) - t++; - else - t = tag; - if (!SOAP_STRCMP(s, t)) - return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#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; - for (tp = soap->attributes; tp; tp = tp->next) - if (!soap_match_tag(soap, tp->name, name)) - break; - if (tp && tp->visible == 2) - { 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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(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, ':'); - 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 (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(tp->value); - tp->value = NULL; - tp->ns = NULL; - } - if (value) - { if (!tp->value) - { tp->size = strlen(value) + 1; - if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) - return soap->error = SOAP_EOM; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value of %s (%p)\n", tp->name, tp->value)); - } - strcpy(tp->value, value); - if (!strncmp(tp->name, "xmlns:", 6)) - tp->ns = tp->value; - tp->visible = 2; - } - 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; - SOAP_FREE(soap->attributes->value); - SOAP_FREE(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) -{ size_t i; - soap_wchar c; - for (i = 0; i < n; i++) - { c = soap_getutf8(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 -static int -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->lablen); - if (!soap->labbuf) - { if (t) - free(t); - return soap->error = SOAP_EOM; - } - if (t && soap->labidx) - { memcpy(soap->labbuf, t, soap->labidx); - free(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) -{ register struct soap_attribute *tp; - const char *t; - register char *s; - register soap_wchar c; - register int i; - if (soap->error == SOAP_NO_TAG || soap->error == SOAP_TAG_END || soap->error == SOAP_TAG_MISMATCH) - soap->error = SOAP_OK; /* retry */ - if (soap->peeked) - { if (*soap->tag == '\0') - return soap->error = SOAP_NO_TAG; - return SOAP_OK; - } - soap->peeked = 1; - for (;;) - { while (((c = soap_getutf8(soap)) != SOAP_LT) && c != SOAP_TT) - { if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - if (c == SOAP_TT) - { *soap->tag = '\0'; - return soap->error = SOAP_NO_TAG; /* ending tag found */ - } - s = soap->tag; - do c = soap_get(soap); - while (soap_blank(c)); - i = sizeof(soap->tag); - while (c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - *s = '\0'; - if (*soap->tag != '?') - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <%s?>\n", soap->tag)); - while ((int)c != EOF && c != SOAP_GT && c != '?') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf) - 2; - while (c != '=' && c != SOAP_GT && c != '?' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { *s++ = '='; - do c = soap_get(soap); - while (soap_blank(c)); - if (c != SOAP_QT && c != SOAP_AP) - { soap_unget(soap, c); - c = ' '; /* blank delimiter */ - } - if (soap_getattrval(soap, s, i, c) == SOAP_EOM) - while (soap_getattrval(soap, soap->tmpbuf, sizeof(soap->tmpbuf), c) == SOAP_EOM) - ; - else if (!strcmp(soap->tag, "?xml") && (!soap_tag_cmp(soap->tmpbuf, "encoding=iso-8859-1") || !soap_tag_cmp(soap->tmpbuf, "encoding=latin1"))) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML latin1 encoding\n")); - soap->mode |= SOAP_ENC_LATIN; - } - } - do c = soap_get(soap); - while (soap_blank(c)); - } - } - 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; - soap_clr_attr(soap); - while ((int)c != EOF && c != SOAP_GT && c != '/') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf); - while (c != '=' && c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - *s = '\0'; - if (i == sizeof(soap->tmpbuf)) - return soap->error = SOAP_SYNTAX_ERROR; - if (!strncmp(soap->tmpbuf, "xmlns:", 6)) - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (!strcmp(soap->tmpbuf, "xmlns")) - t = SOAP_STR_EOS; - else - t = NULL; - for (tp = soap->attributes; tp; tp = tp->next) - if (!SOAP_STRCMP(tp->name, soap->tmpbuf)) - break; - if (!tp) - { tp = (struct soap_attribute*)SOAP_MALLOC(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; - tp->next = soap->attributes; - soap->attributes = tp; - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { do c = soap_get(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; - soap->labidx = 0; - if (soap_append_lab(soap, tp->value, tp->size)) - return soap->error; - SOAP_FREE(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; - } - tp->size = soap->lablen; - if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) - return soap->error = SOAP_EOM; - memcpy(tp->value, soap->labbuf, soap->lablen); -#else - size_t n; - if (soap->error != SOAP_EOM) - return soap->error; - soap->error = SOAP_OK; - if (soap_new_block(soap)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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(n))) - return soap->error = SOAP_EOM; - if (tp->value) - { memcpy(s, tp->value, tp->size); - SOAP_FREE(tp->value); - } - soap_save_block(soap, s + tp->size, 0); - tp->value = s; - tp->size = n; -#endif - } - do c = soap_get(soap); - while (soap_blank(c)); - tp->visible = 2; /* seen this attribute w/ value */ - } - else - tp->visible = 1; /* seen this attribute w/o value */ - if (t && tp->value) - { if (soap_push_namespace(soap, t, tp->value)) - return soap->error; - tp->visible = 0; - } - } - if ((int)c == EOF) - return soap->error = SOAP_EOF; - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible && tp->value) - { if (!strcmp(tp->name, "id")) - { *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")) - { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else if ((soap->version == 2 || (soap->mode & SOAP_XML_GRAPH)) && !strcmp(tp->name, "ref")) - { *soap->href = '#'; - strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else 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->version == 1 && !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->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) - strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); - else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) - strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) - strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position")) - soap->position = soap_getposition(tp->value, soap->positions); - else if (soap->version == 1 && !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:actor") - || !soap_match_tag(soap, tp->name, "SOAP-ENV:role")) - { if ((!soap->actor || strcmp(soap->actor, tp->value)) - && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next") - && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) - soap->other = 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, "xsi:null") - || !soap_match_tag(soap, tp->name, "xsi:nil")) - && (!strcmp(tp->value, "1") - || !strcmp(tp->value, "true"))) - soap->null = 1; - } - } - if (!(soap->body = (c != '/'))) - do c = soap_get(soap); - while (soap_blank(c)); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_retry(struct soap *soap) -{ soap->peeked = 1; - soap->error = SOAP_OK; -} -#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 = 0x80000000; -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { soap->dom->data = soap_strdup(soap, s); /* check EOM */ - return SOAP_OK; - } -#endif - if (soap->mode & SOAP_C_UTFSTRING) - mask = 0; - t = s; - while ((c = *t++)) - { switch (c) - { - case 9: - if (flag) - { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) - return soap->error; - s = t; - } - break; - case 10: - 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 13: - 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: -#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 - if (c & mask) - { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) - return soap->error; - s = t; - } - } - } - 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; - register int m = 0; - register soap_wchar c; -#ifdef HAVE_WCTOMB - char buf[MB_LEN_MAX > 8 ? MB_LEN_MAX : 8]; -#else - char buf[8]; -#endif -#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)) - 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, 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 && !(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: -#ifdef HAVE_WCTOMB - if (soap->mode & SOAP_C_MBSTRING) - { m = wctomb(buf, c & 0x7FFFFFFF); - if (m >= 1) - { t = buf; - *s++ = *t++; - m--; - } - else - *s++ = SOAP_UNKNOWN_CHAR; - } - else -#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)) - 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, 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: - 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 '<' | 0x80000000: - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - m = 3; - } - break; - case '>' | 0x80000000: - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - m = 3; - } - break; - case '"' | 0x80000000: - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - m = 5; - } - break; - case '\'' | 0x80000000: - if (flag) - *s++ = '\''; - else - { *s++ = '&'; - t = (char*)"apos;"; - m = 5; - } - break; - default: - if ((int)c == EOF) - goto end; -#ifdef HAVE_WCTOMB - if (soap->mode & SOAP_C_MBSTRING) - { m = wctomb(buf, c & 0x7FFFFFFF); - if (m >= 1) - { t = buf; - *s++ = *t++; - m--; - } - else - *s++ = SOAP_UNKNOWN_CHAR; - } - else -#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, 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; - } - if (flag == 2) - if (soap_s2QName(soap, t, &t)) - return NULL; - return t; -} -#endif - -/******************************************************************************/ -#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) - { soap->dom->wide = NULL; /* soap_malloc() ??? */ - return SOAP_OK; - } -#endif - while ((c = *s++)) - { switch (c) - { - case 9: - if (flag) - t = " "; - else - t = "\t"; - break; - case 10: - if (flag || !(soap->mode & SOAP_XML_CANONICAL)) - t = " "; - else - t = "\n"; - break; - case 13: - 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 > 0 && 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 - -/******************************************************************************/ -#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; - register long l = 0; - register soap_wchar c; - const char *t = NULL; - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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; - } - return (wchar_t*)soap_save_block(soap, NULL, 0); -} -#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; - *p = (int)soap_strtol(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2int(soap, soap_value(soap), p)) - return NULL; - } - p = (int*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(int), 0, 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; - *p = soap_strtol(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2long(soap, soap_value(soap), p)) - return NULL; - } - p = (long*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(long), 0, 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 && sscanf(s, SOAP_LONG_FORMAT, p) != 1) - 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)) - 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 (p) - { if (soap_s2LONG64(soap, soap_value(soap), p)) - return NULL; - } - p = (LONG64*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(LONG64), 0, 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 (*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)) - 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 (p) - { if (soap_s2byte(soap, soap_value(soap), p)) - return NULL; - } - p = (char*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(char), 0, 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 (*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)) - 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 (p) - { if (soap_s2short(soap, soap_value(soap), p)) - return NULL; - } - p = (short*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(short), 0, 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) -{ const char *s; - if (soap_isnan((double)n)) - s = "NaN"; - else if (soap_ispinff(n)) - s = "INF"; - else if (soap_isninff(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->float_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 (!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 - { -#ifdef HAVE_STRTOD - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#ifdef HAVE_SSCANF - if (sscanf(s, soap->float_format, 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)) - 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 (p) - { if (soap_s2float(soap, soap_value(soap), p)) - return NULL; - } - p = (float*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(float), 0, 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) -{ const char *s; - if (soap_isnan(n)) - s = "NaN"; - else if (soap_ispinfd(n)) - s = "INF"; - else if (soap_isninfd(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->double_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 (!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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#ifdef HAVE_SSCANF - if (sscanf(s, soap->double_format, 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)) - 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 (p) - { if (soap_s2double(soap, soap_value(soap), p)) - return NULL; - } - p = (double*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(double), 0, 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 (*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)) - 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 (p) - { if (soap_s2unsignedByte(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned char*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned char), 0, 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_unsignedShort2s(struct soap *soap, unsigned short n) -{ return soap_unsignedLong2s(soap, (unsigned long)n); -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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 WITH_LEAN -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 (*r || n > 65535) - soap->error = SOAP_TYPE; - *p = (unsigned short)n; - } - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -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)) - 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 (p) - { if (soap_s2unsignedShort(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned short*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned short), 0, 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; - *p = (unsigned int)soap_strtoul(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2unsignedInt(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned int*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned int), 0, 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; - *p = soap_strtoul(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2unsignedLong(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned long*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned long), 0, 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 && sscanf(s, SOAP_ULONG_FORMAT, p) != 1) - 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)) - 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 (p) - { if (soap_s2ULONG64(soap, soap_value(soap), p)) - return NULL; - } - p = (ULONG64*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(ULONG64), 0, 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) -{ *t = NULL; - if (s && !(*t = soap_strdup(soap, s))) - soap->error = SOAP_EOM; - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2QName(struct soap *soap, const char *s, char **t) -{ if (s) - { struct soap_nlist *np; - const char *p; - if (!strncmp(s, "xml:", 4)) - { *t = soap_strdup(soap, s); - return SOAP_OK; - } - np = soap->nlist; - p = strchr(s, ':'); - if (p) - { register int n = p - s; - while (np && (strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { register const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - return s; - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%lu", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#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 - || 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)) - return NULL; - if (!p) - if (!(p = (char**)soap_malloc(soap, sizeof(char*)))) - return NULL; - 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; - } - else - *p = NULL; - 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 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 - || 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 - -/******************************************************************************/ -#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)) - return NULL; - 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; - } - else - *p = NULL; - 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 - -/******************************************************************************/ -#ifndef WITH_LEAN -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#elif defined(HAVE_GETTIMEOFDAY) - struct timezone t; - struct timeval tv; - memset((void*)&t, 0, sizeof(t)); - gettimeofday(&tv, &t); - T->tm_min -= t.tz_minuteswest - (t.tz_dsttime != 0)*60; - T->tm_isdst = 0; - return mktime(T); -/* WR[ */ - /* The following define was added for VxWorks*/ -#elif defined(HAVE_MKTIME) - /* FOR VXWORKS: - vxWorks does not seem to have any variable representation of time zones, but - timezone information can be set in INSTALL_DIR/target/h/private/timeP.h header - file, by setting the ZONEBUFFER define. The ZONEBUFFER define follows this - format: - name_of_zone:<(unused)>:time_in_minutes_from_UTC:daylight_start:daylight_end - To calculate local time, the value of time_in_minutes_from_UTC is subtracted - from UTC; time_in_minutes_from_UTC must be positive. Daylight information is - expressed as mmddhh (month-day-hour), for example: - UTC::0:040102:100102 - */ - return mktime(T); -/* ]WR */ -#elif defined(HAVE_FTIME) - struct timeb t; - memset((void*)&t, 0, sizeof(t)); - t.timezone = 0; - t.dstflag = -1; - ftime(&t); - T->tm_min -= t.timezone - (t.dstflag != 0)*60; - T->tm_isdst = 0; - return mktime(T); -#else -#warning "time_t (de)serialization is not MT safe on this platform" - time_t t; - char *tz = getenv("TZ"); - putenv("TZ=UTC"); - tzset(); - t = mktime(T); - if (tz) - { char tmp[16]; - strcpy(tmp, "TZ="); - strncat(tmp, tz, 12); - tmp[15] = '\0'; - putenv(tmp); - } - else - putenv("TZ="); - tzset(); - return t; -#endif -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_dateTime2s(struct soap *soap, time_t n) -{ struct tm T; - struct tm *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); -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -/* ]WR */ -#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+(tz.tz_dsttime!=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+(tz.tz_dsttime!=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)) - { ftime(&t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(t.dstflag!=0), abs(t.timezone)%60); - } -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, abs(t.timezone)%60); - } -/* ]WR */ -#else - if ((pT = localtime(&n))) - { ftime(&t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(t.dstflag!=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); -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); -/* ]WR */ -#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) - { struct tm T; - char zone[16]; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - sscanf(s, "%d-%d-%dT%d:%d:%d%15s", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s != 'Z') - { int h = 0, m = 0; - sscanf(s, "%d:%d", &h, &m); - T.tm_hour -= h; - if (h >= 0) - T.tm_min -= m; - else - T.tm_min += m; - } - *p = soap_timegm(&T); - } - else - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - 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)) - 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 (p) - { if (soap_s2dateTime(soap, soap_value(soap), p)) - return NULL; - } - p = (time_t*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(time_t), 0, 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) -{ int i; - const char *t = NULL; - if (tag && *tag != '-') - { if ((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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p && *p) - { if (soap_send(soap, *p)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - return NULL; - 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, 0, -1, -1); - else - *p = NULL; - if (soap->body && soap_element_end_in(soap, tag)) - return NULL; - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_outwliteral(struct soap *soap, const char *tag, wchar_t *const*p) -{ int i; - const char *t = NULL; - wchar_t c; - const wchar_t *s; - if (tag && *tag != '-') - { if (tag && (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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p) - { s = *p; - while ((c = *s++)) - if (soap_pututf8(soap, (unsigned char)c)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#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)) - return NULL; - if (!p) - if (!(p = (wchar_t**)soap_malloc(soap, sizeof(wchar_t*)))) - return NULL; - if (soap->null) - *p = NULL; - else if (soap->body) - *p = soap_wstring_in(soap, 0, -1, -1); - else - *p = 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_value(struct soap *soap) -{ size_t i; - soap_wchar c = 0; - char *s = soap->tmpbuf; - if (!soap->body) - return SOAP_STR_EOS; - for (i = 0; i < sizeof(soap->tmpbuf) - 1; i++) - { c = soap_get(soap); - if (c == SOAP_TT || (int)c == EOF || soap_blank(c)) - break; - *s++ = (char)c; - } - if ((int)c == EOF || c == SOAP_TT) - soap_unget(soap, c); - *s = '\0'; - return soap->tmpbuf; /* return non-null pointer */ -} -#endif - -/******************************************************************************/ -#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') - break; - if ((int)c == EOF) - return soap->error = SOAP_EOF; - *s++ = (char)c; - } - c = soap_getchar(soap); - if (c == '\n') - { *s = '\0'; - if (i+1 == len) /* empty line: end of HTTP header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - else if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - return SOAP_OK; -} -#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; - if (soap->mode & SOAP_ENC_DIME) - { 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 %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); - s = soap_str_code(mime_codes, content->encoding); - /* count Content-Transfer-Encoding: ...\r\n */ - 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->location); - /* count \r\n...content */ - count += 2 + content->size; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of MIME attachment %lu bytes\n", (unsigned long)content->size)); - } - /* count \r\n--boundary--\r\n */ - count += 8 + n; - } - 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] = optype >> 8; - s[1] = optype & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime.type) - typelen = strlen(soap->dime.type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); - tmp[1] = soap->dime.flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime.size >> 24; - tmp[9] = (soap->dime.size >> 16) & 0xFF; - tmp[10] = (soap->dime.size >> 8) & 0xFF; - tmp[11] = 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 (!content->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)soap->dime.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 int i; - register char *s; - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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) -{ struct soap_multipart *content; - if (soap_getdimehdr(soap)) - return soap->error; - 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; - register soap_wchar c; - register char *s; - register int i; - id = soap->dime.id; - type = soap->dime.type; - options = soap->dime.options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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, 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; - return soap->error; -} -#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-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_int_code(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) -{ register soap_wchar c; - if (!soap->mime.last) - return SOAP_OK; - for (;;) - { register size_t i, m = 0; - register char *s; - struct soap_multipart *content = soap->mime.last; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:"", content->type?content->type:"")); - if (soap_new_block(soap)) - return soap->error = SOAP_EOM; - for (;;) - { register char *t = NULL; - if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN))) - return soap->error = SOAP_EOM; - for (i = 0; i < SOAP_BLKLEN; i++) - { if (m > 0) - { *s++ = *t++; - m--; - } - else - { c = soap_get1(soap); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (c == '\r') - { t = soap->tmpbuf; - strcpy(t, "\n--"); - strncat(t, soap->mime.boundary, sizeof(soap->tmpbuf)-3); - t[sizeof(soap->tmpbuf)-1] = '\0'; - do c = soap_getchar(soap); - while (c == *t++); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (!*--t) - goto end; - *t = (char)c; - m = t - soap->tmpbuf + 1; - t = soap->tmpbuf; - c = '\r'; - } - *s++ = (char)c; - } - } - } -end: - *s = '\0'; /* force 0-terminated */ - content->size = soap_size_block(soap, i+1)-1; - content->ptr = soap_save_block(soap, NULL, 0); - if (c == '-' && soap_getchar(soap) == '-') - break; - while (c != '\r' && (int)c != EOF && soap_blank(c)) - c = soap_getchar(soap); - if (c != '\r' || soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - if (soap_getmimehdr(soap)) - return soap->error; - } - do c = soap_getchar(soap); - while ((int)c != EOF && c != '\r'); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - return SOAP_OK; -} -#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:"")); - 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_str_code(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) - 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, "--\r\n"); -} -#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 = 72; - s = soap->mime.boundary = (char*)soap_malloc(soap, n); - if (!s) - return; - } - strcpy(s, "<>"); - s += 2; - n -= 4; - while (n) - { *s++ = soap_base64o[rand()&0x3F]; - n--; - } - *s = '\0'; - strcat(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 = 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 - -/******************************************************************************/ - -#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 && c != ';' && 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++; - n = strlen(path); - for (p = soap->cookies; p; p = p->next) - if (!strcmp(p->name, name) - && domain - && p->domain - && !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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"", domain?domain:"", path?path:"")); - if (!domain) - domain = soap->cookie_domain; - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - return NULL; - } - if (*path == '/') - path++; - q = soap_cookie(soap, name, domain, path); - if (!q) - { if ((q = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - { if ((q->name = (char*)SOAP_MALLOC(strlen(name)+1))) - strcpy(q->name, name); - q->value = NULL; - q->domain = NULL; - q->path = NULL; - q->expire = -1; - q->version = 0; - q->secure = 0; - q->env = 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 && strcmp((*p)->path, path) < 0) - break; - if (n) - { q->next = *p; - *p = q; - } - else - { SOAP_FREE(q->name); - SOAP_FREE(q); - q = NULL; - } - } - } - else - q->modified = 1; - if (q) - { if (q->value) - { SOAP_FREE(q->value); - q->value = NULL; - } - if (q->domain) - { SOAP_FREE(q->domain); - q->domain = NULL; - } - if (q->path) - { SOAP_FREE(q->path); - q->path = NULL; - } - if (value && *value && (q->value = (char*)SOAP_MALLOC(strlen(value)+1))) - strcpy(q->value, value); - if (domain && *domain && (q->domain = (char*)SOAP_MALLOC(strlen(domain)+1))) - strcpy(q->domain, domain); - if (path && *path && (q->path = (char*)SOAP_MALLOC(strlen(path)+1))) - strcpy(q->path, path); - q->session = 1; - } - 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) - { soap_set_receiver_error(soap, "Cookie domain not set", SOAP_STR_EOS, SOAP_HTTP_ERROR); - return; - } - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", SOAP_STR_EOS, SOAP_HTTP_ERROR); - 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(q->value); - if (q->domain) - SOAP_FREE(q->domain); - if (q->path) - SOAP_FREE(q->path); - *p = q->next; - SOAP_FREE(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 -long -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; - if ((p = soap_cookie(soap, name, domain, path))) - { p->expire = 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 || !p->env) - { 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) - sprintf(s, ";Domain=%s", p->domain); - else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) - sprintf(s, ";Domain=%s", soap->cookie_domain); - strcat(s, ";Path=/"); - if (p->path) - t = p->path; - else - t = soap->cookie_path; - if (t) - { if (*t == '/') - t++; - if ((int)strlen(t) < tmp-s+4064) - strcat(s, t); - } - s += strlen(s); - if (p->version > 0) - sprintf(s, ";Version=%u", p->version); - if (p->expire >= 0) - sprintf(s, ";Max-Age=%ld", p->expire); - if (p->secure) - strcat(s, ";Secure"); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set-Cookie: %s\n", tmp)); - if (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; - while ((q = *p)) - { if (q->expire && now > q->expire) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie %s expired\n", q->name)); - SOAP_FREE(q->name); - if (q->value) - SOAP_FREE(q->value); - if (q->domain) - SOAP_FREE(q->domain); - if (q->path) - SOAP_FREE(q->path); - *p = q->next; - SOAP_FREE(q); - } - else if ((!q->domain || !strcmp(q->domain, domain)) - && (!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 && (int)strlen(q->path) < tmp-s+4080) - { sprintf(s, ";$Path=/%s", 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->fposthdr(soap, "Cookie", tmp)) - return soap->error; - p = &q->next; - } - else - 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(strlen(tmp)+1))) - strcpy(t, tmp); - } - else - t = NULL; - if (p) - { if (p->path) - SOAP_FREE(p->path); - p->path = t; - } - else - { if (path) - SOAP_FREE(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(strlen(tmp)+1))) - strcpy(t, tmp); - } - else - t = NULL; - if (p) - { if (p->domain) - SOAP_FREE(p->domain); - p->domain = t; - } - else - { if (domain) - SOAP_FREE(domain); - domain = t; - } - } - else if (p && !soap_tag_cmp(tmp, "Path")) - { if (p->path) - SOAP_FREE(p->path); - s = soap_decode_val(tmp, sizeof(tmp), s); - if (*tmp) - { if ((p->path = (char*)SOAP_MALLOC(strlen(tmp)+1))) - strcpy(p->path, tmp); - } - else - p->path = NULL; - } - else if (p && !soap_tag_cmp(tmp, "Domain")) - { if (p->domain) - SOAP_FREE(p->domain); - s = soap_decode_val(tmp, sizeof(tmp), s); - if (*tmp) - { if ((p->domain = (char*)SOAP_MALLOC(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 = (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:"", p->domain?p->domain:"", p->path?p->path:"", 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(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } - if ((p = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - { p->name = (char*)SOAP_MALLOC(strlen(tmp)+1); - strcpy(p->name, tmp); - s = soap_decode_val(tmp, sizeof(tmp), s); - if (*tmp) - { p->value = (char*)SOAP_MALLOC(strlen(tmp)+1); - strcpy(p->value, tmp); - } - else - p->value = NULL; - p->domain = domain; - p->path = path; - p->expire = 0; - p->secure = 0; - p->version = version; - } - } - } - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"", p->domain?p->domain:"", p->path?p->path:"", 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; - } - if (p->name) - SOAP_FREE(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } - if (domain) - SOAP_FREE(domain); - if (path) - SOAP_FREE(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 *soap) -{ struct soap_cookie *p, **q, *r; - q = &r; - for (p = soap->cookies; p; p = p->next) - { if (!(*q = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - return r; - **q = *p; - if (p->name) - { if (((*q)->name = (char*)SOAP_MALLOC(strlen(p->name)+1))) - strcpy((*q)->name, p->name); - } - if (p->value) - { if (((*q)->value = (char*)SOAP_MALLOC(strlen(p->value)+1))) - strcpy((*q)->value, p->value); - } - if (p->domain) - { if (((*q)->domain = (char*)SOAP_MALLOC(strlen(p->domain)+1))) - strcpy((*q)->domain, p->domain); - } - if (p->path) - { if (((*q)->path = (char*)SOAP_MALLOC(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(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } -} - -/******************************************************************************/ -#endif /* WITH_COOKIES */ - -/******************************************************************************/ -#ifdef WITH_GZIP -#ifndef PALM_1 -static int -soap_getgziphdr(struct soap *soap) -{ int i; - soap_wchar c, 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)f != 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; - soap->error = SOAP_OK; - soap_free(soap); - soap_set_local_namespaces(soap); - soap->version = 0; /* don't assume we're parsing SOAP content by default */ - soap_free_iht(soap); - if ((soap->imode & SOAP_IO) == SOAP_IO_CHUNK) - soap->omode |= SOAP_IO_CHUNK; - soap->imode &= ~SOAP_IO; - 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->userid = NULL; - soap->passwd = NULL; - soap->action = NULL; - soap->authrealm = 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; -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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; - 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")); - 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 - 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 - { while (soap_blank(c)) - c = soap_getchar(soap); - } - if ((int)c == EOF) - return soap->error = SOAP_EOF; - soap_unget(soap, c); - if (c != '<' && !(soap->mode & (SOAP_ENC_DIME | SOAP_ENC_ZLIB))) - { soap->mode &= ~SOAP_IO; - if ((soap->error = soap->fparse(soap))) - { soap->keep_alive = 0; /* force close later */ - return soap->error; - } - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) - { soap->chunkbuflen = soap->buflen; - soap->buflen = soap->bufidx; - soap->chunksize = 0; - } - else if (soap->fpreparerecv && soap->buflen != soap->bufidx) - soap->fpreparerecv(soap, soap->buf + soap->bufidx, soap->buflen - soap->bufidx); -#ifdef WITH_ZLIB - if (soap->zlib_in) - { /* fparse should not use soap_unget to push back last char */ -#ifdef WITH_GZIP - 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->zlib_state = SOAP_ZLIB_INFLATE; - soap->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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 - } -#ifndef WITH_LEANER - if (soap->mode & SOAP_ENC_MIME) - { if (soap_getmimehdr(soap)) - return soap->error; - 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 PALM_1 -static int -http_parse(struct soap *soap) -{ char header[SOAP_HDRLEN], *s; - unsigned short g = 0, k; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for response...\n")); - *soap->endpoint = '\0'; - soap->length = 0; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return soap->error; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP status: %s\n", soap->msgbuf)); - for (;;) - { if (soap_getline(soap, header, SOAP_HDRLEN)) - return soap->error; - if (!*header) - break; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "HTTP header: %s\n", header)); - s = strchr(header, ':'); - if (s) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - if ((soap->error = soap->fparsehdr(soap, header, s))) - return soap->error; - } - } - if ((s = strchr(soap->msgbuf, ' '))) - k = (unsigned short)soap_strtoul(s, NULL, 10); - else - k = 0; - } while (k == 100); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Finished HTTP header parsing\n")); - 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 (s && (((g = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!g); - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!g), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (g) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - return SOAP_OK; - } - if (k == 0 || (k >= 200 && k <= 299) || k == 400 || k == 500) - return SOAP_OK; - return soap_set_receiver_error(soap, "HTTP error", soap->msgbuf, k); -} -#endif - -/******************************************************************************/ -#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")) - { if (soap_get_header_attribute(soap, val, "application/dime")) - soap->mode |= SOAP_ENC_DIME; - else if (soap_get_header_attribute(soap, val, "multipart/related")) - { 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->mode |= SOAP_ENC_MIME; - } - } -#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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 *")) - { size_t 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[0] && val[1]) - { soap->action = soap_strdup(soap, val + 1); - soap->action[strlen(soap->action) - 1] = '\0'; - } - } - else if (!soap_tag_cmp(key, "Location")) - { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); - soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; - } -#ifdef WITH_COOKIES - else if (!soap_tag_cmp(key, "Cookie") || !soap_tag_cmp(key, "Set-Cookie")) - soap_getcookies(soap, val); -#endif - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 (soap_notblank(*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 - -/******************************************************************************/ -#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) - { const char *s; - if (soap->mode & SOAP_ENC_DIME) - s = "application/dime"; - else if (soap->version == 2) - s = "application/soap+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->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)) + ((strlen(soap->dime.type)+3)&(~3)); - } - if (soap->mode & SOAP_ENC_DIME) - 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 -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)) - return soap->error = SOAP_VERSIONMISMATCH; - 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(p[1].out); - if ((p[1].out = (char*)SOAP_MALLOC(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(p[1].out); - if ((p[1].out = (char*)SOAP_MALLOC(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) -{ if (soap_element_end_in(soap, "SOAP-ENV:Envelope")) - return soap->error; - soap->part = SOAP_END_ENVELOPE; - return SOAP_OK; -} -#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; - if (soap_element(soap, "SOAP-ENV:Body", 0, NULL)) - return soap->error; - if ((soap->mode & SOAP_XML_SEC) && soap_attribute(soap, "id", "_0")) - 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_IN_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; - return soap_element_begin_in(soap, "SOAP-ENV:Body", 0); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_body_end_in(struct soap *soap) -{ if (soap_element_end_in(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_recv_header(struct soap *soap) -{ if (soap_getheader(soap) && soap->error == SOAP_TAG_MISMATCH) - soap->error = SOAP_OK; - 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'; - *soap->host = '\0'; - *soap->path = '\0'; - soap->port = 80; - if (!endpoint || !*endpoint) - return; -#ifdef WITH_OPENSSL - if (!strncmp(endpoint, "https:", 6)) - soap->port = 443; -#endif - strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); - 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; -/* WR[ */ -#ifdef WITH_IPV6 - if ('[' == s[0]) - { s++; - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (']' == s[i]) - { - s++; - break; - } - } - } - else - { for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (s[i] == '/' || s[i] == ':') - break; - } - } -#else /* WITH_IPV6 */ -/* ]WR */ - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (s[i] == '/' || s[i] == ':') - break; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - soap->host[i] = '\0'; - if (s[i] == ':') - { soap->port = (int)atol(s + i + 1); - for (i++; i < n; i++) - if (s[i] == '/') - break; - } - if (s[i]) - { strncpy(soap->path, s + i + 1, 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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - soap->error = SOAP_OK; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - soap_set_endpoint(soap, endpoint); - if (action) - soap->action = soap_strdup(soap, action); - if (soap->fconnect) - { - if ((soap->error = soap->fconnect(soap, endpoint, soap->host, soap->port))) - return soap->error; - } - else if (*soap->host) - { soap->status = http_command; - if (!soap_valid_socket(soap->socket) || strcmp(soap->host, host) || soap->port != port) - { soap->keep_alive = 0; /* force close */ - soap_closesock(soap); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Connect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); - 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); - } - else if (!soap->keep_alive || !soap->fpoll || soap->fpoll(soap)) - { soap->keep_alive = 0; /* force close */ - soap_closesock(soap); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reconnect to host='%s' path='%s' port=%d\n", soap->host, soap->path, soap->port)); - soap->socket = soap->fopen(soap, endpoint, soap->host, soap->port); - if (soap->error) - return soap->error; - } - } - if (soap_begin_send(soap)) - return soap->error; - count = soap_count_attachments(soap); - 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; - if ((k & SOAP_IO) == SOAP_IO_CHUNK) - { if (soap_flush(soap)) - return soap->error; - } - soap->mode = k; - } - if (http_command != SOAP_POST) - return soap_end_send(soap); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_s2base64(struct soap *soap, const unsigned char *s, char *t, size_t n) -{ register size_t i; - register unsigned long m; - register char *p; - if (!t) - t = (char*)soap_malloc(soap, (n + 2) / 3 * 4 + 1); - if (!t) - { soap->error = SOAP_EOM; - 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, size_t *n) -{ register int i, j, c; - register unsigned long m; - char *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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } - *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 PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_puthttphdr(struct soap *soap, int status, size_t count) -{ register const char *s; - register int err; - if (status == SOAP_FILE) - s = soap->http_content; - else if (status == SOAP_HTML) - s = "text/html; charset=utf-8"; -#ifndef WITH_LEANER - else if (soap->mode & SOAP_ENC_DIME) - s = "application/dime"; -#endif - else if (soap->version == 2) - s = "application/soap+xml; charset=utf-8"; - else - s = "text/xml; charset=utf-8"; -#ifndef WITH_LEANER - if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->mime.start && soap->status != SOAP_GET) - { sprintf(soap->tmpbuf, "multipart/related; boundary=\"%s\"; type=%s; start=\"%s\"", soap->mime.boundary, s, soap->mime.start); - s = soap->tmpbuf; - } -#endif - if ((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", "gzip"); -#else - err = soap->fposthdr(soap, "Content-Encoding", "deflate"); -#endif - if (err) - return err; - } -#endif - if ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK) - err = soap->fposthdr(soap, "Transfer-Encoding", "chunked"); - else if (count > 0) - { 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 - -/******************************************************************************/ -#ifndef PALM_1 -static int -http_get(struct soap *soap) -{ return SOAP_GET_METHOD; -} -#endif - -/******************************************************************************/ -#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"; - count = 0; - } - else - s = "POST"; -#ifdef PALM - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) -#else - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6))) -#endif - return SOAP_OK; - if (soap->proxy_host && strncmp(endpoint, "https:", 6)) - sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); - else - sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, path, soap->http_version); - if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return err; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) - || (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, 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, 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 (action && soap->version == 1) - { sprintf(soap->tmpbuf, "\"%s\"", action); - if ((err = soap->fposthdr(soap, "SOAPAction", soap->tmpbuf))) - return err; - } - return soap->fposthdr(soap, NULL, NULL); -} -#endif - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#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 - -/******************************************************************************/ -#ifndef PALM_1 -static int -http_response(struct soap *soap, int status, size_t count) -{ register int err; -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - httpOutputEnable(soap->rpmreqid); -#endif /* WMW_RPM_IO */ -/* ]WR */ - if (!status || status == SOAP_HTML || status == SOAP_FILE) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "OK 200\n")); -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ -#else -/* ]WR */ - if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ -/* WR[ */ -#endif /* WMW_RPM_IO */ -/* ]WR */ - { sprintf(soap->tmpbuf, "HTTP/%s 200 OK", soap->http_version); - if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return err; - } - else if ((err = soap->fposthdr(soap, "Status", "200 OK"))) - 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; - if (status == 401) - { sprintf(soap->tmpbuf, "Basic realm=\"%s\"", soap->authrealm ? 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; - } - } - else - { const char *s = *soap_faultcode(soap); - if (soap->version == 2 && !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)); -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ -#else -/* ]WR */ - if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ -/* WR[ */ -#endif /* WMW_RPM_IO */ -/* ]WR */ - { 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; - } - if ((err = soap->fposthdr(soap, "Server", "gSOAP/2.7")) - || (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 - -/******************************************************************************/ -#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_IO; - soap->omode |= SOAP_IO_STORE; - } - soap->status = status; - count = soap_count_attachments(soap); - if (soap_begin_send(soap)) - return soap->error; - 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; - if ((n & SOAP_IO) == SOAP_IO_CHUNK) - { if (soap_flush(soap)) - return soap->error; - } - soap->mode = n; - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -static const char* -soap_set_validation_fault(struct soap *soap, const char *s, const char *t) -{ sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element <%s>", s, t?t:SOAP_STR_EOS, soap->tag); - 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 (!*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_TAG_END: - *s = soap_set_validation_fault(soap, "incorrect end tag", NULL); - break; - case SOAP_TYPE: - *s = soap_set_validation_fault(soap, "data type mismatch ", soap->type); - break; - case SOAP_SYNTAX_ERROR: - *s = "Well-formedness constraint violation"; - break; - case SOAP_NO_TAG: - *s = "No XML element tag found"; - 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 = "SOAP version mismatch or invalid SOAP message"; - break; - case SOAP_DATAENCODINGUNKNOWN: - *c = "SOAP-ENV:DataEncodingUnknown"; - *s = "Unsupported SOAP data encoding"; - break; - case SOAP_NAMESPACE: - *s = soap_set_validation_fault(soap, "namespace mismatch", NULL); - 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_GET_METHOD: - *s = "HTTP GET method not implemented"; - break; - case SOAP_EOM: - *s = "Out of memory"; - 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_MULTI_ID: - *s = soap_set_validation_fault(soap, "multiple definitions of id ", soap->id); - break; - case SOAP_MISSING_ID: - *s = soap_set_validation_fault(soap, "missing id for ref ", soap->id); - break; - case SOAP_HREF: - *s = soap_set_validation_fault(soap, "incompatible object ref ", soap->id); - break; - case SOAP_FAULT: - break; - case SOAP_TCP_ERROR: - *s = tcp_error(soap); - break; - case SOAP_HTTP_ERROR: - *s = "HTTP error"; - break; - case SOAP_SSL_ERROR: - *s = "SSL error"; - break; - case SOAP_PLUGIN_ERROR: - *s = "Plugin registry error"; - break; - case SOAP_DIME_MISMATCH: - *s = "DIME version/transmission error"; - break; - case SOAP_DIME_END: - *s = "End of DIME error"; - break; - case SOAP_DIME_ERROR: - *s = "DIME format error"; - break; - case SOAP_MIME_ERROR: - *s = "MIME format error"; - break; - case SOAP_ZLIB_ERROR: -#ifdef WITH_ZLIB - sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream.msg?soap->d_stream.msg:""); - *s = soap->msgbuf; -#else - *s = "Zlib not installed for required message (de)compression"; -#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, "a min/maxOccurs violation was detected", NULL); - break; - case SOAP_LENGTH: - *s = soap_set_validation_fault(soap, "content length violation", NULL); - break; -#endif - case SOAP_EOF: - sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); - *s = soap->msgbuf; - break; - default: - if (soap->error > 200 && soap->error < 600) - { sprintf(soap->msgbuf, "HTTP Error: '%s'", http_error(soap, soap->error)); - *s = soap->msgbuf; - } - else - { sprintf(soap->msgbuf, "Error code %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)) && (!soap->fpoll || soap->fpoll(soap) == SOAP_OK)) - { 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); - } - 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 PALM_1 -static const char* -soap_strerror(struct soap *soap) -{ int err = soap->errnum; - if (!err) - err = soap_errno; - if (err) - { -#ifndef UNDER_CE - return strerror(err); -#else - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)&soap->werrorstr, sizeof(soap->werrorstr), NULL); - wcstombs(soap->errorstr, soap->werrorstr, sizeof(soap->errorstr)); - return soap->errorstr; -#endif - } - return "Operation interrupted or timed out"; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_set_error(struct soap *soap, const char *faultcode, const char *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - 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 *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultstring, const char *faultdetail) -{ char *s = NULL, *t = NULL; - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - return soap_set_error(soap, faultcode, s, t, SOAP_FAULT); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault(struct soap *soap, FILE *fd) -{ if (soap->error) - { const char **s; - if (!*soap_faultcode(soap)) - soap_set_fault(soap); - fprintf(fd, "SOAP FAULT: %s\n\"%s\"\n", *soap_faultcode(soap), *soap_faultstring(soap)); - s = soap_faultdetail(soap); - if (s && *s) - fprintf(fd, "Detail: %s\n", *s); - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault_location(struct soap *soap, FILE *fd) -{ -#ifndef WITH_LEAN - int c; - if (soap->error && soap->buflen > 0) - { if (soap->bufidx == 0) - soap->bufidx = 1; - c = soap->buf[soap->bufidx - 1]; - soap->buf[soap->bufidx - 1] = '\0'; - if (soap->buflen - soap->bufidx > 1024) - soap->buf[soap->bufidx + 1024] = '\0'; - else - soap->buf[soap->buflen - 1] = '\0'; - fprintf(fd, "%s%c\n** HERE **\n", soap->buf, c); - if (soap->bufidx < soap->buflen) - fprintf(fd, "%s\n", soap->buf + soap->bufidx); - } -#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(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(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 - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.h deleted file mode 100644 index ff1d52d..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0.h +++ /dev/null @@ -1,1764 +0,0 @@ -/* - -stdsoap2.h 2.7.0d - -gSOAP runtime environment. - -gSOAP XML Web services tools -Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved. - -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]) : - - vxWorks compatible - - Support for IPv6. - --------------------------------------------------------------------------------- -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-2004, 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 --------------------------------------------------------------------------------- -*/ - -#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_BEGIN_NAMESPACE -# define SOAP_BEGIN_NAMESPACE(name) -#endif - -#ifndef SOAP_END_NAMESPACE -# define SOAP_END_NAMESPACE(name) -#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_FMAC4 /* (de)serializer declaration macro */ -# define 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 - -#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 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__) -# define PALM -#endif - -#ifdef __hpux -# define HP_UX -#endif - -#ifdef __alpha -# define TRU64 -#endif - -#ifdef __MVS__ -# define OS390 -#endif - -#ifdef _AIX -# define __socklen_t_defined -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -#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 -# 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_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(_AIXVERSION_431) -# 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(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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_GETTIMEOFDAY -# define HAVE_RAND_R -# define HAVE_GMTIME_R -# define HAVE_LOCALTIME_R -# define HAVE_WCTOMB -# define HAVE_MBTOWC -# 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__) -# 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_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 -# elif defined(MAC_CARBON) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# 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 -# 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 -# elif defined(VXWORKS) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_RAND_R -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# 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_MB -# 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 - -#if defined(TRU64) -# define SOAP_LONG_FORMAT "%ld" -# define SOAP_ULONG_FORMAT "%lu" -#elif defined(WIN32) -# define SOAP_LONG_FORMAT "%I64d" -# define SOAP_ULONG_FORMAT "%I64u" -#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 - -#ifndef SOAP_MALLOC /* use libc malloc */ -# define SOAP_MALLOC(n) malloc(n) -#endif - -#ifndef SOAP_FREE /* use libc free */ -# define SOAP_FREE(p) free(p) -#endif - -#include - -#ifndef PALM -# include -# include -#endif - -#include -#include - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# include -# include - using namespace std; -#endif - -#ifndef UNDER_CE -# ifndef PALM -# include -# ifndef MAC_CARBON -# 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 MAC_CARBON -# ifndef WIN32 -# ifndef PALM -# include -# ifdef VXWORKS -# include -# endif -# ifndef VXWORKS -# ifndef SYMBIAN -# include -# endif -# endif -# ifdef SUN_OS -# include /* SUN */ -# include /* SUN < 2.8 (?) */ -# endif -# ifdef VXWORKS -# include -# else -# include -# endif -# include -# ifdef OS390 -# include -# else -# include /* TCP_NODELAY */ -# endif -# include -# endif -# endif -#endif - -#ifdef WITH_FASTCGI -# include -#endif - -#ifdef WITH_OPENSSL -# define OPENSSL_NO_KRB5 -# 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 PALM -# include /* for isnan() */ -#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 - -#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++]) -#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)->mode = (soap)->imode |= (n)) -#define soap_clr_imode(soap, n) ((soap)->mode = (soap)->imode &= ~(n)) -#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) -#define soap_set_omode(soap, n) ((soap)->mode = (soap)->omode |= (n)) -#define soap_clr_omode(soap, n) ((soap)->mode = (soap)->omode &= ~(n)) -#define soap_destroy(soap) soap_delete((soap), NULL) - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -/* WR[ */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -/* ]WR */ -# ifndef MAC_CARBON -# ifndef PALM -# include -# include -# include -# include -# endif -# endif -#endif - -#ifdef WIN32 -# define SOAP_SOCKET SOCKET -#else -# define SOAP_SOCKET int -# define closesocket(n) close(n) -#endif - -#define soap_valid_socket(n) ((n) >= 0) -#define SOAP_INVALID_SOCKET (-1) - -#if defined(SYMBIAN) -# define LONG64 long -# define ULONG64 unsigned LONG64 -#elif !defined(WIN32) -# define LONG64 long long -# define ULONG64 unsigned LONG64 -#elif defined(UNDER_CE) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#elif defined(__BORLANDC__) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#endif - -#if defined(WIN32) -# define soap_int32 __int32 -#elif defined(SYMBIAN) -# define soap_int32 long -#elif defined(PALM) -# define soap_int32 Int32 -#else -# define soap_int32 int32_t -#endif - -/* UCS-4 requires 32 bits (0-7FFFFFFF, the sign bit is used by gSOAP to distinguish XML entities) */ -typedef soap_int32 soap_wchar; - -#ifdef WIN32 -# define SOAP_EINTR WSAEINTR -# define SOAP_EAGAIN WSAEWOULDBLOCK -# define SOAP_EWOULDBLOCK WSAEWOULDBLOCK -# define SOAP_EINPROGRESS WSAEINPROGRESS -#else -# define SOAP_EINTR EINTR -# define SOAP_EAGAIN EAGAIN -# 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 GetLastError() -# else -# define soap_errno GetLastError() -# define soap_socket_errno WSAGetLastError() -# endif -#else -# define soap_errno errno -# define soap_socket_errno errno -#endif - -#ifndef SOAP_BUFLEN -# ifndef WITH_LEAN -# define SOAP_BUFLEN (32768) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -#endif -#ifndef SOAP_LABLEN -# ifndef WITH_LEAN -# define SOAP_LABLEN (256) /* initial look-aside buffer length */ -# else -# define SOAP_LABLEN (64) -# endif -#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 (16) -# 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 (199) -# endif -#endif -#ifndef SOAP_BLKLEN -# define SOAP_BLKLEN (256) /* size of blocks to collect long strings and XML attributes */ -#endif -#ifndef SOAP_TAGLEN -# define SOAP_TAGLEN (256) /* maximum length of XML element tag/attribute name + 1 */ -#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 -# define SOAP_MAXDIMS (16) /* maximum array dimensions (array nestings) must be less than 64 to protect soap->tmpbuf */ -#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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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 soap_isnan(n) isnan(n) -#endif - -#if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED)) -# define HAVE_ISNAN -#endif - -#ifndef soap_isnan -# ifdef HAVE_ISNAN -# define soap_isnan(n) isnan(n) -# else -# define soap_isnan(_) (0) -# endif -#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 -# ifdef HAVE_ISNAN -# define FLT_NAN (*(float*)&soap_double_nan) -# else -# define FLT_NAN (0.0) -# endif -#endif - -#ifndef FLT_PINFTY -# ifdef FLT_MAX -# define FLT_PINFTY FLT_MAX -# else -# ifdef HUGE_VAL -# define FLT_PINFTY (float)HUGE_VAL -# else -# ifdef FLOAT_MAX -# define FLT_PINFTY FLOAT_MAX -# else -# define FLT_PINFTY (3.40282347e+38) -# endif -# endif -# endif -#endif - -#ifndef FLT_NINFTY -# define FLT_NINFTY (-FLT_PINFTY) -#endif - -#ifndef DBL_NAN -# ifdef HAVE_ISNAN -# define DBL_NAN (*(double*)&soap_double_nan) -# else -# define DBL_NAN (0.0) -# endif -#endif - -#ifndef DBL_PINFTY -# ifdef DBL_MAX -# define DBL_PINFTY DBL_MAX -# else -# ifdef HUGE_VAL -# define DBL_PINFTY (double)HUGE_VAL -# else -# ifdef DOUBLE_MAX -# define DBL_PINFTY DOUBLE_MAX -# else -# define DBL_PINFTY (1.7976931348623157e+308) -# endif -# endif -# endif -#endif - -#ifndef DBL_NINFTY -# define DBL_NINFTY (-DBL_PINFTY) -#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_OBJ_MISMATCH 10 obsolete */ -#define SOAP_TAG_END 10 -#define SOAP_FATAL_ERROR 11 -#define SOAP_FAULT 12 -#define SOAP_NO_METHOD 13 -#define SOAP_GET_METHOD 14 -#define SOAP_EOM 15 -#define SOAP_NULL 16 -#define SOAP_MULTI_ID 17 -#define SOAP_MISSING_ID 18 -#define SOAP_HREF 19 -#define SOAP_TCP_ERROR 20 -#define SOAP_HTTP_ERROR 21 -#define SOAP_SSL_ERROR 22 -#define SOAP_ZLIB_ERROR 23 -#define SOAP_DIME_ERROR 24 -#define SOAP_DIME_HREF 25 -#define SOAP_DIME_MISMATCH 26 -#define SOAP_DIME_END 27 -#define SOAP_MIME_ERROR 28 -#define SOAP_VERSIONMISMATCH 29 -#define SOAP_PLUGIN_ERROR 30 -#define SOAP_DATAENCODINGUNKNOWN 31 -#define SOAP_REQUIRED 32 -#define SOAP_PROHIBITED 33 -#define SOAP_OCCURS 34 -#define SOAP_LENGTH 35 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_MULTI_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_mime_error_check(e) ((e) == SOAP_MIME_ERROR) -#define soap_dime_error_check(e) ((e) == SOAP_DIME_ERROR || (e) == SOAP_DIME_MISMATCH) -#define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || (e) == SOAP_GET_METHOD || ((e) >= 100 && (e) < 600)) - -/* gSOAP HTTP response status codes 100 to 600 are reserved */ - -/* Special gSOAP HTTP response status codes */ - -#define SOAP_STOP 1000 /* No HTTP response */ -#define SOAP_HTML 1001 /* Custom HTML response */ -#define SOAP_FILE 1002 /* Custom file-based response */ - -/* gSOAP HTTP request status codes */ - -#define SOAP_POST 1003 -#define SOAP_GET 1104 - -/* 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_LENGTH 0x00000004 -#define SOAP_IO_KEEPALIVE 0x00000008 - -#define SOAP_ENC_LATIN 0x00800010 /* iso-8859-1 encoding */ -#define SOAP_ENC_XML 0x00000020 /* plain XML encoding, no HTTP header */ -#define SOAP_ENC_DIME 0x00000040 -#define SOAP_ENC_MIME 0x00000080 -#define SOAP_ENC_ZLIB 0x00000100 -#define SOAP_ENC_SSL 0x00000200 - -#define SOAP_XML_STRICT 0x00001000 /* strict validation */ -#define SOAP_XML_CANONICAL 0x00002000 /* C14N canonical XML */ -#define SOAP_XML_TREE 0x00004000 -#define SOAP_XML_GRAPH 0x00008000 -#define SOAP_XML_NIL 0x00010000 -#define SOAP_XML_DOM 0x00020000 -#define SOAP_XML_SEC 0x00040000 /* reserved for WS security */ - -#define SOAP_C_NOIOB 0x00100000 -#define SOAP_C_UTFSTRING 0x00200000 -#define SOAP_C_MBSTRING 0x00400000 - -#define SOAP_DOM_TREE 0x01000000 -#define SOAP_DOM_NODE 0x02000000 - -#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_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION - -/* */ - -#define SOAP_BEGIN 0 -#define SOAP_IN_ENVELOPE 2 -#define SOAP_IN_HEADER 3 -#define SOAP_END_HEADER 4 -#define SOAP_IN_BODY 5 -#define SOAP_END_BODY 6 -#define SOAP_END_ENVELOPE 7 -#define SOAP_END 8 - -/* DEBUG macros */ - -#ifndef WITH_LEAN -# ifdef DEBUG -# ifndef SOAP_DEBUG -# define SOAP_DEBUG -# endif -# endif -#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(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(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 -#else -# define DBGLOG(DBGFILE, CMD) -# define DBGMSG(DBGFILE, MSG, LEN) -#endif - -struct Namespace -{ const char *id; - const char *ns; - const char *in; - char *out; -}; - -struct soap_nlist -{ struct soap_nlist *next; - unsigned int 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 */ -}; - -struct soap_blist -{ struct soap_blist *next; - char *ptr; - size_t size; -}; - -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; -}; - -/* class allocation list */ -struct soap_clist -{ struct soap_clist *next; - void *ptr; - int type; - int size; - void (*fdelete)(struct soap_clist*); -}; - -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 */ -}; - -struct soap_cookie -{ struct soap_cookie *next; - char *name; - char *value; - char *domain; - char *path; - long expire; /* client-side: local time to expire; server-side: seconds to expire */ - unsigned int version; - short secure; - short session; /* server-side */ - short env; /* server-side: got cookie from client */ - short modified; /* server-side: client cookie was modified */ -}; - -#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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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 - -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 -}; - -struct soap_mime -{ char *boundary; /* MIME boundary */ - const char *start; /* MIME start ID */ - 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 -}; - -/* 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 -}; - -/* 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 */ - 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 -}; - -struct soap_dom_attribute -{ struct soap_dom_attribute *next; - const char *nstr; - char *name; - char *data; - wchar_t *wide; - struct soap *soap; -#ifdef __cplusplus - 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 - 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 -}; - -#ifdef __cplusplus -class soap_dom_iterator -{ public: - struct soap_dom_element *elt; - const char *nstr; - const char *name; - int type; - bool operator==(const soap_dom_iterator&) const; - bool operator!=(const soap_dom_iterator&) const; - struct soap_dom_element &operator*() const; - soap_dom_iterator &operator++(); - soap_dom_iterator(); - soap_dom_iterator(struct soap_dom_element*); - ~soap_dom_iterator(); -}; -#endif - -struct soap_dom_element -{ struct soap_dom_element *next; /* next sibling */ - struct soap_dom_element *prnt; /* parent */ - struct soap_dom_element *elts; /* first child element */ - struct soap_dom_attribute *atts; /* first child attribute */ - 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 */ - struct soap *soap; -#ifdef __cplusplus - typedef soap_dom_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_iterator begin(); - soap_dom_iterator end(); - soap_dom_iterator find(const char *nstr, const char *name); - soap_dom_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 -}; - -#if defined(__cplusplus) && !defined(WITH_LEAN) -} -extern ostream &operator<<(ostream&, const struct soap_dom_element&); -extern istream &operator>>(istream&, struct soap_dom_element&); -extern "C" { -#endif - -struct soap -{ short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ - short copy; /* 1 = copy of another soap struct */ - soap_mode mode; - soap_mode imode; - soap_mode omode; - const char *float_format; /* points to user-definable format string for floats (<1024 chars) */ - const char *double_format; /* points to user-definable format string for doubles (<1024 chars) */ - const char *dime_id_format; /* points to 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 */ - 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 list */ - struct soap_ilist *iht[SOAP_IDHASH]; - struct soap_plist *pht[SOAP_PTRHASH]; - struct SOAP_ENV__Header *header; - struct SOAP_ENV__Fault *fault; - 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 (*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 (*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); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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*); - int (*fprepareinit)(struct soap*); - int (*fpreparesend)(struct soap*, const char*, size_t); - int (*fpreparerecv)(struct soap*, const char*, size_t); - int (*fignore)(struct soap*, const char*); - int (*fserveloop)(struct soap*); - void *(*fplugin)(struct soap*, const char*); - 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); - int master; - int socket; -#if defined(__cplusplus) && !defined(WITH_LEAN) - ostream *os; - istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#endif -#ifndef UNDER_CE - int sendfd; - int recvfd; -#else - FILE *sendfd; - FILE *recvfd; - char errorstr[256]; - wchar_t werrorstr[256]; -#endif - size_t bufidx; - size_t buflen; - soap_wchar ahead; - short cdata; - short body; - unsigned int 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 tmpbuf[1024]; /* output buffer for HTTP headers, simpleType values, attribute names, and DIME >=1024 bytes */ - char msgbuf[1024]; /* output buffer for (error) messages <=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 root; - short position; - int positions[SOAP_MAXDIMS]; - struct soap_attribute *attributes; /* attribute list */ - short encoding; - short mustUnderstand; - short null; - short ns; - short part; - short alloced; - short peeked; - short keep_alive; - 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 */ - int port; - unsigned int max_keep_alive; - 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 */ - int status; /* -1 when request, else error code to be returned by server */ - int error; - int errmode; - int errnum; - unsigned long idnum; - unsigned long ip; - struct soap_dime dime; - struct soap_mime mime; - struct soap_dom_element *dom; -#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) - const char *logfile[SOAP_MAXLOGS]; - FILE *fdebug[SOAP_MAXLOGS]; -#endif -#ifndef WITH_LEAN - struct soap_cookie *cookies; - const char *cookie_domain; - const char *cookie_path; - int cookie_max; -#endif -#ifdef WITH_OPENSSL - int (*fsslauth)(struct soap*); - int (*fsslverify)(int, X509_STORE_CTX*); - BIO *bio; - SSL *ssl; - SSL_CTX *ctx; - short require_server_auth; - short require_client_auth; - short rsa; /* when set, use RSA instead of DH */ - const char *keyfile; - const char *password; - const char *dhfile; - const char *cafile; - const char *capath; - const char *randfile; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - uLong z_crc; /* internal gzip crc */ - 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 */ -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - void *rpmreqid; -#endif /* WMW_RPM_IO */ -/* ]WR */ -}; - -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; - void (*fcopy)(struct soap*, int, int, void*, 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 - -#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 - -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_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 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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_accept(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); - -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_receiver_fault(struct soap*, 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*); - - -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 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 void SOAP_FMAC2 soap_begin_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 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*); - -SOAP_FMAC1 const struct soap_code_map* SOAP_FMAC2 soap_code(const struct soap_code_map*, const char *str); -SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code); - -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, void (*fdelete)(struct soap_clist*)); -SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); -SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); - -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, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, const void*, size_t)); -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, 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(int); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_new2(int, int); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*,struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_init(struct soap*); -SOAP_FMAC1 void SOAP_FMAC2 soap_init1(struct soap*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_init2(struct soap*, int, int); -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 soap_wchar SOAP_FMAC2 soap_advance(struct soap*); -SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_skip(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 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); - -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 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); -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); - -SOAP_FMAC1 int SOAP_FMAC2 soap_match_namespace(struct soap*, const char *, const char*, int n1, int n2); - -SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, struct Namespace*); - -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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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_fault(struct soap*); - -SOAP_FMAC1 int SOAP_FMAC2 soap_recv_fault(struct soap*); - -SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*); -SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*); - -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_s2dateTime(struct soap*, const char*, time_t*); -SOAP_FMAC1 int SOAP_FMAC2 soap_s2string(struct soap*, const char*, char**); -SOAP_FMAC1 int SOAP_FMAC2 soap_s2QName(struct soap*, const char*, char**); - -SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, size_t); - -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_dateTime2s(struct soap*, time_t); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_QName2s(struct soap*, const char*); - -SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, size_t*); - -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 time_t* SOAP_FMAC2 soap_indateTime(struct soap*, const char *tag, time_t *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 wchar_t** SOAP_FMAC2 soap_inwstring(struct soap*, const char *tag, wchar_t **p, const char *, int, long, long); -SOAP_FMAC1 char** SOAP_FMAC2 soap_inliteral(struct soap*, const char *tag, char **p); -SOAP_FMAC1 wchar_t** SOAP_FMAC2 soap_inwliteral(struct soap*, const char *tag, wchar_t **p); - -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_outdateTime(struct soap*, const char *tag, int id, const time_t *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_outwstring(struct soap*, const char *tag, int id, wchar_t *const*p, const char *, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_outliteral(struct soap*, const char *tag, char *const*p); -SOAP_FMAC1 int SOAP_FMAC2 soap_outwliteral(struct soap*, const char *tag, wchar_t *const*p); - -#ifndef WITH_LEANER -SOAP_FMAC1 int SOAP_FMAC2 soap_element_dime(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 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); -#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 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 long 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*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.c deleted file mode 100644 index b4750a4..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.c +++ /dev/null @@ -1,12026 +0,0 @@ -/* - -stdsoap2.c[pp] 2.7.0f - -Runtime environment. - -gSOAP XML Web services tools -Copyright (C) 2000-2004, Robert van Engelen, Genivia, Inc., All Rights Reserved. - -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - vxWorks compatible - - Support for IPv6. - --------------------------------------------------------------------------------- - - This software is released under one of the following three 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-2004, 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 --------------------------------------------------------------------------------- -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. - -*/ - -#include "stdsoap2.h" - -#ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.0f 2005-02-28 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.0f 2005-02-28 12:00:00 GMT") -#endif - -/* 8bit character representing unknown/nonrepresentable character data (e.g. not supported by current locale) */ -#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_BOM (soap_wchar)(0xFEFF) /* UTF BOM is Unicode FEFF */ - -#define soap_blank(c) ((c) >= 0 && (c) <= 32) -#define soap_notblank(c) ((c) > 32) -#define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) - -static int soap_isxdigit(int); -static soap_wchar soap_char(struct soap*); - -#ifndef WITH_NOIDREF -static void soap_update_ptrs(struct soap*, char*, char*, long); -static int soap_has_copies(struct soap*, const char*, const char*); -static struct soap_ilist *soap_hlookup(struct soap*, 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 - -static int soap_set_error(struct soap*, const char*, const char*, const char*, int); -static int soap_copy_fault(struct soap*, const char*, const char*, const char*); -static int soap_getattrval(struct soap*, char*, size_t, soap_wchar); -static void soap_set_local_namespaces(struct soap*); -static void *fplugin(struct soap*, const char*); - -#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 time_t soap_timegm(struct tm*); -#endif - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -static void soap_close_logfile(struct soap*, int); -static void soap_set_logfile(struct soap*, int, const char*); -#endif - -#ifdef WITH_FAST -static int soap_append_lab(struct soap*, const char*, size_t); -#endif - -#ifndef WITH_LEANER -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*); -#endif - -#ifdef WITH_GZIP -static int soap_getgziphdr(struct soap*); -#endif - -#ifdef WITH_OPENSSL -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -static const char *ssl_error(struct soap*, int); -/* This callback is included for future references. It should not be deleted -static DH *ssl_tmp_dh(SSL*, int, int); -*/ -#endif - -#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) -static const char *soap_decode(char*, size_t, const char*, const char*); -#endif - -#ifndef WITH_NOHTTP -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_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 - -#ifndef WITH_NOIO -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*); -static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr); -static int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); -static int tcp_accept(struct soap*, int, 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 - -/* WR[ */ -#ifdef VXWORKS -static int vx_nonblocking = TRUE; /* ioctl argument */ -#endif -/* ]WR */ - -#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 - -static const char soap_padding[3] = "\0\0"; -#define SOAP_STR_PADDING (soap_padding) -#define SOAP_STR_EOS (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[] = -{ { 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 - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -fsend(struct soap *soap, const char *s, size_t n) -{ register int nwritten; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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)soap->socket, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return SOAP_EOF; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else -#endif -#ifndef PALM - nwritten = send((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { -#ifdef WITH_OPENSSL - int err; - if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return SOAP_EOF; -#endif - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EWOULDBLOCK && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - 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 -/* WR[ */ -#ifdef VXWORKS -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - { httpBlockPut(soap->rpmreqid, s, n); - nwritten = n; - } - else - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); -#else - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); -#endif /* WMW_RPM_IO */ -#else -/* ]WR */ - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -/* WR[ */ -#endif -/* ]WR */ -#endif -#endif - if (nwritten <= 0) - { if (soap_errno != SOAP_EINTR && soap_errno != SOAP_EWOULDBLOCK && soap_errno != SOAP_EAGAIN) - { soap->errnum = soap_errno; - 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_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, n))) - return soap->error = SOAP_EOM; - memcpy(t, s, n); -#ifndef WITH_LEANER - if (soap->fpreparesend) - return 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_flush(struct soap *soap) -{ if (soap->bufidx) - { -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { soap->d_stream.next_in = (Byte*)soap->buf; - soap->d_stream.avail_in = (unsigned int)soap->bufidx; -#ifdef WITH_GZIP - soap->z_crc = crc32(soap->z_crc, (Byte*)soap->buf, (unsigned int)soap->bufidx); -#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:"")); - 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 - if (soap_flush_raw(soap, soap->buf, soap->bufidx)) - return soap->error; - soap->bufidx = 0; - } - return SOAP_OK; -} -#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->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_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; - soap->errnum = 0; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->recv_timeout) - { 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)soap->socket, &fd); - for (;;) - { r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r > 0) - break; - if (r == 0 || soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { int err; - r = SSL_read(soap->ssl, s, n); - if ((err = SSL_get_error(soap->ssl, r)) == SSL_ERROR_NONE) - return (size_t)r; - if (err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return 0; - } - else -#endif - { r = recv((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); - if (r >= 0) - return (size_t)r; - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN && soap_socket_errno != SOAP_EWOULDBLOCK) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#ifndef WITH_LEAN - { struct timeval timeout; - fd_set fd; - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); -#ifdef WITH_OPENSSL - if (soap->ssl && SSL_get_error(soap->ssl, r) == SSL_ERROR_WANT_WRITE) - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#endif - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#endif - } - } -#ifdef WITH_FASTCGI - return fread(s, 1, n, stdin); -#else -#ifdef UNDER_CE - return fread(s, 1, n, soap->recvfd); -#else -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - r = httpBlockRead(soap->rpmreqid, s, n); - else - r = read(soap->recvfd, s, n); - if (r >= 0) - return r; - return 0; -#else -/* ]WR */ - r = read((SOAP_SOCKET)soap->recvfd, s, n); - if (r >= 0) - return (size_t)r; - soap->errnum = soap_errno; - return 0; -/* WR[ */ -#endif -/* ]WR */ -#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; - 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); - 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 (soap->buflen) - { soap->count += soap->buflen; - 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->d_stream.next_out = Z_NULL; - 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; - } - } -#endif -#ifndef WITH_NOHTTP - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ - { -chunk_again: - 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; - } - else - { register soap_wchar c; - char *t, tmp[8]; - t = tmp; - if (!soap->chunkbuflen) - { soap->chunkbuflen = 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); - soap->bufidx = 0; - if (!ret) - return EOF; - } - else - soap->bufidx = soap->buflen; - soap->buflen = soap->chunkbuflen; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Getting chunk size (%u %u)\n", (unsigned int)soap->bufidx, (unsigned int)soap->buflen)); - while (!soap_isxdigit((int)(c = soap_getchunkchar(soap)))) - if ((int)c == EOF) - return 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 EOF; - *t = '\0'; - 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); - return EOF; - } - soap->buflen = soap->bufidx + soap->chunksize; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Moving buf len to %u (%u %s)\n", (unsigned int)soap->buflen, (unsigned int)soap->bufidx, 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 (%lu bytes left)\n", (unsigned long)(soap->buflen - soap->bufidx))); - } - else if (soap->chunkbuflen) - soap->chunksize = 0; - ret = soap->buflen - soap->bufidx; - if (!ret) - goto chunk_again; - } - } - 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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - } - else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:"")); - soap->d_stream.next_out = Z_NULL; - 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; - if (soap->ahead) - { c = soap->ahead; - 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 *map, const char *str) -{ while (map->string) - { if (!strcmp(str, map->string)) /* case sensitive */ - return map; - map++; - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -long -SOAP_FMAC2 -soap_int_code(const struct soap_code_map *map, const char *str, long other) -{ while (map->string) - { if (!soap_tag_cmp(str, map->string)) /* case insensitive */ - return map->code; - map++; - } - return other; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_str_code(const struct soap_code_map *map, long code) -{ while (map->code != code && map->string) - map++; - return map->string; -} -#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_int_code(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR); -#else - return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ -#endif -} -#endif - -/******************************************************************************/ -#ifdef WITH_LEAN -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 - -/******************************************************************************/ -#ifdef WITH_LEAN -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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_get(struct soap *soap) -{ register soap_wchar c; - c = soap->ahead; - if (c) - soap->ahead = 0; - else - c = soap_get1(soap); - for (;;) - { if (soap->cdata) - { if (c == ']') - { c = soap_get1(soap); - if (c == ']') - { soap->cdata = 0; - soap_get1(soap); /* skip > */ - c = soap_get1(soap); - } - else - { soap_revget1(soap); - return ']'; - } - } - else - return c; - } - switch (c) - { case '<': - do c = soap_get1(soap); - while (soap_blank(c)); - if (c == '!' || c == '?' || c == '%') - { 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); - } - } - while ((int)c != EOF && c != '>') - 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 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_advance(struct soap *soap) -{ register soap_wchar c; - while ((int)((c = soap_get(soap)) != EOF) && c != SOAP_LT && c != SOAP_TT) - ; - return c; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_skip(struct soap *soap) -{ register soap_wchar c; - do c = soap_get(soap); - while (soap_blank(c)); - 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 > 0 && c < 0x80) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - 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_get(soap); - if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN)) - return c; - c1 = soap_get(soap); - if (c1 < 0x80) - { soap_unget(soap, c1); - return c; - } - c1 &= 0x3F; - if (c < 0xE0) - return ((soap_wchar)(c & 0x1F) << 6) | c1; - c2 = (soap_wchar)soap_get1(soap) & 0x3F; - 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) -{ /* TODO: serialize to DOM (as an option) using new soap_s2hex() */ - char d[2]; - register int i; - 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_FAST - soap->labidx = 0; - for (;;) - { register char *s; - register int 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, 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, soap->dom->data, 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_FAST - soap->labidx = 0; - for (;;) - { register int i, k; - register char *s; - if (soap_append_lab(soap, NULL, 2)) - return NULL; - s = soap->labbuf + soap->labidx; - k = 3 * ((soap->lablen - soap->labidx) / 3); - soap->labidx = 3 * (soap->lablen / 3); - if (!s) - return NULL; - for (i = 0; i < k; 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#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 -int -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(sizeof(struct soap_blist)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->ptr = *(char**)p; - SOAP_FREE(p); -} -#endif - -/******************************************************************************/ -#ifndef WITH_NOIDREF -#ifndef PALM_1 -static void -soap_update_ptrs(struct soap *soap, char *start, char *end, long offset) -{ int i; - register struct soap_ilist *ip; - register struct soap_flist *fp; - 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 + offset)); - ip->ptr = (char*)ip->ptr + offset; - } - 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 + offset; - } - } - 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 + offset; - } - } - 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 + offset; - } - } - } -} -#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; - register struct soap_flist *fp; - 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; - register struct soap_flist *fp; - 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, p, ip->size); - else - soap_fcopy(soap, ip->type, fp->type, fp->ptr, p, ip->size); - ip->flist = fp->next; - SOAP_FREE(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, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(p); - } - soap->blist = bp->next; - SOAP_FREE(bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); -#ifndef WITH_NOIDREF - if (flag) - soap_update_ptrs(soap, q, q + n, (long)s - (long)q); /* pointers s and q may or may not be related */ -#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); - 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; - n = 1; - do - { attr1++; - 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; - } - } while (attr1 && *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 = 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; - np = (struct soap_nlist*)SOAP_MALLOC(sizeof(struct soap_nlist) + strlen(id)); - if (!np) - return soap->error = SOAP_EOM; - np->next = soap->nlist; - soap->nlist = np; - strcpy(np->id, id); - np->level = soap->level; - np->index = -1; - np->ns = NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns)); - p = soap->local_namespaces; - if (p) - { register short i = 0; - for (; p->id; p++, i++) - { if (p->ns && !strcmp(ns, p->ns)) - { if (p->out) - { SOAP_FREE(p->out); - p->out = NULL; - } - break; - } - if (p->out) - { if (!SOAP_STRCMP(ns, p->out)) - break; - } - else if (p->in) - { if (!soap_tag_cmp(ns, p->in)) - { if ((p->out = (char*)SOAP_MALLOC(strlen(ns) + 1))) - strcpy(p->out, ns); - break; - } - } - } - if (p && p->id) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push OK ('%s' matches '%s' in namespace table)\n", id, p->id)); - np->index = i; - } - } - if (!p || !p->id) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push NOT OK: no match found for '%s' in namespace mapping table (added to stack anyway)\n", ns)); - np->ns = (char*)SOAP_MALLOC(strlen(ns) + 1); - if (!np->ns) - return soap->error = SOAP_EOM; - strcpy(np->ns, ns); - } - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_namespace(struct soap *soap) -{ register struct soap_nlist *np; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - if (soap->nlist->ns) - SOAP_FREE(soap->nlist->ns); - SOAP_FREE(soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int 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 || (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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - return SOAP_OK; - return SOAP_SYNTAX_ERROR; -} -#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) - if (!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; - 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; - if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - } - else if (SOAP_STRCMP(tag1, t + 1)) - return SOAP_TAG_MISMATCH; - else if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - 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 - -/******************************************************************************/ - -#ifdef WITH_OPENSSL -/******************************************************************************/ -#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; - if (dhfile) - { soap->dhfile = dhfile; - soap->rsa = 0; - } - else - { soap->dhfile = NULL; - soap->rsa = 1; - } - soap->randfile = randfile; - soap->require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION); - if (!(err = soap->fsslauth(soap))) - if (sid) - SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, 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->rsa = 0; - soap->randfile = randfile; - soap->require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION); - return soap->fsslauth(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static void -ssl_init() -{ static int done = 0; - if (!done) - { done = 1; - SSL_library_init(); -#ifndef WITH_LEAN - SSL_load_error_strings(); -#endif - if (!RAND_load_file("/dev/urandom", 1024)) - { int r; -#ifdef HAVE_RAND_R - unsigned int s = (unsigned int)time(NULL); -#endif - char buf[SOAP_BUFLEN]; - RAND_seed(buf, sizeof(buf)); - while (!RAND_status()) - { -#ifdef HAVE_RAND_R - r = rand_r(&s); -#else - r = rand(); -#endif - RAND_seed(&r, sizeof(int)); - } - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static const char * -ssl_error(struct soap *soap, int ret) -{ int err = SSL_get_error(soap->ssl, ret); - const char *msg = soap_str_code(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 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) -{ ssl_init(); - 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); - 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/or directory", SOAP_SSL_ERROR); - 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); - 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); - } - } - if (soap->rsa) - { RSA *rsa = RSA_generate_key(512, 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); - } - SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); - SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, 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 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 - /* return 1 to always continue, but unsafe progress will be terminated by SSL */ - return ok; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ int i, r; - 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->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; -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - soap->bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, soap->bio, soap->bio); - i = 100; /* 100 * 0.1 ms retries */ - while ((r = SSL_accept(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - if (i-- <= 0) - break; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - else - { soap->errnum = err; - break; - } - } -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - if (r <= 0) - { soap_set_receiver_error(soap, ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); - soap_closesock(soap); - return SOAP_SSL_ERROR; - } - if (soap->require_client_auth) - { 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 /* 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 - soap_free(soap); - while (soap->clist) - { struct soap_clist *p = soap->clist->next; - SOAP_FREE(soap->clist); - soap->clist = p; - } - 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->copy) - soap->plugins->fdelete(soap, soap->plugins); - SOAP_FREE(soap->plugins); - soap->plugins = p; - } - soap->fplugin = fplugin; -#ifndef WITH_NOHTTP - soap->fpost = http_post; - soap->fget = http_get; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#endif -#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; -#endif - soap->fignore = NULL; - soap->fserveloop = NULL; -#ifdef WITH_OPENSSL - if (soap->session) - { SSL_SESSION_free(soap->session); - soap->session = NULL; - } -#endif - if (!soap->copy) - { if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = NULL; - } -#endif - } -#ifdef SOAP_DEBUG - for (i = 0; i < SOAP_MAXLOGS; i++) - { soap_close_logfile(soap, i); - if (soap->logfile[i]) - { SOAP_FREE((void*)soap->logfile[i]); - soap->logfile[i] = NULL; - } - } -#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_str_code(h_error_codes, soap->errnum); - if (!msg) -#endif - { sprintf(soap->msgbuf, "TCP 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_str_code(h_http_error_codes, status); - if (!msg) - msg = SOAP_STR_EOS; -#endif - return msg; -} -#endif -#endif - -/******************************************************************************/ -/* WR[ */ -#ifndef WITH_IPV6 -/* ]WR */ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -tcp_gethost(struct soap *soap, const char *addr, struct in_addr *inaddr) -{ unsigned long iadd; - struct hostent hostent, *host = &hostent; -/* WR[ */ -#ifdef VXWORKS - int hostint; - char *addrcopy = (char*)malloc(strlen(addr) + 1); /*copy of addr. */ - /* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */ - strncpy(addrcopy, addr, strlen(addr)+1); - iadd = inet_addr(addrcopy); -#else -/* ]WR */ -#if defined(_AIXVERSION_431) || defined(TRU64) - struct hostent_data ht_data; -#endif - iadd = inet_addr(addr); -/* WR[ */ -#endif -/* ]WR */ - if ((int)iadd != -1) - { memcpy(inaddr, &iadd, sizeof(iadd)); -/* WR[ */ -#ifdef VXWORKS - free(addrcopy); -#endif -/* ]WR */ - return SOAP_OK; - } -#if defined(__GLIBC__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - 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); -/* WR[ */ -#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(addrcopy); - if (hostint == ERROR) - { host = NULL; - soap->errnum = soap_errno; - } - free(addrcopy); /*free() is placed after the error checking to assure that - * errno captured is that from hostGetByName() */ -/* ]WR */ -#else - if (!(host = gethostbyname(addr))) - soap->errnum = h_errno; -#endif - if (!host) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Host name not found\n")); - return SOAP_ERR; - } -/* WR[ */ -#ifdef VXWORKS - inaddr->s_addr = hostint; -#else -/* ]WR */ - memcpy(inaddr, host->h_addr, host->h_length); -/* WR[ */ -#endif -/* ]WR */ - return SOAP_OK; -} -#endif -#endif -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ struct sockaddr_in sockaddr; -/* WR[ */ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo resaddr; - struct sockaddr_storage addrstorage; - int err; -#endif /* WITH_IPV6 */ -/* ]WR */ - register int fd; -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->socket)) - soap->fclosesocket(soap, (SOAP_SOCKET)soap->socket); - soap->socket = SOAP_INVALID_SOCKET; - if (tcp_init(soap)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP initialization failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - soap->errmode = 0; -/* WR[ */ -#ifdef WITH_IPV6 - memset((void*)&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - soap->errmode = 2; - if (soap->proxy_host) - err = getaddrinfo(soap->proxy_host, soap_int2s(soap, soap->proxy_port), &hints, &addrinfo); - else - err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); - if (addrinfo) - { resaddr = *addrinfo; - addrstorage = *((struct sockaddr_storage*)addrinfo->ai_addr); - resaddr.ai_addr = (struct sockaddr*)&addrstorage; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_sender_error(soap, gai_strerror(err), "TCP getaddrinfo on proxy host failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - fd = (int)socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol); /* modified to use fd */ - soap->errmode = 0; -#else /* WITH_IPV6 */ -/* ]WR */ - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - if (fd < 0) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP socket failed in tcp_connect()", SOAP_TCP_ERROR); - 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 = 0; - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - if ((soap->connect_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#endif -#endif -/* WR[ */ -#ifndef WITH_IPV6 -/* ]WR */ - memset((void*)&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Open socket %d to host='%s'\n", fd, host)); - soap->errmode = 2; - if (soap->proxy_host) - { if (soap->fresolve(soap, soap->proxy_host, &sockaddr.sin_addr)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP get proxy host by name failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - sockaddr.sin_port = htons((short)soap->proxy_port); - } - else - { if (soap->fresolve(soap, host, &sockaddr.sin_addr)) - { soap_set_sender_error(soap, tcp_error(soap), "TCP get host by name failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - sockaddr.sin_port = htons((short)port); - } - soap->errmode = 0; -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -/* WR[ */ -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, resaddr.ai_addr, resaddr.ai_addrlen)) /* modified to use fd */ -#else /* WITH_IPV6 */ - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr))) -#endif /* WITH_IPV6 */ -/* ]WR */ - { -#ifndef WITH_LEAN - if (soap->connect_timeout && (soap_socket_errno == SOAP_EINPROGRESS || soap_socket_errno == SOAP_EWOULDBLOCK)) - { struct timeval timeout; -#if defined(SOCKLEN_T) - SOCKLEN_T n = sizeof(struct sockaddr_in); -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) - socklen_t n = sizeof(struct sockaddr_in); -#elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) - int n = sizeof(struct sockaddr_in); -#else - size_t n = sizeof(struct sockaddr_in); -#endif - fd_set fds; - 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((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(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", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - n = sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_ERROR, (char*)&soap->errnum, &n) && !soap->errnum) - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - else -#endif - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not connect to host\n")); - soap_set_sender_error(soap, tcp_error(soap), "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - else - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - soap->socket = fd; -#ifdef WITH_OPENSSL - soap->imode &= ~SOAP_ENC_SSL; - soap->omode &= ~SOAP_ENC_SSL; - if (!strncmp(endpoint, "https:", 6)) - { int r; - if (soap->proxy_host) - { unsigned int k = soap->omode; /* make sure we only parse HTTP */ - size_t n = soap->count; /* save the content length */ - soap->omode &= ~SOAP_ENC; /* mask IO and ENC */ - soap->omode |= SOAP_IO_BUFFER; - soap_begin_send(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to proxy server\n")); - sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - 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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - return soap->error; - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - return SOAP_INVALID_SOCKET; - soap->omode = k; - k = soap->imode; - soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ - if (soap_begin_recv(soap)) - return SOAP_INVALID_SOCKET; - soap->imode = k; - soap->count = n; - soap_begin_send(soap); - } - 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); - return SOAP_INVALID_SOCKET; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; - } - 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; - soap->bio = BIO_new_socket((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, soap->bio, soap->bio); -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - { soap_set_sender_error(soap, ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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((SOAP_SOCKET)(soap->socket), &fds); - for (;;) - { int r = select((SOAP_SOCKET)(soap->socket + 1), &fds, NULL, &fds, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connect timeout\n")); - soap_set_sender_error(soap, "Timeout", "TCP connect failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } - continue; - } - } - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if (soap->require_server_auth) - { X509 *peer; - 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); - return SOAP_INVALID_SOCKET; - } - 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); - return SOAP_INVALID_SOCKET; - } - X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); - X509_free(peer); - if (soap_tag_cmp(soap->msgbuf, host)) - { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); - return SOAP_INVALID_SOCKET; - } - } - } -#endif - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_bind(struct soap *soap, const char *host, int port, int backlog) -{ struct sockaddr_in sockaddr; -/* WR[ */ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo resaddr; - struct sockaddr_storage addrstorage; - int err; -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)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; - } -/* WR[ */ -#ifdef WITH_IPV6 - memset((void*)&hints, 0, sizeof(hints)); - hints.ai_family = PF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_PASSIVE; - soap->errmode = 2; - if (host) - err = getaddrinfo(host, soap_int2s(soap, port), &hints, &addrinfo); - else - err = getaddrinfo(NULL, soap_int2s(soap, port), &hints, &addrinfo); - if (NULL != addrinfo) - { - resaddr = *addrinfo; - addrstorage = *((struct sockaddr_storage *) addrinfo->ai_addr); - resaddr.ai_addr = (struct sockaddr *) &addrstorage; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "TCP getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - soap->errmode = 0; - if ((soap->master = socket(resaddr.ai_family, resaddr.ai_socktype, resaddr.ai_protocol)) < 0) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#else /* WITH_IPV6 */ -/* ]WR */ - soap->errmode = 0; - if ((soap->master = (int)socket(AF_INET, SOCK_STREAM, 0)) < 0) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP socket failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#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_SOCKET)soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#endif -#endif -/* WR[ */ -#ifdef WITH_IPV6 - soap->errmode = 0; - if (bind(soap->master, resaddr.ai_addr, resaddr.ai_addrlen) || listen(soap->master, backlog)) - { - soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); - soap_closesock(soap); - soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#else /* WITH_IPV6 */ -/* ]WR */ - memset((void*)&sockaddr, 0, sizeof(sockaddr)); - sockaddr.sin_family = AF_INET; - soap->errmode = 2; - if (host) - { if (soap->fresolve(soap, host, &sockaddr.sin_addr)) - { soap_set_receiver_error(soap, tcp_error(soap), "TCP get host by name failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } - else - sockaddr.sin_addr.s_addr = htonl(INADDR_ANY); - sockaddr.sin_port = htons((short)port); - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, (struct sockaddr*)&sockaddr, sizeof(sockaddr)) || listen((SOAP_SOCKET)soap->master, backlog)) - { soap->errnum = soap_socket_errno; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Could not bind to host\n")); - soap_closesock(soap); - soap_set_receiver_error(soap, tcp_error(soap), "TCP bind failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ -#ifdef WITH_OPENSSL - if (!soap->ctx && (soap->error = soap->fsslauth(soap))) - return SOAP_INVALID_SOCKET; -#endif - 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 sfd, rfd, xfd; - int r; - 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(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, &rfd); - r = select(soap->master + 1, &rfd, &sfd, NULL, &timeout); - } - else - return SOAP_OK; - if (r > 0) - { -#ifdef WITH_OPENSSL - if (soap->ssl) - { if (soap_valid_socket(soap->socket) && FD_ISSET(soap->socket, &rfd)) - { char buf = '\0'; - if (SSL_peek(soap->ssl, &buf, 1) <= 0) - return SOAP_EOF; - } - } -#endif - if (soap_valid_socket(soap->socket) && FD_ISSET(soap->socket, &rfd)) - return SOAP_EOF; - return SOAP_OK; - } - if (r < 0 && (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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 = soap_errno; - return SOAP_EOF; -#else - return SOAP_OK; -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ int fd; -#if defined(SOCKLEN_T) - fd = (int)accept((SOAP_SOCKET)s, a, (SOCKLEN_T*)n); -#elif defined(__socklen_t_defined) || defined(_SOCKLEN_T) || defined(CYGWIN) - fd = (int)accept((SOAP_SOCKET)s, a, (socklen_t*)n); -#elif defined(WIN32) || defined(__APPLE__) || defined(HP_UX) || defined(SUN_OS) || defined(OPENSERVER) || defined(TRU64) || defined(VXWORKS) - fd = (int)accept((SOAP_SOCKET)s, a, n); -#else - fd = (int)accept((SOAP_SOCKET)s, a, (size_t*)n); -#endif -#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 -int -SOAP_FMAC2 -soap_accept(struct soap *soap) -{ -/* WR[ */ -#ifdef WITH_IPV6 - struct sockaddr_storage sockaddr; -#else /* WITH_IPV6 */ -/* ]WR */ - struct sockaddr_in sockaddr; -/* WR[ */ -#endif -/* ]WR */ - int n = (int)sizeof(sockaddr); -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - soap->error = SOAP_OK; - memset((void*)&sockaddr, 0, sizeof(sockaddr)); - soap->socket = SOAP_INVALID_SOCKET; - soap->errmode = 0; - if (soap_valid_socket(soap->master)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->accept_timeout) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - soap_closesock(soap); - soap_set_sender_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -/* WR[ */ -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -/* ]WR */ -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#endif - soap->socket = soap->faccept(soap, soap->master, (struct sockaddr*)&sockaddr, &n); - if (soap_valid_socket(soap->socket)) - { -/* WR[ */ -#ifdef WITH_IPV6 -/* Use soap->host to store the numeric form of the remote host */ - getnameinfo((struct sockaddr*)&sockaddr, 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->host */ - soap->port = 0; /* info stored in soap->host */ -#else /* WITH_IPV6 */ -/* ]WR */ - soap->ip = ntohl(sockaddr.sin_addr.s_addr); - soap->port = (int)ntohs(sockaddr.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)); -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - soap->keep_alive = ((soap->imode & SOAP_IO_KEEPALIVE) != 0); -#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 = 0; - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_LINGER failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } - if ((soap->accept_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_KEEPALIVE failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_SNDBUF failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt SO_RCVBUF failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (setsockopt((SOAP_SOCKET)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP setsockopt TCP_NODELAY failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#endif -#endif - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -/* WR[ */ -#elif defined(VXWORKS) - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&vx_nonblocking)); -/* ]WR */ -#elif defined(PALM) - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); -#elif defined(SYMBIAN) - long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - } - return soap->socket; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); - soap->errnum = soap_socket_errno; - soap_set_receiver_error(soap, tcp_error(soap), "TCP accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } - } - else - { soap_set_receiver_error(soap, tcp_error(soap), "TCP 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); - 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 != 1) - { s = ERR_get_error(); - if (s) - { if (soap_valid_socket(soap->socket)) - { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); - soap->socket = SOAP_INVALID_SOCKET; - } - r = SSL_shutdown(soap->ssl); - } - } - DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); - SSL_free(soap->ssl); - soap->ssl = NULL; - if (s) - return SOAP_SSL_ERROR; - ERR_remove_state(0); - } -#endif - if (soap_valid_socket(soap->socket)) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Closing socket %d\n", soap->socket)); - soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 2); - soap->fclosesocket(soap, (SOAP_SOCKET)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) -{ return closesocket(fd); -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -tcp_shutdownsocket(struct soap *soap, SOAP_SOCKET fd, int 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->socket = SOAP_INVALID_SOCKET; - 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")); - 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*)SOAP_MALLOC(sizeof(struct soap)); - if (soap) - soap_init2(soap, imode, omode); - return soap; -} -#endif - -/******************************************************************************/ -#ifndef WITH_NOIDREF -#ifndef PALM_1 -static void -soap_free_pht(struct soap *soap) -{ register struct soap_plist *pp, *next; - register int i; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free pointer hashtable\n")); - for (i = 0; i < (int)SOAP_PTRHASH; i++) - { for (pp = soap->pht[i]; pp; pp = next) - { next = pp->next; - SOAP_FREE(pp); - } - 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 int h; - register struct soap_plist *pp = *ppp = (struct soap_plist*)SOAP_MALLOC(sizeof(struct soap_plist)); - if (!pp) - return 0; - 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=%lu\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 -void -SOAP_FMAC2 -soap_begin_count(struct soap *soap) -{ soap_clr_attr(soap); - soap_set_local_namespaces(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_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; -#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) - soap->fprepareinit(soap); -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin count phase (socket=%d mode=%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_begin_send(struct soap *soap) -{ soap->error = SOAP_OK; - soap_clr_attr(soap); - soap_set_local_namespaces(soap); - 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 - 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) - soap_new_block(soap); - 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_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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->sendfd, _O_BINARY); -#endif -#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->part = SOAP_BEGIN; - soap->idnum = 0; - soap->level = 0; -#ifdef WITH_ZLIB - soap->z_ratio_out = 1.0; - if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin send phase (socket=%d mode=%x count=%lu)\n", soap->socket, soap->mode, (unsigned long)soap->count)); -#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) - 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Embedded_id %p type=%d id=%d\n", p, t, id)); - if (soap->mode & SOAP_XML_TREE) - return 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_NOIDREF -#ifndef WITH_LEANER -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element_dime(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) -{ 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:"", id, atype?atype:"")); - 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); - } - 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 = soap_new_multipart(soap, &soap->dime.first, &soap->dime.last, (char*)a->__ptr, a->__size); - if (!content) - { soap->error = SOAP_EOM; - return -1; - } - content->id = aid; - content->type = atype; - content->options = aoptions; - pp->mark1 = 3; - } - } - else - pp->mark2 = 3; - return -1; -} -#endif -#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, *p; - register struct soap_flist *fp, *fq; - 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(fp); - } - p = ip->next; - SOAP_FREE(ip); - } - soap->iht[i] = NULL; - } -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIDREF -#ifndef PALM_2 -static struct soap_ilist * -soap_hlookup(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - 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_lookup(struct soap *soap, const char *id) -{ register struct soap_ilist *ip; - ip = soap_hlookup(soap, id); -#ifndef WITH_LEANER - if (!ip && *id != '#' && !strchr(id, ':')) /* try content id "cid:" with DIME attachments */ - { char cid[SOAP_TAGLEN]; - strcpy(cid, "cid:"); - strncat(cid + 4, id, sizeof(cid) - 5); - cid[sizeof(cid) - 1] = '\0'; - ip = soap_hlookup(soap, cid); - } -#endif - return ip; -} -#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(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; - } - return NULL; -} -#endif -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_malloc(struct soap *soap, size_t n) -{ register char *p; - if (!n) - return NULL; - if (!soap) - return SOAP_MALLOC(n); - n += (-(long)n) & 7; - if (!(p = (char*)SOAP_MALLOC(n + sizeof(void*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - /* keep chain of alloced cells for later destruction */ - soap->alloced = 1; - *(void**)(p + n) = soap->alist; - *(size_t*)(p + n + sizeof(void*)) = n; - soap->alist = p + n; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Malloc %u bytes at location %p\n", (unsigned int)n, p)); - return p; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_dealloc(struct soap *soap, void *p) -{ if (!soap) - return; - if (p) - { register char **q; - 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, "Freed data at %p\n", p)); - SOAP_FREE(p); - return; - } - } - soap_delete(soap, p); - } - else - { register char *q; - while (soap->alist) - { q = (char*)soap->alist; - soap->alist = *(void**)q; - q -= *(size_t*)(q + sizeof(void*)); - SOAP_FREE(q); - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Dealloc all data done\n")); - } - /* we must assume these were deallocated: */ - soap->action = NULL; - soap->fault = NULL; - soap->header = NULL; - soap->authrealm = 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 = &soap->clist; - if (p) - { while (*cp) - { if (p == (*cp)->ptr) - { register struct soap_clist *q = *cp; - *cp = q->next; - q->fdelete(q); - SOAP_FREE(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->ptr == (void*)soap->fault) - soap->fault = NULL; /* this was deallocated */ - else if (q->ptr == (void*)soap->header) - soap->header = NULL; /* this was deallocated */ - q->fdelete(q); - SOAP_FREE(q); - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_clist * -SOAP_FMAC2 -soap_link(struct soap *soap, void *p, int t, int n, void (*fdelete)(struct soap_clist*)) -{ register struct soap_clist *cp; - if ((cp = (struct soap_clist*)SOAP_MALLOC(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)); - 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(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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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: id type=%d href type=%d\n", 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*)); - 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*)); - *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, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, 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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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(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; - 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 href='%s'\n", st, tt, (unsigned long)n, p, k, 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*)) -{ struct soap_ilist *ip; - 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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_MULTI_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, 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } -#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_OPENSSL - if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive) - soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ -#else - if (soap_valid_socket(soap->socket) && !soap->keep_alive) - soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); /* Send TCP FIN */ -#endif - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of send message ok\n")); - soap->part = SOAP_END; - soap->count = 0; - 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_MIME) && soap_getmime(soap)) - return soap->error; - soap->mime.list = soap->mime.first; - soap->mime.first = NULL; - soap->mime.last = NULL; - soap->dime.list = soap->dime.first; - soap->dime.first = NULL; - soap->dime.last = NULL; -#endif - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { soap_wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(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; - } - } -#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 - return soap_resolve(soap); -#else - return SOAP_OK; -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free(struct soap *soap) -{ register struct soap_nlist *np; - register struct soap_attribute *tp; - register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { np = soap->nlist->next; - if (soap->nlist->ns) - SOAP_FREE(soap->nlist->ns); - SOAP_FREE(soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attributes\n")); - while (soap->attributes) - { tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap->attributes->value); - SOAP_FREE(soap->attributes); - soap->attributes = tp; - } -#ifdef WITH_FAST - if (soap->labbuf) - SOAP_FREE(soap->labbuf); - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; -#endif -#ifndef WITH_NOIDREF - soap_free_pht(soap); - soap_free_iht(soap); -#endif - ns = soap->local_namespaces; - if (ns) - { for (; ns->id; ns++) - { if (ns->out) - { SOAP_FREE(ns->out); - if (soap->encodingStyle == ns->out) - soap->encodingStyle = SOAP_STR_EOS; - ns->out = NULL; - } - if (soap->encodingStyle == ns->ns) - soap->encodingStyle = SOAP_STR_EOS; - } - SOAP_FREE(soap->local_namespaces); - soap->local_namespaces = NULL; - } -} -#endif - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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) -{ char *s = NULL; - soap_close_logfile(soap, i); - if (soap->logfile[i]) - SOAP_FREE((void*)soap->logfile[i]); - if (logfile) - if ((s = (char*)SOAP_MALLOC(strlen(logfile) + 1))) - strcpy(s, logfile); - soap->logfile[i] = s; -} -#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(struct soap *soap) -{ return soap_copy_context((struct soap*)SOAP_MALLOC(sizeof(struct soap)), soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -struct soap* -SOAP_FMAC2 -soap_copy_context(struct soap *copy, struct soap *soap) -{ if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - copy->copy = 1; - copy->user = NULL; - copy->userid = NULL; - copy->passwd = NULL; - copy->nlist = NULL; - copy->blist = NULL; - copy->clist = NULL; - copy->alist = NULL; - copy->attributes = NULL; - copy->local_namespaces = NULL; - soap_set_local_namespaces(copy); -#ifndef WITH_NOIDREF - soap_init_iht(copy); - soap_init_pht(copy); -#endif - copy->header = NULL; - copy->fault = NULL; - copy->action = NULL; - *copy->host = '\0'; -#ifndef WITH_LEAN -#ifdef WITH_COOKIES - copy->cookies = soap_copy_cookies(soap); -#else - copy->cookies = NULL; -#endif -#endif -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, "RECV.log"); - soap_set_sent_logfile(copy, "SENT.log"); - soap_set_test_logfile(copy, "TEST.log"); -#endif - copy->plugins = NULL; - for (p = soap->plugins; p; p = p->next) - { register struct soap_plugin *q = (struct soap_plugin*)SOAP_MALLOC(sizeof(struct soap_plugin)); - if (!q) - return NULL; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Copying plugin '%s'\n", p->id)); - *q = *p; - if (p->fcopy && (soap->error = p->fcopy(soap, q, p))) - { SOAP_FREE(q); - return NULL; - } - q->next = copy->plugins; - copy->plugins = q; - } - } - else - soap->error = SOAP_EOM; - return copy; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init(struct soap *soap) -{ soap->version = 0; - soap_imode(soap, SOAP_IO_DEFAULT); - soap_omode(soap, SOAP_IO_DEFAULT); - soap->copy = 0; - soap->plugins = NULL; - soap->user = NULL; - soap->userid = NULL; - soap->passwd = NULL; -#ifndef WITH_NOHTTP - soap->fpost = http_post; - soap->fget = http_get; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#endif - soap->fconnect = NULL; - soap->fdisconnect = 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; -#endif - soap->fignore = NULL; - soap->fserveloop = NULL; - soap->fplugin = fplugin; -#ifndef WITH_LEANER - soap->fdimereadopen = NULL; - soap->fdimewriteopen = NULL; - soap->fdimereadclose = NULL; - soap->fdimewriteclose = NULL; - soap->fdimeread = NULL; - soap->fdimewrite = NULL; -#endif - soap->float_format = "%.8g"; /* .8 preserves single FP precision as much as possible, but might not be very efficient */ - soap->double_format = "%.17lg"; /* .17 preserves double FP precision as much as possible, but might not be very efficient */ - soap->dime_id_format = "cid:id%d"; /* default DIME id format */ - soap->http_version = "1.1"; - soap->actor = NULL; - soap->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->ip = 0; -#ifdef WITH_FAST - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; -#endif - 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; -#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_OPENSSL - soap->fsslauth = ssl_auth_init; - soap->fsslverify = ssl_verify_callback; - soap->bio = NULL; - soap->ssl = NULL; - soap->ctx = NULL; - soap->require_server_auth = 0; - soap->require_client_auth = 0; - soap->rsa = 0; - soap->keyfile = NULL; - soap->password = NULL; - soap->dhfile = NULL; - soap->cafile = NULL; - soap->capath = NULL; - soap->randfile = NULL; - soap->session = NULL; -#endif -#ifdef WITH_ZLIB - soap->zlib_state = SOAP_ZLIB_NONE; - soap->zlib_in = SOAP_ZLIB_NONE; - soap->zlib_out = SOAP_ZLIB_NONE; - soap->d_stream.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = NULL; - soap->z_level = 6; -#endif -#ifndef WITH_LEAN - soap->cookies = NULL; - soap->cookie_domain = NULL; - soap->cookie_path = NULL; - soap->cookie_max = 32; -#endif -#ifdef SOAP_DEBUG - soap_init_logs(soap); - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, NULL); -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - soap->rpmreqid = NULL; -#endif /* WMW_RPM_IO */ -/* ]WR */ -#ifdef PALM - palmNetLibOpen(); -#endif -#ifndef WITH_NOIDREF - soap_init_iht(soap); - soap_init_pht(soap); -#endif - soap_begin(soap); -#ifdef SOAP_DEBUG - soap_set_test_logfile(soap, "TEST.log"); -#endif -} -#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, "Initializing\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_BEGIN; - 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(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end(struct soap *soap) -{ register struct soap_clist *cp; - soap_free(soap); - soap_dealloc(soap, NULL); - while (soap->clist) - { cp = soap->clist->next; - SOAP_FREE(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, struct Namespace *p) -{ struct Namespace *ns = soap->local_namespaces; - struct soap_nlist *np, *nq, *nr; - unsigned int level = soap->level; - soap->namespaces = p; - soap->local_namespaces = NULL; - soap_set_local_namespaces(soap); - /* reverse the 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; - } - } - while (np) - { soap->level = np->level; /* preserve element nesting level */ - if (np->ns) - { if (soap_push_namespace(soap, np->id, np->ns)) - return soap->error; - } - else if (np->index >= 0 && ns) - { if (ns[np->index].out) - { if (soap_push_namespace(soap, np->id, ns[np->index].out)) - return soap->error; - } - else if (soap_push_namespace(soap, np->id, ns[np->index].ns)) - return soap->error; - } - if (np->ns) - SOAP_FREE(np->ns); - nq = np; - np = np->next; - SOAP_FREE(nq); - } - if (ns) - { int i; - for (i = 0; ns[i].id; i++) - { if (ns[i].out) - { SOAP_FREE(ns[i].out); - ns[i].out = NULL; - } - } - SOAP_FREE(ns); - } - soap->level = level; /* restore level */ - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -static void -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(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 PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_element(struct soap *soap, const char *tag, int id, const char *type) -{ struct Namespace *ns = soap->local_namespaces; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); -/**/ -#ifdef WITH_DOM - if (soap->mode & SOAP_XML_DOM) - { register struct soap_dom_element *p, *e = (struct soap_dom_element*)soap_malloc(soap, sizeof(struct soap_dom_element)); - e->next = NULL; - e->prnt = soap->dom; - e->nstr = NULL; - e->name = soap_strdup(soap, tag); /* check EOM? */ - e->data = NULL; - e->type = 0; - e->node = NULL; - e->elts = NULL; - e->atts = NULL; - if (soap->dom) - { p = soap->dom->elts; - if (p) - { while (p->next) - p = p->next; - p->next = e; - } - else - soap->dom->elts = e; - } - soap->dom = e; - } - else -#endif -{ - soap->level++; - if (!soap->ns && !(soap->mode & SOAP_XML_CANONICAL)) - if (soap_send(soap, soap->prolog ? soap->prolog : "")) - return soap->error; - if (soap_send_raw(soap, "<", 1) - || soap_send(soap, tag)) - return soap->error; -} -/**/ - if (!soap->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; - } - if (id > 0) - { sprintf(soap->tmpbuf, "_%d", id); - if (soap_attribute(soap, "id", soap->tmpbuf)) - return soap->error; - } - if (type && *type) - { if (soap_attribute(soap, "xsi:type", type)) - return soap->error; - } - if (soap->null && soap->position > 0) - { 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; - 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) - 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) - 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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } - 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; -/**/ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - a->next = soap->dom->atts; - a->nstr = NULL; - a->name = soap_strdup(soap, tp->name); /* check EOM */ - a->data = soap_strdup(soap, tp->value); /* check EOM */ - a->wide = NULL; - soap->dom->atts = a; - tp->visible = 0; - } - } - return SOAP_OK; - } -#endif -/**/ - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { 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) - { soap->level--; -#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 - return soap_send_raw(soap, "/>", 2); - } - 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 -/**/ - soap->level--; - if (soap_send_raw(soap, "error; - 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; - if (soap->version == 2) - n = 1; - sprintf(soap->href, "#_%d", href); - return soap_element_href(soap, tag, id, "href" + n, 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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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 || (a && !a->__ptr)) - { 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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_attribute(struct soap *soap, const char *name, const char *value) -{ -/**/ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - a->next = soap->dom->atts; - a->nstr = NULL; - a->name = soap_strdup(soap, name); /* check EOM */ - a->data = soap_strdup(soap, value); /* check EOM */ - a->wide = NULL; - soap->dom->atts = a; - return SOAP_OK; - } -#endif -/**/ -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { 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) -{ 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 (soap->body) - soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) - return soap->error = SOAP_NULL; - } - } - 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 const char *t; - register int n = 0; - if (tag && *tag == '-') - return SOAP_OK; - soap->level--; - soap_pop_namespace(soap); - if (soap->error == SOAP_NO_TAG) - soap->error = SOAP_OK; - if (soap->peeked && *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++; - } - } while (n--); - s = soap->tag; - do c = soap_get(soap); - while (soap_blank(c)); - do - { *s++ = (char)c; - c = soap_get(soap); - } while (soap_notblank(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:"")); - if (!tag) - return SOAP_OK; - if ((s = strchr(soap->tag, ':'))) - s++; - else - s = soap->tag; - if ((t = strchr(tag, ':'))) - t++; - else - t = tag; - if (!SOAP_STRCMP(s, t)) - return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#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; - for (tp = soap->attributes; tp; tp = tp->next) - if (!soap_match_tag(soap, tp->name, name)) - break; - if (tp && tp->visible == 2) - { 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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(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, ':'); - 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 (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(tp->value); - tp->value = NULL; - tp->ns = NULL; - } - if (value) - { if (!tp->value) - { tp->size = strlen(value) + 1; - if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) - return soap->error = SOAP_EOM; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Allocate attribute value of %s (%p)\n", tp->name, tp->value)); - } - strcpy(tp->value, value); - if (!strncmp(tp->name, "xmlns:", 6)) - tp->ns = tp->value; - tp->visible = 2; - } - 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; - SOAP_FREE(soap->attributes->value); - SOAP_FREE(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) -{ size_t i; - soap_wchar c; - for (i = 0; i < n; i++) - { c = soap_getutf8(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 -static int -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->lablen); - if (!soap->labbuf) - { if (t) - free(t); - return soap->error = SOAP_EOM; - } - if (t && soap->labidx) - { memcpy(soap->labbuf, t, soap->labidx); - free(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) -{ register struct soap_attribute *tp; - 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; - for (;;) - { c = soap_getutf8(soap); - if (c == SOAP_BOM) - c = soap_getutf8(soap); - while (soap_blank(c)) - c = soap_getutf8(soap); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (c != SOAP_LT) - { *soap->tag = '\0'; - soap_unget(soap, c); - return soap->error = SOAP_NO_TAG; - } - s = soap->tag; - do c = soap_get(soap); - while (soap_blank(c)); - i = sizeof(soap->tag); - while (c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - *s = '\0'; - if (*soap->tag != '?') - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <%s?>\n", soap->tag)); - while ((int)c != EOF && c != SOAP_GT && c != '?') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf) - 2; - while (c != '=' && c != SOAP_GT && c != '?' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { *s++ = '='; - do c = soap_get(soap); - while (soap_blank(c)); - if (c != SOAP_QT && c != SOAP_AP) - { soap_unget(soap, c); - c = ' '; /* blank delimiter */ - } - if (soap_getattrval(soap, s, i, c) == SOAP_EOM) - while (soap_getattrval(soap, soap->tmpbuf, sizeof(soap->tmpbuf), c) == SOAP_EOM) - ; - else if (!strcmp(soap->tag, "?xml") && (!soap_tag_cmp(soap->tmpbuf, "encoding=iso-8859-1") || !soap_tag_cmp(soap->tmpbuf, "encoding=latin1"))) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML latin1 encoding\n")); - soap->mode |= SOAP_ENC_LATIN; - } - } - do c = soap_get(soap); - while (soap_blank(c)); - } - } - 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; - soap_clr_attr(soap); - while ((int)c != EOF && c != SOAP_GT && c != '/') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf); - while (c != '=' && c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - *s = '\0'; - if (i == sizeof(soap->tmpbuf)) - return soap->error = SOAP_SYNTAX_ERROR; - if (!strncmp(soap->tmpbuf, "xmlns:", 6)) - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (!strcmp(soap->tmpbuf, "xmlns")) - t = SOAP_STR_EOS; - else - t = NULL; - for (tp = soap->attributes; tp; tp = tp->next) - if (!SOAP_STRCMP(tp->name, soap->tmpbuf)) - break; - if (!tp) - { tp = (struct soap_attribute*)SOAP_MALLOC(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; - tp->next = soap->attributes; - soap->attributes = tp; - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { do c = soap_get(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; - soap->labidx = 0; - if (soap_append_lab(soap, tp->value, tp->size)) - return soap->error; - SOAP_FREE(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; - } - tp->size = soap->lablen; - if (!(tp->value = (char*)SOAP_MALLOC(tp->size))) - return soap->error = SOAP_EOM; - memcpy(tp->value, soap->labbuf, soap->lablen); -#else - size_t n; - if (soap->error != SOAP_EOM) - return soap->error; - soap->error = SOAP_OK; - if (soap_new_block(soap)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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(n))) - return soap->error = SOAP_EOM; - if (tp->value) - { memcpy(s, tp->value, tp->size); - SOAP_FREE(tp->value); - } - soap_save_block(soap, s + tp->size, 0); - tp->value = s; - tp->size = n; -#endif - } - do c = soap_get(soap); - while (soap_blank(c)); - tp->visible = 2; /* seen this attribute w/ value */ - } - else - tp->visible = 1; /* seen this attribute w/o value */ - if (t && tp->value) - { if (soap_push_namespace(soap, t, tp->value)) - return soap->error; - tp->visible = 0; - } - } - if ((int)c == EOF) - return soap->error = SOAP_EOF; - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible && tp->value) - { if (!strcmp(tp->name, "id")) - { *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")) - { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else if ((soap->version == 2 || (soap->mode & SOAP_XML_GRAPH)) && !strcmp(tp->name, "ref")) - { *soap->href = '#'; - strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else 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->version == 1 && !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->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) - strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); - else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) - strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) - strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position")) - soap->position = soap_getposition(tp->value, soap->positions); - else if (soap->version == 1 && !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:actor") - || !soap_match_tag(soap, tp->name, "SOAP-ENV:role")) - { if ((!soap->actor || strcmp(soap->actor, tp->value)) - && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next") - && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) - soap->other = 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, "xsi:null") - || !soap_match_tag(soap, tp->name, "xsi:nil")) - && (!strcmp(tp->value, "1") - || !strcmp(tp->value, "true"))) - soap->null = 1; - } - } - if (!(soap->body = (c != '/'))) - do c = soap_get(soap); - while (soap_blank(c)); - return soap->error = SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_retry(struct soap *soap) -{ soap->peeked = 1; - soap->error = SOAP_OK; -} -#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 = 0xFFFFFF80UL; -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { soap->dom->data = soap_strdup(soap, s); /* check EOM */ - return SOAP_OK; - } -#endif - if (soap->mode & SOAP_C_UTFSTRING) - mask = 0; - t = s; - while ((c = *t++)) - { switch (c) - { - case 9: - if (flag) - { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) - return soap->error; - s = t; - } - break; - case 10: - 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 13: - 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 - if (c & mask) - { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) - return soap->error; - s = t; - } - } - } - 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; - register size_t 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")); -#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)) - 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, 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 && !(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) - { t = buf; - *s++ = *t++; - m--; - } - else - *s++ = SOAP_UNKNOWN_CHAR; - } - 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)) - 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, 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: - 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 '<' | 0x80000000: - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - m = 3; - } - break; - case '>' | 0x80000000: - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - m = 3; - } - break; - case '&' | 0x80000000: - if (flag) - *s++ = '&'; - else - { *s++ = '&'; - t = (char*)"amp;"; - m = 4; - } - break; - case '"' | 0x80000000: - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - m = 5; - } - break; - case '\'' | 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) - { t = buf; - *s++ = *t++; - m--; - } - else - *s++ = SOAP_UNKNOWN_CHAR; - } - 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, 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; - } - if (flag == 2) - if (soap_s2QName(soap, t, &t)) - return NULL; - if (soap->peeked && *soap->tag) - { soap->peeked = 0; - if (soap_element_end_in(soap, NULL)) - 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) - { soap->dom->wide = NULL; /* soap_malloc() ??? */ - return SOAP_OK; - } -#endif - while ((c = *s++)) - { switch (c) - { - case 9: - if (flag) - t = " "; - else - t = "\t"; - break; - case 10: - if (flag || !(soap->mode & SOAP_XML_CANONICAL)) - t = " "; - else - t = "\n"; - break; - case 13: - 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 > 0 && 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; - register long l = 0; - register soap_wchar c; - const char *t = NULL; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); - if (soap->peeked && *soap->tag) - { n = 1; - soap->peeked = 0; - } - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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; - } - if (soap->peeked && *soap->tag) - { soap->peeked = 0; - if (soap_element_end_in(soap, NULL)) - return NULL; - } - return (wchar_t*)soap_save_block(soap, NULL, 0); -} -#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; - *p = (int)soap_strtol(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2int(soap, soap_value(soap), p)) - return NULL; - } - p = (int*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(int), 0, 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; - *p = soap_strtol(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2long(soap, soap_value(soap), p)) - return NULL; - } - p = (long*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(long), 0, 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 && sscanf(s, SOAP_LONG_FORMAT, p) != 1) - 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)) - 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 (p) - { if (soap_s2LONG64(soap, soap_value(soap), p)) - return NULL; - } - p = (LONG64*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(LONG64), 0, 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 (*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)) - 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 (p) - { if (soap_s2byte(soap, soap_value(soap), p)) - return NULL; - } - p = (char*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(char), 0, 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 (*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)) - 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 (p) - { if (soap_s2short(soap, soap_value(soap), p)) - return NULL; - } - p = (short*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(short), 0, 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) -{ const char *s; - if (soap_isnan((double)n)) - s = "NaN"; - else if (soap_ispinff(n)) - s = "INF"; - else if (soap_isninff(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->float_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 (!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 - { -#if defined(HAVE_STRTOF) - char *r; - *p = strtof(s, &r); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#ifdef HAVE_SSCANF - if (sscanf(s, soap->float_format, 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)) - 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 (p) - { if (soap_s2float(soap, soap_value(soap), p)) - return NULL; - } - p = (float*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(float), 0, 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) -{ const char *s; - if (soap_isnan(n)) - s = "NaN"; - else if (soap_ispinfd(n)) - s = "INF"; - else if (soap_isninfd(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->double_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 (!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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#ifdef HAVE_SSCANF - if (sscanf(s, soap->double_format, 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)) - 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 (p) - { if (soap_s2double(soap, soap_value(soap), p)) - return NULL; - } - p = (double*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(double), 0, 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 (*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)) - 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 (p) - { if (soap_s2unsignedByte(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned char*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned char), 0, 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 (*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)) - 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 (p) - { if (soap_s2unsignedShort(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned short*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned short), 0, 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; - *p = (unsigned int)soap_strtoul(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2unsignedInt(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned int*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned int), 0, 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; - *p = soap_strtoul(s, &r, 10); - if (*r) - 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)) - 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 (p) - { if (soap_s2unsignedLong(soap, soap_value(soap), p)) - return NULL; - } - p = (unsigned long*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(unsigned long), 0, 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 && sscanf(s, SOAP_ULONG_FORMAT, p) != 1) - 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)) - 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 (p) - { if (soap_s2ULONG64(soap, soap_value(soap), p)) - return NULL; - } - p = (ULONG64*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(ULONG64), 0, 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) -{ *t = NULL; - if (s && !(*t = soap_strdup(soap, s))) - soap->error = SOAP_EOM; - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2QName(struct soap *soap, const char *s, char **t) -{ if (s) - { struct soap_nlist *np; - const char *p; - if (!strncmp(s, "xml:", 4)) - { *t = soap_strdup(soap, s); - return SOAP_OK; - } - np = soap->nlist; - p = strchr(s, ':'); - if (p) - { register int n = p - s; - while (np && (strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { register const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - return s; - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%lu", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#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 - || 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)) - { 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->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; - } - else - *p = NULL; - 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 - || 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)) - { 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; - } - else - *p = NULL; - 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 -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#elif defined(HAVE_GETTIMEOFDAY) - struct timezone t; - struct timeval tv; - memset((void*)&t, 0, sizeof(t)); - gettimeofday(&tv, &t); - T->tm_min -= t.tz_minuteswest - (t.tz_dsttime != 0)*60; - T->tm_isdst = 0; - return mktime(T); -/* WR[ */ - /* The following define was added for VxWorks*/ -#elif defined(HAVE_MKTIME) - /* FOR VXWORKS: - vxWorks does not seem to have any variable representation of time zones, but - timezone information can be set in INSTALL_DIR/target/h/private/timeP.h header - file, by setting the ZONEBUFFER define. The ZONEBUFFER define follows this - format: - name_of_zone:<(unused)>:time_in_minutes_from_UTC:daylight_start:daylight_end - To calculate local time, the value of time_in_minutes_from_UTC is subtracted - from UTC; time_in_minutes_from_UTC must be positive. Daylight information is - expressed as mmddhh (month-day-hour), for example: - UTC::0:040102:100102 - */ - return mktime(T); -/* ]WR */ -#elif defined(HAVE_FTIME) - struct timeb t; - memset((void*)&t, 0, sizeof(t)); - t.timezone = 0; - t.dstflag = -1; - ftime(&t); - T->tm_min -= t.timezone - (t.dstflag != 0)*60; - T->tm_isdst = 0; - return mktime(T); -#else -#warning "time_t (de)serialization is not MT safe on this platform" - time_t t; - char *tz = getenv("TZ"); - putenv("TZ=UTC"); - tzset(); - t = mktime(T); - if (tz) - { char tmp[16]; - strcpy(tmp, "TZ="); - strncat(tmp, tz, 12); - tmp[15] = '\0'; - putenv(tmp); - } - else - putenv("TZ="); - tzset(); - return t; -#endif -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_dateTime2s(struct soap *soap, time_t n) -{ struct tm T; - struct tm *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); -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -/* ]WR */ -#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+(tz.tz_dsttime!=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+(tz.tz_dsttime!=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)) - { ftime(&t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(t.dstflag!=0), abs(t.timezone)%60); - } -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, abs(t.timezone)%60); - } -/* ]WR */ -#else - if ((pT = localtime(&n))) - { ftime(&t); - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf + strlen(soap->tmpbuf), "%+03d:%02d", -t.timezone/60+(t.dstflag!=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); -/* WR[ */ - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); -/* ]WR */ -#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) - { struct tm T; - char zone[16]; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - sscanf(s, "%d-%d-%dT%d:%d:%d%15s", &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s != 'Z') - { int h = 0, m = 0; - sscanf(s, "%d:%d", &h, &m); - T.tm_hour -= h; - if (h >= 0) - T.tm_min -= m; - else - T.tm_min += m; - } - *p = soap_timegm(&T); - } - else - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - 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)) - 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 (p) - { if (soap_s2dateTime(soap, soap_value(soap), p)) - return NULL; - } - p = (time_t*)soap_id_forward(soap, soap->href, p, t, 0, sizeof(time_t), 0, 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) -{ int i; - const char *t = NULL; - if (tag && *tag != '-') - { if ((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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p && *p) - { if (soap_send(soap, *p)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - { 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->null) - *p = NULL; - else - *p = soap_string_in(soap, 0, -1, -1); - 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) -{ int i; - const char *t = NULL; - wchar_t c; - const wchar_t *s; - if (tag && *tag != '-') - { if (tag && (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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p) - { s = *p; - while ((c = *s++)) - if (soap_pututf8(soap, (unsigned char)c)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - { 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->null) - *p = NULL; - else - *p = soap_wstring_in(soap, 0, -1, -1); - 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) -{ size_t i; - soap_wchar c = 0; - char *s = soap->tmpbuf; - if (!soap->body) - return SOAP_STR_EOS; - for (i = 0; i < sizeof(soap->tmpbuf) - 1; i++) - { c = soap_get(soap); - if (c == SOAP_TT || (int)c == EOF || soap_blank(c)) - break; - *s++ = (char)c; - } - if ((int)c == EOF || c == SOAP_TT) - soap_unget(soap, c); - *s = '\0'; - 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, now get \n */ - if (c == '\n') - { *s = '\0'; - if (i+1 == len) /* empty line: end of HTTP/MIME header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - else if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - 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; - if (soap->mode & SOAP_ENC_DIME) - { 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 %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); - s = soap_str_code(mime_codes, content->encoding); - /* count Content-Transfer-Encoding: ...\r\n */ - 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->location); - /* count \r\n...content */ - count += 2 + content->size; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Size of MIME attachment %lu bytes\n", (unsigned long)content->size)); - } - /* count \r\n--boundary--\r\n */ - count += 8 + n; - } - 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] = optype >> 8; - s[1] = optype & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime.type) - typelen = strlen(soap->dime.type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); - tmp[1] = soap->dime.flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime.size >> 24; - tmp[9] = (soap->dime.size >> 16) & 0xFF; - tmp[10] = (soap->dime.size >> 8) & 0xFF; - tmp[11] = 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 (!content->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)soap->dime.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 int i; - register char *s; - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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) -{ struct soap_multipart *content; - if (soap_getdimehdr(soap)) - return soap->error; - 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; - register soap_wchar c; - register char *s; - register int i; - id = soap->dime.id; - type = soap->dime.type; - options = soap->dime.options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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, 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; - return soap->error; -} -#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-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_int_code(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) -{ register soap_wchar c; - if (!soap->mime.last) - return SOAP_OK; - for (;;) - { register size_t i, m = 0; - register char *s, *t = NULL; - struct soap_multipart *content = soap->mime.last; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:"", content->type?content->type:"")); - if (soap_new_block(soap)) - return soap->error = SOAP_EOM; - for (;;) - { if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN))) - return soap->error = SOAP_EOM; - for (i = 0; i < SOAP_BLKLEN; i++) - { if (m > 0) - { *s++ = *t++; - m--; - } - else - { c = soap_get1(soap); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (c == '\r') - { t = soap->tmpbuf; - memset(t, 0, sizeof(soap->tmpbuf)); - strcpy(t, "\n--"); - strncat(t, soap->mime.boundary, sizeof(soap->tmpbuf)-4); - do c = soap_getchar(soap); - while (c == *t++); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (!*--t) - goto end; - *t = (char)c; - m = t - soap->tmpbuf + 1; - t = soap->tmpbuf; - c = '\r'; - } - *s++ = (char)c; - } - } - } -end: - *s = '\0'; /* force 0-terminated */ - content->size = soap_size_block(soap, i+1)-1; - content->ptr = soap_save_block(soap, NULL, 0); - if (c == '-' && soap_getchar(soap) == '-') - break; - while (c != '\r' && (int)c != EOF && soap_blank(c)) - c = soap_getchar(soap); - if (c != '\r' || soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - if (soap_getmimehdr(soap)) - return soap->error; - } - do c = soap_getchar(soap); - while ((int)c != EOF && c != '\r'); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - return SOAP_OK; -} -#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:"")); - 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_str_code(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) - 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, "--\r\n"); -} -#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 = 72; - s = soap->mime.boundary = (char*)soap_malloc(soap, n + 1); - if (!s) - return; - } - strcpy(s, "<>"); - s += 2; - n -= 4; - while (n) - { *s++ = soap_base64o[rand()&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 = 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 - -/******************************************************************************/ - -#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++; - n = strlen(path); - for (p = soap->cookies; p; p = p->next) - if (!strcmp(p->name, name) - && domain - && p->domain - && !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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"", domain?domain:"", path?path:"")); - if (!domain) - domain = soap->cookie_domain; - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - return NULL; - } - if (*path == '/') - path++; - q = soap_cookie(soap, name, domain, path); - if (!q) - { if ((q = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - { if ((q->name = (char*)SOAP_MALLOC(strlen(name)+1))) - strcpy(q->name, name); - q->value = NULL; - q->domain = NULL; - q->path = NULL; - q->expire = -1; - q->version = 0; - q->secure = 0; - q->env = 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 && strcmp((*p)->path, path) < 0) - break; - if (n) - { q->next = *p; - *p = q; - } - else - { SOAP_FREE(q->name); - SOAP_FREE(q); - q = NULL; - } - } - } - else - q->modified = 1; - if (q) - { if (q->value) - { SOAP_FREE(q->value); - q->value = NULL; - } - if (q->domain) - { SOAP_FREE(q->domain); - q->domain = NULL; - } - if (q->path) - { SOAP_FREE(q->path); - q->path = NULL; - } - if (value && *value && (q->value = (char*)SOAP_MALLOC(strlen(value)+1))) - strcpy(q->value, value); - if (domain && *domain && (q->domain = (char*)SOAP_MALLOC(strlen(domain)+1))) - strcpy(q->domain, domain); - if (path && *path && (q->path = (char*)SOAP_MALLOC(strlen(path)+1))) - strcpy(q->path, path); - q->session = 1; - } - 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) - { soap_set_receiver_error(soap, "Cookie domain not set", SOAP_STR_EOS, SOAP_HTTP_ERROR); - return; - } - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", SOAP_STR_EOS, SOAP_HTTP_ERROR); - 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(q->value); - if (q->domain) - SOAP_FREE(q->domain); - if (q->path) - SOAP_FREE(q->path); - *p = q->next; - SOAP_FREE(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 -long -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; - if ((p = soap_cookie(soap, name, domain, path))) - { p->expire = 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 || !p->env) - { 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) - sprintf(s, ";Domain=\"%s\"", p->domain); - else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) - sprintf(s, ";Domain=\"%s\"", soap->cookie_domain); - strcat(s, ";Path=\"/"); - if (p->path) - t = p->path; - else - t = soap->cookie_path; - if (t) - { if (*t == '/') - t++; - if ((int)strlen(t) < tmp-s+4064) - strcat(s, t); - } - s += strlen(s); - *s++ = '"'; - if (p->version > 0) - sprintf(s, ";Version=%u", p->version); - if (p->expire >= 0) - sprintf(s, ";Max-Age=%ld", p->expire); - if (p->secure) - strcat(s, ";Secure"); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set-Cookie: %s\n", tmp)); - if (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; - while ((q = *p)) - { if (q->expire && now > q->expire) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Cookie %s expired\n", q->name)); - SOAP_FREE(q->name); - if (q->value) - SOAP_FREE(q->value); - if (q->domain) - SOAP_FREE(q->domain); - if (q->path) - SOAP_FREE(q->path); - *p = q->next; - SOAP_FREE(q); - } - else if ((!q->domain || !strcmp(q->domain, domain)) - && (!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 && (int)strlen(q->path) < tmp-s+4080) - { sprintf(s, ";$Path=\"/%s\"", 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->fposthdr(soap, "Cookie", tmp)) - return soap->error; - p = &q->next; - } - else - 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(strlen(tmp)+1))) - strcpy(t, tmp); - } - else - t = NULL; - if (p) - { if (p->path) - SOAP_FREE(p->path); - p->path = t; - } - else - { if (path) - SOAP_FREE(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(strlen(tmp)+1))) - strcpy(t, tmp); - } - else - t = NULL; - if (p) - { if (p->domain) - SOAP_FREE(p->domain); - p->domain = t; - } - else - { if (domain) - SOAP_FREE(domain); - domain = t; - } - } - else if (p && !soap_tag_cmp(tmp, "Path")) - { if (p->path) - SOAP_FREE(p->path); - s = soap_decode_val(tmp, sizeof(tmp), s); - if (*tmp) - { if ((p->path = (char*)SOAP_MALLOC(strlen(tmp)+1))) - strcpy(p->path, tmp); - } - else - p->path = NULL; - } - else if (p && !soap_tag_cmp(tmp, "Domain")) - { if (p->domain) - SOAP_FREE(p->domain); - s = soap_decode_val(tmp, sizeof(tmp), s); - if (*tmp) - { if ((p->domain = (char*)SOAP_MALLOC(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 = (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:"", p->domain?p->domain:"", p->path?p->path:"", 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(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } - if ((p = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - { p->name = (char*)SOAP_MALLOC(strlen(tmp)+1); - strcpy(p->name, tmp); - s = soap_decode_val(tmp, sizeof(tmp), s); - if (*tmp) - { p->value = (char*)SOAP_MALLOC(strlen(tmp)+1); - strcpy(p->value, tmp); - } - else - p->value = NULL; - p->domain = domain; - p->path = path; - p->expire = 0; - p->secure = 0; - p->version = version; - } - } - } - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Got cookie %s=%s domain=%s path=%s expire=%ld secure=%d\n", p->name, p->value?p->value:"", p->domain?p->domain:"", p->path?p->path:"", 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; - } - if (p->name) - SOAP_FREE(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } - if (domain) - SOAP_FREE(domain); - if (path) - SOAP_FREE(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 *soap) -{ struct soap_cookie *p, **q, *r; - q = &r; - for (p = soap->cookies; p; p = p->next) - { if (!(*q = (struct soap_cookie*)SOAP_MALLOC(sizeof(struct soap_cookie)))) - return r; - **q = *p; - if (p->name) - { if (((*q)->name = (char*)SOAP_MALLOC(strlen(p->name)+1))) - strcpy((*q)->name, p->name); - } - if (p->value) - { if (((*q)->value = (char*)SOAP_MALLOC(strlen(p->value)+1))) - strcpy((*q)->value, p->value); - } - if (p->domain) - { if (((*q)->domain = (char*)SOAP_MALLOC(strlen(p->domain)+1))) - strcpy((*q)->domain, p->domain); - } - if (p->path) - { if (((*q)->path = (char*)SOAP_MALLOC(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(p->name); - if (p->value) - SOAP_FREE(p->value); - if (p->domain) - SOAP_FREE(p->domain); - if (p->path) - SOAP_FREE(p->path); - SOAP_FREE(p); - } -} - -/******************************************************************************/ -#endif /* WITH_COOKIES */ - -/******************************************************************************/ -#ifdef WITH_GZIP -#ifndef PALM_1 -static int -soap_getgziphdr(struct soap *soap) -{ int i; - soap_wchar c, 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)f != 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; - soap->error = SOAP_OK; - soap_free(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->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->userid = NULL; - soap->passwd = NULL; - soap->action = NULL; - soap->authrealm = NULL; -#ifndef WITH_LEANER - 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)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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 -#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")); - 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 (c != '<' && !(soap->mode & (SOAP_ENC_DIME | SOAP_ENC_ZLIB))) - { soap->mode &= ~SOAP_IO; - if ((soap->error = soap->fparse(soap))) - { soap->keep_alive = 0; /* force close later */ - return soap->error; - } - 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 -#ifdef WITH_ZLIB - if (soap->zlib_in) - { /* fparse should not use soap_unget to push back last char */ -#ifdef WITH_GZIP - 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->zlib_state = SOAP_ZLIB_INFLATE; - soap->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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 - } -#endif -#ifndef WITH_LEANER - if (soap->mode & SOAP_ENC_MIME) - { if (soap_getmimehdr(soap)) - return soap->error; - 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 g = 0, k; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Waiting for response...\n")); - *soap->endpoint = '\0'; - soap->length = 0; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return soap->error; - 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) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - if ((soap->error = soap->fparsehdr(soap, header, s))) - return soap->error; - } - } - if ((s = strchr(soap->msgbuf, ' '))) - k = (unsigned short)soap_strtoul(s, NULL, 10); - else - k = 0; - } while (k == 100); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Finished HTTP header parsing\n")); - 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 (s && (((g = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!g); - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!g), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (g) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - return SOAP_OK; - } - if (k == 0 || (k >= 200 && k <= 299) || k == 400 || k == 500) - return SOAP_OK; - 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")) - { if (soap_get_header_attribute(soap, val, "application/dime")) - soap->mode |= SOAP_ENC_DIME; - else if (soap_get_header_attribute(soap, val, "multipart/related")) - { 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->mode |= SOAP_ENC_MIME; - } - } -#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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 *")) - { size_t 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[0] && val[1]) - { soap->action = soap_strdup(soap, val + 1); - soap->action[strlen(soap->action) - 1] = '\0'; - } - } - else if (!soap_tag_cmp(key, "Location")) - { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); - soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; - } -#ifdef WITH_COOKIES - else if (!soap_tag_cmp(key, "Cookie") || !soap_tag_cmp(key, "Set-Cookie")) - 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 (soap_notblank(*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) - { const char *s; - if (soap->mode & SOAP_ENC_DIME) - s = "application/dime"; - else if (soap->version == 2) - s = "application/soap+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->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)) + ((strlen(soap->dime.type)+3)&(~3)); - } - if (soap->mode & SOAP_ENC_DIME) - 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 -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)) - return soap->error = SOAP_VERSIONMISMATCH; - 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(p[1].out); - if ((p[1].out = (char*)SOAP_MALLOC(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(p[1].out); - if ((p[1].out = (char*)SOAP_MALLOC(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) -{ if (soap_element_end_in(soap, "SOAP-ENV:Envelope")) - return soap->error; - soap->part = SOAP_END_ENVELOPE; - return SOAP_OK; -} -#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; - if (soap_element(soap, "SOAP-ENV:Body", 0, NULL)) - return soap->error; - if ((soap->mode & SOAP_XML_SEC) && soap_attribute(soap, "id", "_0")) - 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_IN_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; - return soap_element_begin_in(soap, "SOAP-ENV:Body", 0); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_body_end_in(struct soap *soap) -{ if (soap_element_end_in(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_recv_header(struct soap *soap) -{ if (soap_getheader(soap) && soap->error == SOAP_TAG_MISMATCH) - soap->error = SOAP_OK; - 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'; - *soap->host = '\0'; - *soap->path = '\0'; - soap->port = 80; - if (!endpoint || !*endpoint) - return; -#ifdef WITH_OPENSSL - if (!strncmp(endpoint, "https:", 6)) - soap->port = 443; -#endif - strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); - 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; -/* WR[ */ -#ifdef WITH_IPV6 - if ('[' == s[0]) - { s++; - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (']' == s[i]) - { - s++; - break; - } - } - } - else - { for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (s[i] == '/' || s[i] == ':') - break; - } - } -#else /* WITH_IPV6 */ -/* ]WR */ - for (i = 0; i < n; i++) - { soap->host[i] = s[i]; - if (s[i] == '/' || s[i] == ':') - break; - } -/* WR[ */ -#endif /* WITH_IPV6 */ -/* ]WR */ - soap->host[i] = '\0'; - if (s[i] == ':') - { soap->port = (int)atol(s + i + 1); - for (i++; i < n; i++) - if (s[i] == '/') - break; - } - if (s[i]) - { strncpy(soap->path, s + i + 1, 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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - soap->error = SOAP_OK; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - soap_set_endpoint(soap, endpoint); - if (action) - soap->action = soap_strdup(soap, action); -#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) - { soap->status = http_command; - 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; /* 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)); - 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); - } - } - if (soap_begin_send(soap)) - return soap->error; - count = soap_count_attachments(soap); -#ifndef WITH_NOHTTP - 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, size_t n) -{ register size_t i; - register unsigned long m; - register char *p; - if (!t) - t = (char*)soap_malloc(soap, (n + 2) / 3 * 4 + 1); - if (!t) - { soap->error = SOAP_EOM; - 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, size_t *n) -{ register int i, j, c; - register unsigned long m; - char *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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } - *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_NOHTTP -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_puthttphdr(struct soap *soap, int status, size_t count) -{ register const char *s; - register int err; - if (status == SOAP_FILE && soap->http_content) - s = soap->http_content; - else if (status == SOAP_HTML) - s = "text/html; charset=utf-8"; -#ifndef WITH_LEANER - else if (soap->mode & SOAP_ENC_DIME) - s = "application/dime"; -#endif - else if (soap->version == 2) - s = "application/soap+xml; charset=utf-8"; - else - s = "text/xml; charset=utf-8"; -#ifndef WITH_LEANER - if ((soap->mode & SOAP_ENC_MIME) && soap->mime.boundary && soap->status != SOAP_GET) - { 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); - else - strcat(soap->tmpbuf, s); - if (soap->mime.start) - { strcat(soap->tmpbuf, "\"; start=\""); - strcat(soap->tmpbuf, soap->mime.start); - } - strcat(soap->tmpbuf, "\""); - s = soap->tmpbuf; - } -#endif - if ((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", "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 (count > 0) - { 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_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"; - count = 0; - } - else - s = "POST"; -#ifdef PALM - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) -#else - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6))) -#endif - return SOAP_OK; - if (soap->proxy_host && strncmp(endpoint, "https:", 6)) - sprintf(soap->tmpbuf, "%s %s HTTP/%s", s, endpoint, soap->http_version); - else - sprintf(soap->tmpbuf, "%s /%s HTTP/%s", s, path, soap->http_version); - if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return err; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) - || (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, 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, 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 (action && soap->version == 1) - { sprintf(soap->tmpbuf, "\"%s\"", action); - 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; -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid) - httpOutputEnable(soap->rpmreqid); -#endif /* WMW_RPM_IO */ -/* ]WR */ - if (!status || status == SOAP_HTML || status == SOAP_FILE) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "OK 200\n")); -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ -#else -/* ]WR */ - if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ -/* WR[ */ -#endif /* WMW_RPM_IO */ -/* ]WR */ - { sprintf(soap->tmpbuf, "HTTP/%s 200 OK", soap->http_version); - if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return err; - } - else if ((err = soap->fposthdr(soap, "Status", "200 OK"))) - 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 ? 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 && !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)); -/* WR[ */ -#ifdef WMW_RPM_IO - if (soap->rpmreqid || soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* RPM behaves as if standalone */ -#else -/* ]WR */ - if (soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) /* standalone application */ -/* WR[ */ -#endif /* WMW_RPM_IO */ -/* ]WR */ - { 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; - } - if ((err = soap->fposthdr(soap, "Server", "gSOAP/2.7")) - || (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_IO; - soap->omode |= 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) -{ sprintf(soap->msgbuf, "Validation constraint violation: %s%s in element <%s>", s, t?t:SOAP_STR_EOS, soap->tag); - 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 (!*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 constraint violation"; - break; - case SOAP_NO_TAG: - *s = "No XML element tag found"; - 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 = "SOAP version mismatch or invalid SOAP message"; - break; - case SOAP_DATAENCODINGUNKNOWN: - *c = "SOAP-ENV:DataEncodingUnknown"; - *s = "Unsupported SOAP data encoding"; - break; - case SOAP_NAMESPACE: - *s = soap_set_validation_fault(soap, "namespace mismatch", NULL); - 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_GET_METHOD: - *s = "HTTP GET method not implemented"; - break; - case SOAP_EOM: - *s = "Out of memory"; - 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_MULTI_ID: - *s = soap_set_validation_fault(soap, "multiple definitions of id ", soap->id); - break; - case SOAP_MISSING_ID: - *s = soap_set_validation_fault(soap, "missing id for ref ", soap->id); - break; - case SOAP_HREF: - *s = soap_set_validation_fault(soap, "incompatible object ref ", soap->id); - break; - case SOAP_FAULT: - break; -#ifndef WITH_NOIO - case SOAP_TCP_ERROR: - *s = tcp_error(soap); - break; -#endif - case SOAP_HTTP_ERROR: - *s = "HTTP error"; - break; - case SOAP_SSL_ERROR: - *s = "SSL error"; - break; - case SOAP_PLUGIN_ERROR: - *s = "Plugin registry error"; - break; - case SOAP_DIME_MISMATCH: - *s = "DIME version/transmission error"; - break; - case SOAP_DIME_END: - *s = "End of DIME error"; - break; - case SOAP_DIME_ERROR: - *s = "DIME format error"; - break; - case SOAP_MIME_ERROR: - *s = "MIME format error"; - break; - case SOAP_ZLIB_ERROR: -#ifdef WITH_ZLIB - sprintf(soap->msgbuf, "Zlib/gzip error: '%s'", soap->d_stream.msg?soap->d_stream.msg:""); - *s = soap->msgbuf; -#else - *s = "Zlib not installed for required message (de)compression"; -#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, "a min/maxOccurs violation was detected", NULL); - break; - case SOAP_LENGTH: - *s = soap_set_validation_fault(soap, "content length violation", NULL); - break; -#endif - case SOAP_EOF: -#ifndef WITH_NOIO - sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); - *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 code %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)) && (!soap->fpoll || soap->fpoll(soap) == SOAP_OK)) - { 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); - } - 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) -{ soap->count = 0; - if (soap_response(soap, SOAP_OK) || soap_end_send(soap)) - return soap_closesock(soap); - 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)) - return soap_closesock(soap); - return SOAP_OK; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static const char* -soap_strerror(struct soap *soap) -{ - int err = soap->errnum; - if (!err) - err = soap_errno; - if (err) - { -#ifndef WIN32 - return strerror(err); -#else - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)&soap->errorstr, sizeof(soap->errorstr), NULL); - return soap->errorstr; -#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 *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - 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 *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultstring, const char *faultdetail) -{ char *s = NULL, *t = NULL; - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - return soap_set_error(soap, faultcode, s, t, SOAP_FAULT); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -#ifndef WITH_NOIO -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault(struct soap *soap, FILE *fd) -{ if (soap->error) - { const char **s; - if (!*soap_faultcode(soap)) - soap_set_fault(soap); - fprintf(fd, "SOAP FAULT: %s\n\"%s\"\n", *soap_faultcode(soap), *soap_faultstring(soap)); - s = soap_faultdetail(soap); - if (s && *s) - fprintf(fd, "Detail: %s\n", *s); - } -} -#endif -#endif - -/******************************************************************************/ -#ifndef PALM_1 -#ifndef WITH_NOIO -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault_location(struct soap *soap, FILE *fd) -{ -#ifndef WITH_LEAN - int c; - if (soap->error && soap->buflen > 0) - { if (soap->bufidx == 0) - soap->bufidx = 1; - c = soap->buf[soap->bufidx - 1]; - soap->buf[soap->bufidx - 1] = '\0'; - if (soap->buflen - soap->bufidx > 1024) - soap->buf[soap->bufidx + 1024] = '\0'; - else - soap->buf[soap->buflen - 1] = '\0'; - fprintf(fd, "%s%c\n** HERE **\n", soap->buf, c); - if (soap->bufidx < soap->buflen) - fprintf(fd, "%s\n", soap->buf + soap->bufidx); - } -#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(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(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 - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.h deleted file mode 100644 index 097b551..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.0f.h +++ /dev/null @@ -1,1885 +0,0 @@ -/* - -stdsoap2.h 2.7.0f - -gSOAP runtime environment. - -gSOAP XML Web services tools -Copyright (C) 2000-2005, Robert van Engelen, Genivia, Inc., All Rights Reserved. - -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]) : - - vxWorks compatible - - Support for IPv6. - --------------------------------------------------------------------------------- - - This software is released under one of the following three 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 --------------------------------------------------------------------------------- -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_BEGIN_NAMESPACE -# define SOAP_BEGIN_NAMESPACE(name) -#endif - -#ifndef SOAP_END_NAMESPACE -# define SOAP_END_NAMESPACE(name) -#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 - -#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 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 - -#ifdef __alpha -# ifndef TRU64 -# define TRU64 -# endif -#endif - -#ifdef __MVS__ -# ifndef OS390 -# define OS390 -# endif -#endif - -#ifdef _AIX -# define __socklen_t_defined -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -#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 -# 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_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(_AIXVERSION_431) -# 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(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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_GETTIMEOFDAY -# define HAVE_RAND_R -# define HAVE_GMTIME_R -# define HAVE_LOCALTIME_R -# define HAVE_WCTOMB -# define HAVE_MBTOWC -# 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_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_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 -# elif defined(MAC_CARBON) -# define WITH_NOIO -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# 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 -# 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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_RAND_R -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# 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_MB -# 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 - -#if defined(TRU64) -# define SOAP_LONG_FORMAT "%ld" -# define SOAP_ULONG_FORMAT "%lu" -#elif defined(WIN32) -# define SOAP_LONG_FORMAT "%I64d" -# define SOAP_ULONG_FORMAT "%I64u" -#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 - -#ifndef SOAP_MALLOC /* use libc malloc */ -# define SOAP_MALLOC(n) malloc(n) -#endif - -#ifndef SOAP_FREE /* use libc free */ -# define SOAP_FREE(p) free(p) -#endif - -#include - -#ifndef PALM -# include -# include -#endif - -#include -#include - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# include -# include - using namespace std; -#endif - -#ifdef WITH_NOHTTP -# ifndef WITH_NOIO -# define WITH_NOIO -# undef WITH_COOKIES -# endif -#endif - -#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 -# endif -# ifndef VXWORKS -# ifndef SYMBIAN -# include -# endif -# endif -# ifdef SUN_OS -# include /* SUN */ -# include /* SUN < 2.8 (?) */ -# endif -# ifdef VXWORKS -# include -# else -# include -# endif -# include -# ifdef OS390 -# include -# else -# include /* TCP_NODELAY */ -# endif -# include -# endif -# endif -#endif - -#ifdef WITH_FASTCGI -# include -#endif - -#ifdef WITH_OPENSSL -# define OPENSSL_NO_KRB5 -# 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 PALM -# include /* for isnan() */ -#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 - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -/* WR[ */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -/* ]WR */ -# ifndef WITH_NOIO -# ifndef PALM -# include -# include -# include -# include -# endif -# endif -#endif - -#ifdef WIN32 -# define SOAP_SOCKET SOCKET -#else -# define SOAP_SOCKET int -# define closesocket(n) close(n) -#endif - -#define SOAP_INVALID_SOCKET (-1) -#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) - -#if defined(SYMBIAN) -# define LONG64 long -# define ULONG64 unsigned LONG64 -#elif !defined(WIN32) || defined(__GLIBC__) || defined(__GNU__) -# ifndef LONG64 -# define LONG64 long long -# define ULONG64 unsigned LONG64 -# endif -#elif defined(UNDER_CE) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#elif defined(__BORLANDC__) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#endif - -#if defined(WIN32) -# define soap_int32 __int32 -#elif defined(SYMBIAN) -# define soap_int32 long -#elif defined(PALM) -# define soap_int32 Int32 -#else -# define soap_int32 int32_t -#endif - -#ifdef WIN32 -# define SOAP_EINTR WSAEINTR -# define SOAP_EAGAIN WSAEWOULDBLOCK -# define SOAP_EWOULDBLOCK WSAEWOULDBLOCK -# define SOAP_EINPROGRESS WSAEINPROGRESS -#else -# define SOAP_EINTR EINTR -# define SOAP_EAGAIN EAGAIN -# 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 GetLastError() -# else -# define soap_errno GetLastError() -# define soap_socket_errno WSAGetLastError() -# endif -#else -# ifndef WITH_NOIO -# define soap_errno errno -# define soap_socket_errno errno -# else -# define soap_errno 0 -# define soap_socket_errno 0 -# endif -#endif - -#ifndef SOAP_BUFLEN -# ifndef WITH_LEAN -# define SOAP_BUFLEN (32768) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -#endif -#ifndef SOAP_LABLEN -# ifndef WITH_LEAN -# define SOAP_LABLEN (256) /* initial look-aside buffer length */ -# else -# define SOAP_LABLEN (32) -# endif -#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 (16) -# 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 (256) /* 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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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 soap_isnan(n) isnan(n) -#endif - -#if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED)) -# define HAVE_ISNAN -#endif - -#ifndef soap_isnan -# ifdef HAVE_ISNAN -# define soap_isnan(n) isnan(n) -# else -# define soap_isnan(_) (0) -# endif -#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 -# ifdef HAVE_ISNAN -# define FLT_NAN (*(float*)&soap_double_nan) -# else -# define FLT_NAN (0.0) -# endif -#endif - -#ifndef FLT_PINFTY -# ifdef FLT_MAX -# define FLT_PINFTY FLT_MAX -# else -# ifdef HUGE_VAL -# define FLT_PINFTY (float)HUGE_VAL -# else -# ifdef FLOAT_MAX -# define FLT_PINFTY FLOAT_MAX -# else -# define FLT_PINFTY (3.40282347e+38F) -# endif -# endif -# endif -#endif - -#ifndef FLT_NINFTY -# define FLT_NINFTY (-FLT_PINFTY) -#endif - -#ifndef DBL_NAN -# ifdef HAVE_ISNAN -# define DBL_NAN (*(double*)&soap_double_nan) -# else -# define DBL_NAN (0.0) -# endif -#endif - -#ifndef DBL_PINFTY -# ifdef DBL_MAX -# define DBL_PINFTY DBL_MAX -# else -# ifdef HUGE_VAL -# define DBL_PINFTY (double)HUGE_VAL -# else -# ifdef DOUBLE_MAX -# define DBL_PINFTY DOUBLE_MAX -# else -# define DBL_PINFTY (1.7976931348623157e+308) -# endif -# endif -# endif -#endif - -#ifndef DBL_NINFTY -# define DBL_NINFTY (-DBL_PINFTY) -#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_OBJ_MISMATCH 10 obsolete */ -#define SOAP_FATAL_ERROR 11 -#define SOAP_FAULT 12 -#define SOAP_NO_METHOD 13 -#define SOAP_GET_METHOD 14 -#define SOAP_EOM 15 -#define SOAP_NULL 16 -#define SOAP_MULTI_ID 17 -#define SOAP_MISSING_ID 18 -#define SOAP_HREF 19 -#define SOAP_TCP_ERROR 20 -#define SOAP_HTTP_ERROR 21 -#define SOAP_SSL_ERROR 22 -#define SOAP_ZLIB_ERROR 23 -#define SOAP_DIME_ERROR 24 -#define SOAP_DIME_HREF 25 -#define SOAP_DIME_MISMATCH 26 -#define SOAP_DIME_END 27 -#define SOAP_MIME_ERROR 28 -#define SOAP_VERSIONMISMATCH 29 -#define SOAP_PLUGIN_ERROR 30 -#define SOAP_DATAENCODINGUNKNOWN 31 -#define SOAP_REQUIRED 32 -#define SOAP_PROHIBITED 33 -#define SOAP_OCCURS 34 -#define SOAP_LENGTH 35 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (e) == SOAP_SYNTAX_ERROR || (e) == SOAP_NAMESPACE || (e) == SOAP_MULTI_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_mime_error_check(e) ((e) == SOAP_MIME_ERROR) -#define soap_dime_error_check(e) ((e) == SOAP_DIME_ERROR || (e) == SOAP_DIME_MISMATCH) -#define soap_http_error_check(e) ((e) == SOAP_HTTP_ERROR || (e) == SOAP_GET_METHOD || ((e) >= 100 && (e) < 600)) - -/* gSOAP HTTP response status codes 100 to 600 are reserved */ - -/* Special gSOAP HTTP response status codes */ - -#define SOAP_STOP 1000 /* No HTTP response */ -#define SOAP_HTML 1001 /* Custom HTML response */ -#define SOAP_FILE 1002 /* Custom file-based response */ - -/* gSOAP HTTP request status codes */ - -#define SOAP_POST 1003 -#define SOAP_GET 1104 - -/* 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_LENGTH 0x00000004 -#define SOAP_IO_KEEPALIVE 0x00000008 - -#define SOAP_ENC_LATIN 0x00800010 /* iso-8859-1 encoding */ -#define SOAP_ENC_XML 0x00000020 /* plain XML encoding, no HTTP header */ -#define SOAP_ENC_DIME 0x00000040 -#define SOAP_ENC_MIME 0x00000080 -#define SOAP_ENC_ZLIB 0x00000100 -#define SOAP_ENC_SSL 0x00000200 - -#define SOAP_ENC 0x00000FFF /* IO and ENC mask */ - -#define SOAP_XML_STRICT 0x00001000 /* strict validation */ -#define SOAP_XML_CANONICAL 0x00002000 /* C14N canonical XML */ -#define SOAP_XML_TREE 0x00004000 -#define SOAP_XML_GRAPH 0x00008000 -#define SOAP_XML_NIL 0x00010000 -#define SOAP_XML_DOM 0x00020000 -#define SOAP_XML_SEC 0x00040000 /* reserved for WS security */ - -#define SOAP_C_NOIOB 0x00100000 -#define SOAP_C_UTFSTRING 0x00200000 -#define SOAP_C_MBSTRING 0x00400000 - -#define SOAP_DOM_TREE 0x01000000 -#define SOAP_DOM_NODE 0x02000000 - -#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_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION - -/* */ - -#define SOAP_BEGIN 0 -#define SOAP_IN_ENVELOPE 2 -#define SOAP_IN_HEADER 3 -#define SOAP_END_HEADER 4 -#define SOAP_IN_BODY 5 -#define SOAP_END_BODY 6 -#define SOAP_END_ENVELOPE 7 -#define SOAP_END 8 - -/* DEBUG macros */ - -#ifndef WITH_LEAN -# ifdef DEBUG -# ifndef SOAP_DEBUG -# define SOAP_DEBUG -# endif -# endif -#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(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(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 -#else -# define DBGLOG(DBGFILE, CMD) -# define DBGMSG(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; - -struct Namespace -{ const char *id; - const char *ns; - const char *in; - char *out; -}; - -struct soap_nlist -{ struct soap_nlist *next; - unsigned int 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 */ -}; - -struct soap_blist -{ struct soap_blist *next; - char *ptr; - size_t size; -}; - -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; -}; - -/* class allocation list */ -struct soap_clist -{ struct soap_clist *next; - void *ptr; - int type; - int size; - void (*fdelete)(struct soap_clist*); -}; - -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 */ -}; - -struct soap_cookie -{ struct soap_cookie *next; - char *name; - char *value; - char *domain; - char *path; - long expire; /* client-side: local time to expire; server-side: seconds to expire */ - unsigned int version; - short secure; - short session; /* server-side */ - short env; /* server-side: got cookie from client */ - short modified; /* server-side: client cookie was modified */ -}; - -#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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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 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 -/* 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 */ - 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 -struct soap_dom_attribute -{ struct soap_dom_attribute *next; - const char *nstr; - char *name; - char *data; - wchar_t *wide; - struct soap *soap; -#ifdef __cplusplus - 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 */ - 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_iterator -{ public: - struct soap_dom_element *elt; - const char *nstr; - const char *name; - int type; - bool operator==(const soap_dom_iterator&) const; - bool operator!=(const soap_dom_iterator&) const; - struct soap_dom_element &operator*() const; - soap_dom_iterator &operator++(); - soap_dom_iterator(); - soap_dom_iterator(struct soap_dom_element*); - ~soap_dom_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; /* first child element */ - struct soap_dom_attribute *atts; /* first child attribute */ - 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 */ - struct soap *soap; -#ifdef __cplusplus - typedef soap_dom_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_iterator begin(); - soap_dom_iterator end(); - soap_dom_iterator find(const char *nstr, const char *name); - soap_dom_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 -}; -#endif - -#if defined(__cplusplus) && !defined(WITH_LEAN) -} -extern ostream &operator<<(ostream&, const struct soap_dom_element&); -extern istream &operator>>(istream&, struct soap_dom_element&); -extern "C" { -#endif - -struct soap -{ short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ - short copy; /* 1 = copy of another soap struct */ - soap_mode mode; - soap_mode imode; - soap_mode omode; - const char *float_format; /* points to user-definable format string for floats (<1024 chars) */ - const char *double_format; /* points to user-definable format string for doubles (<1024 chars) */ - const char *dime_id_format; /* points to 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 */ - 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 list */ - struct soap_ilist *iht[SOAP_IDHASH]; - struct soap_plist *pht[SOAP_PTRHASH]; - struct SOAP_ENV__Header *header; - struct SOAP_ENV__Fault *fault; - 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 (*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 (*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); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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*); - int (*fignore)(struct soap*, const char*); - int (*fserveloop)(struct soap*); - void *(*fplugin)(struct soap*, const char*); -#ifndef WITH_LEANER - int (*fprepareinit)(struct soap*); - int (*fpreparesend)(struct soap*, const char*, size_t); - int (*fpreparerecv)(struct soap*, const char*, size_t); - 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); -#endif - int master; - int socket; -#if defined(__cplusplus) && !defined(WITH_LEAN) - ostream *os; - istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#endif -#ifndef UNDER_CE - int sendfd; - int recvfd; -#else - FILE *sendfd; - FILE *recvfd; -#endif -#ifdef WIN32 - char errorstr[256]; /* buf for FormatMessage() */ -#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; - unsigned int level; /* XML nesting level */ - size_t count; /* message length counter */ - size_t length; /* message length as set by HTTP header */ -#ifdef WITH_FAST - char *labbuf; /* look-aside buffer */ - size_t lablen; /* look-aside buffer allocated length */ - size_t labidx; /* look-aside buffer index to available part */ -#endif - char buf[SOAP_BUFLEN];/* send and receive buffer */ - char tmpbuf[1024]; /* in/output buffer for HTTP headers, simpleType values, attribute names, and DIME >=1024 bytes */ - char msgbuf[1024]; /* output buffer for (error) messages <=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 root; - short position; - int positions[SOAP_MAXDIMS]; - struct soap_attribute *attributes; /* attribute list */ - short encoding; - short mustUnderstand; - short null; - short ns; - short part; - short alloced; - short peeked; - short keep_alive; - 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 */ - int port; - unsigned int max_keep_alive; - 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 */ - int status; /* -1 when request, else error code to be returned by server */ - int error; - int errmode; - int errnum; - unsigned long idnum; - unsigned long ip; -#ifndef WITH_LEANER - struct soap_dom_element *dom; - struct soap_dime dime; - struct soap_mime mime; -#endif -#if !defined(WITH_LEAN) || defined(SOAP_DEBUG) - const char *logfile[SOAP_MAXLOGS]; - FILE *fdebug[SOAP_MAXLOGS]; -#endif -#ifndef WITH_LEAN - struct soap_cookie *cookies; - const char *cookie_domain; - const char *cookie_path; - int cookie_max; -#endif -#ifdef WITH_OPENSSL - int (*fsslauth)(struct soap*); - int (*fsslverify)(int, X509_STORE_CTX*); - BIO *bio; - SSL *ssl; - SSL_CTX *ctx; - short require_server_auth; - short require_client_auth; - short rsa; /* when set, use RSA instead of DH */ - const char *keyfile; - const char *password; - const char *dhfile; - const char *cafile; - const char *capath; - const char *randfile; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - uLong z_crc; /* internal gzip crc */ - 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 */ -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - void *rpmreqid; -#endif /* WMW_RPM_IO */ -/* ]WR */ -}; - -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; - void (*fcopy)(struct soap*, int, int, void*, 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)->mode = (soap)->imode |= (n)) -#define soap_clr_imode(soap, n) ((soap)->mode = (soap)->imode &= ~(n)) -#define soap_omode(soap, n) ((soap)->mode = (soap)->omode = (n)) -#define soap_set_omode(soap, n) ((soap)->mode = (soap)->omode |= (n)) -#define soap_clr_omode(soap, n) ((soap)->mode = (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 - -#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, 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) (0) -# define soap_putelement(s, p, t, i, n) (0) -# define soap_markelement(s, p, n) (0) -#endif - -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_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 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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_accept(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); - -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_receiver_fault(struct soap*, 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_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 void SOAP_FMAC2 soap_begin_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 *str); -SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code); - -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, void (*fdelete)(struct soap_clist*)); -SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); -SOAP_FMAC1 void SOAP_FMAC2 soap_free(struct soap*); - -#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, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, 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, 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 struct soap *SOAP_FMAC2 soap_copy(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(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 soap_wchar SOAP_FMAC2 soap_advance(struct soap*); -SOAP_FMAC1 soap_wchar SOAP_FMAC2 soap_skip(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 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); - -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 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*, int n1, int n2); - -SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, struct Namespace*); - -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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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*); -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*); - -SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault(struct soap*, FILE*); -SOAP_FMAC1 void SOAP_FMAC2 soap_print_fault_location(struct soap*, FILE*); - -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_s2dateTime(struct soap*, const char*, time_t*); -#endif - -SOAP_FMAC1 char* SOAP_FMAC2 soap_s2base64(struct soap*, const unsigned char*, char*, size_t); - -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*); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_base642s(struct soap*, const char*, char*, size_t, size_t*); - -#ifndef WITH_LEAN -SOAP_FMAC1 const char* SOAP_FMAC2 soap_dateTime2s(struct soap*, time_t); -#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); -#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); - -#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); -#endif - -#ifndef WITH_LEANER -SOAP_FMAC1 int SOAP_FMAC2 soap_element_dime(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 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); -#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 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 long 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*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.c deleted file mode 100644 index ce46e28..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.c +++ /dev/null @@ -1,14890 +0,0 @@ -/* - stdsoap2.c[pp] 2.7.10 - - 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, 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.10 2008-01-27 00:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.10 2008-01-27 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 - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -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 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*); -#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_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_LEAN -static size_t frecv_stop(struct soap*, char*, size_t); -#endif -#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 - -/******************************************************************************/ -#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) - 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 < 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 - nwritten = write(soap->sendfd, s, (unsigned int)n); -#endif -#endif -#endif - if (nwritten <= 0) - { err = soap_errno; - 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:"")); - 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, 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) - 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 - r = read(soap->recvfd, s, (unsigned int)n); - if (r >= 0) - return (size_t)r; - soap->errnum = soap_errno; - return 0; -#endif -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -#ifndef WITH_NOIO -#ifndef PALM_1 -static size_t -frecv_stop(struct soap *soap, char *s, size_t n) -{ return 0; -} -#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->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->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)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = (int)soap_size_block(soap, 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)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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 -int -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)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->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:"", 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, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(soap, p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(soap, p); - } - soap->blist = bp->next; - SOAP_FREE(soap, bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); -#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); - 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; - 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; - 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; - 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(); - 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 (!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 -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_INVALID_SOCKET; - 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(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_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 /* 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->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->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = NULL; - } -#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 = 0; -#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) - 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) - 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 = 0; - 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, (unsigned int*)&(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, (unsigned int*)&(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, (unsigned int*)&(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 -#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)soap->socket >= (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) - { unsigned int k = 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 = k; - k = 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 = k; /* 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; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->fclosesocket(soap, fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; - } - 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(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 */ - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && 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) - { -#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 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, &fds, &fds, &fds, &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); - return SOAP_INVALID_SOCKET; - } - } - continue; - } - } - break; - } - /* 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; -#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 - 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 = 0; - 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; - SSL_free(soap->ssl); - soap->ssl = NULL; - 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; - ERR_remove_state(0); - return SOAP_SSL_ERROR; - } - } - SSL_free(soap->ssl); - soap->ssl = NULL; - 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) -{ -#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->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) - soap_new_block(soap); - 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 */ -#ifdef __BORLANDC__ - setmode(soap->sendfd, O_BINARY); -#else - _setmode(soap->sendfd, _O_BINARY); -#endif -#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 - 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:"", id, atype?atype:"")); - 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; - } - return NULL; -} -#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)); - if (soap->fdebug[SOAP_INDEX_TEST]) - { 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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*)); - 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*)); - *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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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:"")); - 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); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } -#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_temp(soap); - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free_temp(struct soap *soap) -{ register struct soap_nlist *np, *nq; - register struct soap_attribute *tp, *tq; - register struct Namespace *ns; - 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - 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 - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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; - memcpy(copy, soap, sizeof(struct soap)); - 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 -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); - soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); - soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); -#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 - 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 -#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->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->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 SOAP_DEBUG - soap_init_logs(soap); -#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 SOAP_DEBUG - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, "TEST.log"); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing context\n")); -#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 - 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) -{ size_t n = strlen(little); - 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:"")); -#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 = SOAP_EOM; - 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, soap->prolog ? soap->prolog : "\n")) - 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; /* start with 0 or 2, but should be one to continue */ -#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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } -#ifndef WITH_LEAN - if (type && *type && (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 = SOAP_EOM; - (*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 || (a && !a->__ptr)) - { 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) -{ -#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)); - 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:"" )); - } - } - 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:"")); -#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:"")); - 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 = SOAP_EOM; - 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 = SOAP_EOM; - (*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)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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, 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)) - { 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 = 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; - register int 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->body) - return NULL; - 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++ = '"'; - } - } - } - *t++ = '>'; - *t = '\0'; - t = soap->tmpbuf; - m = (int)strlen(soap->tmpbuf); -#endif - n = 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)) - 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, 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)) - 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, 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: - 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, 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; - 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->body) - return NULL; - 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++ = '"'; - } - } - } - *t++ = '>'; - *t = '\0'; - t = soap->tmpbuf; -#endif - n = 1; - soap->peeked = 0; - } - } - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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, 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, NULL, 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 appears to be broken or doesn't link: use with caution */ -#if defined(HAVE_STRTOF_L) - char *r; - *p = strtof_l((char*)s, &r, NULL); - if (*r) -#elif defined(HAVE_STRTOD_L) - char *r; - *p = (float)strtod_l(s, &r, NULL); - if (*r) -#elif defined(HAVE_STRTOF) - char *r; - *p = strtof((char*)s, &r); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#if defined(HAVE_SSCANF_L) - if (sscanf_l(s, NULL, "%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, NULL, 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, NULL); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#if defined(HAVE_SSCANF_L) - if (sscanf_l(s, NULL, "%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:"")); - 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 = *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->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 if (soap->null) - *p = 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) - { struct tm T; - char zone[32]; - const char *t; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - 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"; - sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s == '+' || *s == '-') - { int h = 0, m = 0; - if (s[3] == ':') - { sscanf(s, "%d:%d", &h, &m); - if (h < 0) - m = -m; - } - else - { m = (int)atol(s); - h = m / 100; - m = m % 100; - } - T.tm_hour -= h; - T.tm_min -= m; - } - T.tm_isdst = 0; - *p = soap_timegm(&T); - } - else - { T.tm_isdst = -1; - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - } - 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) - { *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 (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:"")); - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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)) - return SOAP_EOM; - for (;;) - { register soap_wchar c; - register size_t i; - register char *s; - s = (char*)soap_push_block(soap, 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, 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:"", content->type?content->type:"")); - if (!content->ptr && soap_new_block(soap)) - { soap->error = SOAP_EOM; - return NULL; - } - for (;;) - { if (content->ptr) - s = soap->tmpbuf; - else if (!(s = (char*)soap_push_block(soap, 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, i+1)-1; - content->ptr = soap_save_block(soap, 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:"")); - 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 ? "" : "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 */ - 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); - } - } - 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->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; - soap->xlist = NULL; -#endif -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode(soap->recvfd, O_BINARY); -#else - _setmode(soap->recvfd, _O_BINARY); -#endif -#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 -#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 &= ~SOAP_IO; - soap->error = soap->fparse(soap); - 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; - 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; - 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. - Only keep parsing HTTP body when content-length>0 or chunked is set. - */ - if (((k > 200 && k <= 299) || k == 400 || k == 500) && (soap->length > 0 || (soap->imode & SOAP_IO) == SOAP_IO_CHUNK)) - return SOAP_OK; - /* HTTP 400 and 500 headers are supposed to set content-length or chunked. - For those that don't we keep parsing the body only if content type is - given and connection closes. - */ - if ((k == 400 || k == 500) && (soap->http_content || soap->keep_alive == 0)) - return SOAP_OK; - 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->mode |= 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->mode |= 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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 - 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 -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)) - { -#ifndef WITH_LEAN - if (soap->error == SOAP_TAG_MISMATCH && !soap_element_begin_in(soap, "html", 0, NULL)) - { /* get HTML from buffer, stop receiving to avoid HTML parsing issues */ - char *s; -#ifndef WITH_NOIO - size_t (*f)(struct soap*, char*, size_t) = soap->frecv; - soap->frecv = frecv_stop; -#endif - soap_revert(soap); - s = soap_string_in(soap, 1, -1, -1); -#ifndef WITH_NOIO - soap->frecv = f; -#endif - return soap_set_receiver_error(soap, "HTTP Error", s, SOAP_HTTP_ERROR); - } -#endif - if (soap->error == SOAP_TAG_MISMATCH) - return soap->error = SOAP_VERSIONMISMATCH; - 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 *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 to compare */ - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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); - 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", "gSOAP/2.7")) - || (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 && strlen(action) < sizeof(soap->tmpbuf) - 2))) - { sprintf(soap->tmpbuf, "\"%s\"", action?action:""); - 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 (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) - s = "200 OK"; - else - s = "202 ACCEPTED"; - 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) : 18) < 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", "gSOAP/2.7")) - || (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_IO; - soap->omode |= 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:""); - *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 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; - int r = 1; - 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); -#ifndef WITH_NOIO -#ifndef WITH_LEAN - 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 ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && 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 &= ~SOAP_IO_CHUNK; - soap->omode |= 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)) - { if (soap->error != 202) - return soap_closesock(soap); - soap->error = SOAP_OK; - } - return SOAP_OK; -} -#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/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h deleted file mode 100644 index 7ca5f12..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.10.h +++ /dev/null @@ -1,2281 +0,0 @@ -/* - stdsoap2.h 2.7.10 - - 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, 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_NOEMPTYSTRUCT -# define WITH_LEAN -# define HAVE_SSCANF -# elif defined(WIN32) -# define WITH_NOEMPTYSTRUCT -# 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 - -#if defined(HAVE_XLOCALE_H) || defined(HAVE_STRTOD_L) || defined(HAVE_STRTOF_L) || defined(HAVE_SSCANF_L) || defined(HAVE_SPRINTF_L) -# include -#endif - -#ifndef WITH_NOSTDLIB -# include -# ifndef PALM -# include -# include -# endif -# include -# include -#endif - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# 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) -# 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(__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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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_RSA 0x08 /* use RSA */ -#define SOAP_SSLv3_TLSv1 0x00 /* SSL v3 and TLS v1 support by default */ -#define SOAP_SSLv3 0x10 /* SSL v3 only */ -#define SOAP_TLSv1 0x20 /* TLS v1 only */ - -#define SOAP_SSL_DEFAULT (SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1) - -/* state */ - -#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 DGBFUN -# 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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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) -} -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 */ - 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) - std::ostream *os; - std::istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#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/output buffer for messages >=1024 bytes */ - char tmpbuf[1024]; /* in/output buffer for HTTP/MIME headers, simpleType values, attribute 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 -#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 alignment */ - 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_ZLIB - z_stream *d_stream; /* decompression stream */ - uLong z_crc; /* internal gzip crc */ -#else - void *d_stream; /* dummy members, to preserve alignment */ - 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(); -#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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.c deleted file mode 100644 index 6b7160b..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.c +++ /dev/null @@ -1,13101 +0,0 @@ -/* - -stdsoap2.c[pp] 2.7.6b - -gSOAP runtime - -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. --------------------------------------------------------------------------------- -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-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 --------------------------------------------------------------------------------- -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. - -*/ - -#include "stdsoap2.h" - -#ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.6b 2005-08-26 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.6b 2005-08-26 12: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_BOM (soap_wchar)(0xFEFF) /* UTF BOM is Unicode FEFF */ - -#define soap_blank(c) ((c) >= 0 && (c) <= 32) -#define soap_notblank(c) ((c) > 32) -#define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) - -static int soap_isxdigit(int); -static soap_wchar soap_char(struct soap*); - -#ifndef WITH_NOIDREF -static void soap_update_ptrs(struct soap*, char*, char*, long); -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 - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -static void soap_close_logfile(struct soap*, int); -static void soap_set_logfile(struct soap*, int, const char*); -static void soap_free_mht(struct soap*); -static void soap_track_unlink(struct soap*, const void*); -#endif - -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); -static void *fplugin(struct soap*, const char*); - -#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 time_t soap_timegm(struct tm*); -static struct soap_nlist *soap_lookup_ns(struct soap *soap, const char *tag, size_t n); -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 -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 int soap_match_cid(const char*, const char*); -static void soap_resolve_attachment(struct soap*, struct soap_multipart*); -#endif - -#ifdef WITH_GZIP -static int soap_getgziphdr(struct soap*); -#endif - -#ifdef WITH_OPENSSL -static void ssl_init(); -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -static const char *ssl_error(struct soap*, int); -/* This callback is included for future references. It should not be deleted -static DH *ssl_tmp_dh(SSL*, int, int); -*/ -#endif - -#if !defined(WITH_NOHTTP) || !defined(WITH_LEANER) -static const char *soap_decode(char*, size_t, const char*, const char*); -#endif - -#ifndef WITH_NOHTTP -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_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 - -#ifndef WITH_NOIO -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 int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); -static int tcp_accept(struct soap*, int, 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 - -#ifdef VXWORKS -static int vx_nonblocking = TRUE; /* ioctl argument */ -#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 - -static const char soap_padding[3] = "\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[] = -{ { 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 - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -fsend(struct soap *soap, const char *s, size_t n) -{ register int nwritten; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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)soap->socket, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return SOAP_EOF; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else if (soap->bio) - nwritten = BIO_write(soap->bio, s, n); - else -#endif -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - { if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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; - 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)soap->socket, &fd); - select((SOAP_SOCKET)(soap->socket + 1), NULL, NULL, &fd, &timeout); - if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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 -#ifndef PALM - nwritten = send((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { -#ifdef WITH_OPENSSL - int err; - if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return SOAP_EOF; -#endif - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EWOULDBLOCK && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - 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 - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); -#else - nwritten = fwrite(s, sizeof(char), n, fdopen(soap->sendfd, "w")); -#endif /* WMW_RPM_IO */ -#else - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -#endif -#endif -#endif - if (nwritten <= 0) - { if (soap_errno != SOAP_EINTR && soap_errno != SOAP_EWOULDBLOCK && soap_errno != SOAP_EAGAIN) - { soap->errnum = soap_errno; - 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 int 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:"")); - 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, 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; - soap->errnum = 0; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->recv_timeout) - { 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)soap->socket, &fd); - for (;;) - { r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return 0; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { int err; - r = SSL_read(soap->ssl, s, 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, n); - if (r > 0) - return (size_t)r; - return 0; - } - else -#endif - { -#ifdef WITH_UDP - 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)soap->socket, s, 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); - soap->port = (int)ntohs(soap->peer.sin_port); -#endif - } - else -#endif - r = recv((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); - if (r >= 0) - return (size_t)r; - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN && soap_socket_errno != SOAP_EWOULDBLOCK) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#ifndef WITH_LEAN - { struct timeval timeout; - fd_set fd; - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); -#ifdef WITH_OPENSSL - if (soap->ssl && SSL_get_error(soap->ssl, r) == SSL_ERROR_WANT_WRITE) - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#endif - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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); -#endif - r = read((SOAP_SOCKET)soap->recvfd, s, n); - 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; - 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); - 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 (soap->buflen) - { soap->count += soap->buflen; - 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->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; - } - } -#endif -#ifndef WITH_NOHTTP - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ - { -chunk_again: - 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; - } - else - { register soap_wchar c; - char *t, tmp[8]; - 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'; - 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); - return soap->ahead = EOF; - } - 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) - goto chunk_again; - } - } - 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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - } - else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:"")); - 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 *map, const char *str) -{ if (str) - { while (map->string) - { if (!strcmp(str, map->string)) /* case sensitive */ - return map; - map++; - } - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -long -SOAP_FMAC2 -soap_int_code(const struct soap_code_map *map, const char *str, long other) -{ while (map->string) - { if (!soap_tag_cmp(str, map->string)) /* case insensitive */ - return map->code; - map++; - } - return other; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_str_code(const struct soap_code_map *map, long code) -{ while (map->code != code && map->string) - map++; - return map->string; -} -#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_int_code(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR); -#else - return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ -#endif -} -#endif - -/******************************************************************************/ -#ifdef WITH_LEAN -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 - -/******************************************************************************/ -#ifdef WITH_LEAN -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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_get(struct soap *soap) -{ register soap_wchar c; - c = soap->ahead; - if (c) - { if (c != EOF) - soap->ahead = 0; - } - else - c = soap_get1(soap); - for (;;) - { if (soap->cdata) - { if (c == ']') - { c = soap_get1(soap); - if (c == ']') - { soap->cdata = 0; - soap_get1(soap); /* skip > */ - c = soap_get1(soap); - } - 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); - } - } - 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 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 > 0 && c < 0x80) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - 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_get(soap); - if (c < 0x80 || (soap->mode & SOAP_ENC_LATIN)) - return c; - c1 = soap_get(soap); - if (c1 < 0x80) - { soap_unget(soap, c1); - return c; - } - c1 &= 0x3F; - if (c < 0xE0) - return ((soap_wchar)(c & 0x1F) << 6) | c1; - c2 = (soap_wchar)soap_get1(soap) & 0x3F; - 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 int 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, 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 int i, k; - register char *s; - if (soap_append_lab(soap, NULL, 2)) - return NULL; - s = soap->labbuf + soap->labidx; - k = 3 * ((soap->lablen - soap->labidx) / 3); - soap->labidx = 3 * (soap->lablen / 3); - if (!s) - return NULL; - for (i = 0; i < k; 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 - k + i - 1); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i - 1); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i - 1); - 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } 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) && *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 = (struct soap_xlist*)SOAP_MALLOC(soap, sizeof(struct soap_xlist)); - *ptr = NULL; - *size = 0; - *id = soap_strdup(soap, soap->href); - *type = NULL; - *options = NULL; - 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 -int -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)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->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, long offset) -{ int i; - register struct soap_ilist *ip; - register struct soap_flist *fp; -#ifndef WITH_LEANER - register struct soap_xlist *xp; -#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 + offset)); - ip->ptr = (char*)ip->ptr + offset; - } - 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 + offset; - } - } - 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 + offset; - } - } - 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 + offset; - } - } - } - } -#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:"", xp->ptr, (char*)xp->ptr + offset)); - xp->ptr = (unsigned char**)((char*)xp->ptr + offset); - xp->size = (int*)((char*)xp->size + offset); - xp->type = (char**)((char*)xp->type + offset); - xp->options = (char**)((char*)xp->options + offset); - } - } -#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; - register struct soap_flist *fp; - 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; - register struct soap_flist *fp; - 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, p, ip->size); - else - soap_fcopy(soap, ip->type, fp->type, fp->ptr, 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, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(soap, p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(soap, p); - } - soap->blist = bp->next; - SOAP_FREE(soap, bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); -#ifndef WITH_NOIDREF - if (flag) - soap_update_ptrs(soap, q, q + n, (long)s - (long)q); /* pointers s and q may or may not be related */ -#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); - 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 = 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; - 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; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int 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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - return SOAP_OK; - return SOAP_SYNTAX_ERROR; -} -#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; - 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; - if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - } - else if (SOAP_STRCMP(tag1, t + 1)) - return SOAP_TAG_MISMATCH; - else if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - 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 - -/******************************************************************************/ - -#ifdef WITH_OPENSSL -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_rand() -{ unsigned char buf[4]; - 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; - if (dhfile) - { soap->dhfile = dhfile; - soap->rsa = 0; - } - else - { soap->dhfile = NULL; - soap->rsa = 1; - } - soap->randfile = randfile; - soap->require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION); - if (!(err = soap->fsslauth(soap))) - if (sid) - SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, 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->rsa = 0; - soap->randfile = randfile; - soap->require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION); - return soap->fsslauth(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static void -ssl_init() -{ static int done = 0; - if (!done) - { 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 -static const char * -ssl_error(struct soap *soap, int ret) -{ int err = SSL_get_error(soap->ssl, ret); - const char *msg = soap_str_code(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 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) -{ ssl_init(); - 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); - } - 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 (!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); -/* See 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 cafile first before the key file: - 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->rsa) - { RSA *rsa = RSA_generate_key(512, 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); - } - SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); - SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, 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 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ BIO *bio; - int i, r; - 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_INVALID_SOCKET; - 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; -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); - i = 100; /* 100 * 0.1 ms retries */ - while ((r = SSL_accept(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - if (i-- <= 0) - break; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - else - { soap->errnum = err; - break; - } - } -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - if (r <= 0) - { soap_set_receiver_error(soap, ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); - soap_closesock(soap); - return SOAP_SSL_ERROR; - } - if (soap->require_client_auth) - { 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 /* 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 - soap_free(soap); - while (soap->clist) - { struct soap_clist *p = soap->clist->next; - SOAP_FREE(soap, soap->clist); - soap->clist = p; - } - 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->copy) - soap->plugins->fdelete(soap, soap->plugins); - SOAP_FREE(soap, soap->plugins); - soap->plugins = p; - } - soap->fplugin = fplugin; -#ifndef WITH_NOHTTP - soap->fpost = http_post; - soap->fget = http_get; - soap->fform = NULL; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#endif -#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->copy) - { if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = 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_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_str_code(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_str_code(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; - char *addrcopy = (char*)SOAP_MALLOC(soap, strlen(addr) + 1); /*copy of addr. */ - /* inet_addr(), and hostGetByName() expect "char *"; addr is a "const char *". */ - strncpy(addrcopy, addr, strlen(addr)+1); - iadd = inet_addr(addrcopy); -#else -#if defined(_AIXVERSION_431) || defined(TRU64) - struct hostent_data ht_data; -#endif - iadd = inet_addr(addr); -#endif - if (iadd != -1) - { memcpy(inaddr, &iadd, sizeof(iadd)); -#ifdef VXWORKS - SOAP_FREE(soap, addrcopy); -#endif - return SOAP_OK; - } -#if defined(__GLIBC__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - 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(addrcopy); - if (hostint == ERROR) - { host = NULL; - soap->errnum = soap_errno; - } - SOAP_FREE(soap, addrcopy); /*free() is placed after the error checking to assure that - * errno captured is that from hostGetByName() */ -#else - if (!(host = gethostbyname(addr))) - soap->errnum = h_errno; -#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 int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ -#ifdef WITH_IPV6 - struct addrinfo hints, *res, *ressave; - int err; -#endif - register int fd; -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->socket)) - soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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, gai_strerror(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - ressave = res; -again: - fd = (int)socket(res->ai_family, res->ai_socktype, res->ai_protocol); - soap->errmode = 0; -#else -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - fd = (int)socket(AF_INET, SOCK_DGRAM, 0); - else -#endif - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -#endif - if (fd < 0) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR); - 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 = 0; - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - if ((soap->connect_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (!(soap->omode & SOAP_IO_UDP) && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#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, (SOAP_SOCKET)fd); - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->peer.sin_port = htons((short)port); - } - soap->errmode = 0; - if ((soap->omode & SOAP_IO_UDP)) - return fd; -#endif -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, res->ai_addr, res->ai_addrlen)) -#else - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) -#endif - { -#ifndef WITH_LEAN - if (soap->connect_timeout && (soap_socket_errno == SOAP_EINPROGRESS || soap_socket_errno == SOAP_EWOULDBLOCK)) - { struct timeval timeout; - SOAP_SOCKLEN_T k; - fd_set fds; - 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((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)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")); - soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - else -#endif -#ifdef WITH_IPV6 - if (res->ai_next) - { res = res->ai_next; - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - goto again; - } - else -#endif - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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, (SOAP_SOCKET)fd); - 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->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&vx_nonblocking)); /* modified to use fd */ - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - soap->socket = fd; - soap->imode &= ~SOAP_ENC_SSL; - soap->omode &= ~SOAP_ENC_SSL; - if (!strncmp(endpoint, "https:", 6)) - { -#ifdef WITH_OPENSSL - BIO *bio; - int r; - if (soap->proxy_host) - { short v; - unsigned int k = soap->omode; /* make sure we only parse HTTP */ - size_t n = soap->count; /* save the content length */ - soap->omode &= ~SOAP_ENC; /* mask IO and ENC */ - soap->omode |= SOAP_IO_BUFFER; - soap_begin_send(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to proxy server\n")); - sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - 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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - return soap->error; - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - return SOAP_INVALID_SOCKET; - soap->omode = k; - k = soap->imode; - soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ - v = soap->version; /* preserve */ - if (soap_begin_recv(soap)) - return SOAP_INVALID_SOCKET; - soap->version = v; /* restore */ - soap->imode = k; /* restore */ - soap->count = n; /* restore */ - soap_begin_send(soap); - } - 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); - return SOAP_INVALID_SOCKET; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; - } - 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((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - { soap_set_sender_error(soap, ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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((SOAP_SOCKET)soap->socket, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(soap->socket + 1), &fds, NULL, &fds, &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); - return SOAP_INVALID_SOCKET; - } - } - continue; - } - } - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if (soap->require_server_auth) - { X509 *peer; - 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); - return SOAP_INVALID_SOCKET; - } - 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); - return SOAP_INVALID_SOCKET; - } - X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); - X509_free(peer); - if (soap_tag_cmp(soap->msgbuf, host)) - { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); - return SOAP_INVALID_SOCKET; - } - } -#else - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; -#endif - } - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_bind(struct soap *soap, const char *host, int port, int backlog) -{ -#ifdef WITH_IPV6 - struct addrinfo *addrinfo; - struct addrinfo hints; - struct addrinfo res; - int err; -#endif -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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; - soap->peer = *((struct sockaddr_storage*)addrinfo->ai_addr); - soap->peerlen = addrinfo->ai_addrlen; - res.ai_addr = (struct sockaddr*)&soap->peer; - res.ai_addrlen = soap->peerlen; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - soap->master = socket(res.ai_family, res.ai_socktype, res.ai_protocol); -#else -#ifdef WITH_UDP - 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_set_receiver_error(soap, tcp_error(soap), "socket failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#ifdef WITH_UDP - 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_SOCKET)soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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 - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, res.ai_addr, res.ai_addrlen)) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, (struct sockaddr*)&soap->peer, soap->peerlen)) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, backlog)) - { soap->errnum = soap_socket_errno; - 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; - int r; - 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)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - FD_SET((SOAP_SOCKET)soap->socket, &xfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, &xfd, &timeout); - if (r > 0 && FD_ISSET((SOAP_SOCKET)soap->socket, &xfd)) - r = -1; - } - else if (soap_valid_socket(soap->master)) - { FD_SET((SOAP_SOCKET)soap->master, &sfd); - r = select((SOAP_SOCKET)(soap->master + 1), NULL, &sfd, NULL, &timeout); - } - else - return SOAP_OK; - if (r > 0) - { if (soap_valid_socket(soap->socket) - && FD_ISSET((SOAP_SOCKET)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - || recv((SOAP_SOCKET)soap->socket, soap->tmpbuf, 1, MSG_PEEK) > 0)) - return SOAP_OK; - } - else if (r < 0) - { soap->errnum = soap_socket_errno; - if ((soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno != 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 int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ int fd; - fd = (int)accept((SOAP_SOCKET)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 -int -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; -#ifdef WITH_UDP - 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)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->accept_timeout) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - soap_closesock(soap); - soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = TRUE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#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 = 0; - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - 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; - } - } - if ((soap->accept_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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 - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -#elif defined(VXWORKS) - vx_nonblocking = FALSE; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&vx_nonblocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&vx_nonblocking)); -#elif defined(PALM) - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); -#elif defined(SYMBIAN) - long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - } - soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); - return soap->socket; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); - soap->errnum = soap_socket_errno; - 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); - 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 != 1) - { s = ERR_get_error(); - if (s) - { if (soap_valid_socket(soap->socket)) - { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); - soap->socket = SOAP_INVALID_SOCKET; - } - r = SSL_shutdown(soap->ssl); - } - } - DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); - 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)soap->socket, 2); - soap->fclosesocket(soap, (SOAP_SOCKET)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 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 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 int 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_clr_attr(soap); - soap_set_local_namespaces(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; - 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) -{ soap->error = SOAP_OK; - soap_clr_attr(soap); - soap_set_local_namespaces(soap); - 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 -#ifdef WITH_UDP - 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) - soap_new_block(soap); - 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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->sendfd, _O_BINARY); -#endif -#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; -#ifdef WITH_ZLIB - soap->z_ratio_out = 1.0; - if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#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; - 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_NOIDREF -#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) -{ 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:"", id, atype?atype:"")); - 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; - return -1; -} -#endif -#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, *p; - register struct soap_flist *fp, *fq; - 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; - 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; - } - return NULL; -} -#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); - n += (-(long)n) & 7; - if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(void*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - /* keep chain of alloced cells for later destruction */ - soap->alloced = 1; - *(void**)(p + n) = soap->alist; - *(size_t*)(p + n + sizeof(void*)) = n; - soap->alist = p + n; - return p; -} -#endif - -/******************************************************************************/ -#ifdef SOAP_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_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_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 int h = soap_hash_ptr(p); - register struct soap_mlist *mp = (struct soap_mlist*)malloc(sizeof(struct soap_mlist)); - if (soap->fdebug[SOAP_INDEX_TEST]) - 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_DEBUG -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_track_free(struct soap *soap, const char *file, int line, void *p) -{ register int 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_DEBUG -static void -soap_track_unlink(struct soap *soap, const void *p) -{ register int 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) - return; - if (p) - { register char **q; - 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, "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; - 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; -#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 = &soap->clist; - if (p) - { while (*cp) - { if (p == (*cp)->ptr) - { register struct soap_clist *q = *cp; - *cp = q->next; - q->fdelete(q); - 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->ptr == (void*)soap->fault) - soap->fault = NULL; /* this was deallocated */ - else if (q->ptr == (void*)soap->header) - soap->header = NULL; /* this was deallocated */ - q->fdelete(q); - SOAP_FREE(soap, q); - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_clist * -SOAP_FMAC2 -soap_link(struct soap *soap, void *p, int t, int n, void (*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_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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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: id type=%d href type=%d\n", 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*)); - 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*)); - *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, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, 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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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; - 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 href='%s'\n", st, tt, (unsigned long)n, p, k, 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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, 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } -#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_OPENSSL - if (!soap->ssl && soap_valid_socket(soap->socket) && !soap->keep_alive && !(soap->omode & SOAP_IO_UDP)) - soap->fshutdownsocket(soap, (SOAP_SOCKET)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)soap->socket, 1); /* Send TCP FIN */ -#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)) - return soap->error; - soap->dime.list = soap->dime.first; - soap->dime.first = NULL; - soap->dime.last = NULL; - if ((soap->mode & SOAP_ENC_MIME) && soap_getmime(soap)) - return soap->error; - soap->mime.list = soap->mime.first; - soap->mime.first = NULL; - soap->mime.last = NULL; - soap->mime.boundary = NULL; -#endif - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { soap_wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(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; - } - } -#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 - return soap_resolve(soap); -#else -#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 - return SOAP_OK; -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free(struct soap *soap) -{ register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { register struct soap_nlist *np = soap->nlist->next; - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n")); - while (soap->attributes) - { register struct soap_attribute *tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap, soap->attributes->value); - SOAP_FREE(soap, soap->attributes); - soap->attributes = tp; - } -#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 - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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) -{ char *s = NULL; - soap_close_logfile(soap, i); - if (soap->logfile[i]) - SOAP_FREE(soap, (void*)soap->logfile[i]); - if (logfile) - if ((s = (char*)SOAP_MALLOC(soap, strlen(logfile) + 1))) - strcpy(s, logfile); - soap->logfile[i] = s; -} -#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(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, struct soap *soap) -{ if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - copy->copy = 1; - copy->user = NULL; - 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; -#ifdef WITH_FAST - copy->labbuf = NULL; - copy->lablen = 0; - copy->labidx = 0; -#endif -#ifdef SOAP_DEBUG - soap_init_mht(copy); -#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; - *copy->host = '\0'; -#ifndef WITH_LEAN -#ifdef WITH_COOKIES - copy->cookies = soap_copy_cookies(copy); -#else - copy->cookies = NULL; -#endif -#endif -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); - soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); - soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); -#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 && (soap->error = p->fcopy(copy, q, p))) - { SOAP_FREE(copy, q); - return NULL; - } - q->next = copy->plugins; - copy->plugins = q; - } - } - else - soap->error = SOAP_EOM; - return copy; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init(struct soap *soap) -{ soap->version = 0; - soap_imode(soap, SOAP_IO_DEFAULT); - soap_omode(soap, SOAP_IO_DEFAULT); - soap->copy = 0; - soap->plugins = NULL; - soap->user = NULL; - soap->userid = NULL; - soap->passwd = NULL; -#ifndef WITH_NOHTTP - soap->fpost = http_post; - soap->fget = http_get; - soap->fform = NULL; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#endif - soap->fconnect = NULL; - soap->fdisconnect = 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; - soap->fplugin = fplugin; -#ifndef WITH_LEANER - soap->fdimereadopen = NULL; - soap->fdimewriteopen = NULL; - soap->fdimereadclose = NULL; - soap->fdimewriteclose = NULL; - soap->fdimeread = NULL; - soap->fdimewrite = NULL; -#endif - soap->float_format = "%.8g"; /* .8 preserves single FP precision as much as possible, but might not be very efficient */ - soap->double_format = "%.17lg"; /* .17 preserves double FP precision as much as possible, but might not be very efficient */ - soap->dime_id_format = "cid:id%d"; /* default DIME id format */ - soap->http_version = "1.1"; - soap->actor = NULL; - soap->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->ip = 0; -#ifdef WITH_FAST - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; -#endif - 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_OPENSSL - soap->fsslauth = ssl_auth_init; - soap->fsslverify = ssl_verify_callback; - soap->bio = NULL; - soap->ssl = NULL; - soap->ctx = NULL; - soap->require_server_auth = 0; - soap->require_client_auth = 0; - soap->rsa = 0; - 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_ZLIB - soap->zlib_state = SOAP_ZLIB_NONE; - soap->zlib_in = SOAP_ZLIB_NONE; - soap->zlib_out = SOAP_ZLIB_NONE; - soap->d_stream.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = 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 SOAP_DEBUG - soap_init_mht(soap); - soap_init_logs(soap); - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, NULL); -#endif -#ifdef WMW_RPM_IO - soap->rpmreqid = NULL; -#endif /* WMW_RPM_IO */ -#ifdef PALM - palmNetLibOpen(); -#endif -#ifndef WITH_NOIDREF - soap_init_iht(soap); - soap_init_pht(soap); -#endif - soap_begin(soap); -#ifdef SOAP_DEBUG - soap_set_test_logfile(soap, "TEST.log"); -#endif -} -#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, "Initializing\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(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end(struct soap *soap) -{ register struct soap_clist *cp; - soap_free(soap); - soap_dealloc(soap, NULL); - while (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, 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) -{ size_t n = strlen(little); - 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 -static struct soap_nlist * -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 - -/******************************************************************************/ -#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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns?ns:"")); - 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->index == 1) - utilized = np->index; - else - return NULL; - } - } - 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); - if (np) - { if (np->index == 0) - soap_push_ns(soap, np->id, np->ns, 1); - } - else - { 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) -{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); -#ifdef WITH_DOM - 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 = SOAP_EOM; - 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, soap->prolog ? soap->prolog : "\n")) - 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 - 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; /* start with 0 or 2, but should be one to continue */ -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { const char *s = strchr(tag, ':'); - if (s) - soap_utilize_ns(soap, tag, s - tag); - } -#endif - if (id > 0) - { sprintf(soap->tmpbuf, "_%d", id); - if (soap_attribute(soap, "id", soap->tmpbuf)) - return soap->error; - } - if (type && *type) - { if (soap_attribute(soap, "xsi:type", 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 - } - if (soap->null && soap->position > 0) - { 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; - 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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } -#ifndef WITH_LEAN - if (type && *type && (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; -#ifdef WITH_DOM - register struct soap_dom_attribute **att; - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { 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 = SOAP_EOM; - (*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; - tp->visible = 0; - } - } - return SOAP_OK; - } -#endif -#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); - soap_set_attr(soap, soap->tmpbuf, np->ns); - np->index = 2; - } - } - } -#endif - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { 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; - } - else -#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 - 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; - if (soap->version == 2) - n = 1; - sprintf(soap->href, "#_%d", href); - return soap_element_href(soap, tag, id, "href" + n, 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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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 || (a && !a->__ptr)) - { 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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_attribute(struct soap *soap, const char *name, const char *value) -{ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - 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 - 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) -{ 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 (soap->body) - soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) - return soap->error = SOAP_NULL; - } - } - 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 const char *t; - register int n = 0; - if (tag && *tag == '-') - return SOAP_OK; - soap->level--; - soap_pop_namespace(soap); -#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->error == SOAP_NO_TAG) - soap->error = SOAP_OK; - 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; - while (soap_notblank(c = soap_getutf8(soap))) - *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:"")); - if (!tag || !*tag) - return SOAP_OK; - if ((s = strchr(soap->tag, ':'))) - s++; - else - s = soap->tag; - if ((t = strchr(tag, ':'))) - t++; - else - t = tag; - if (!SOAP_STRCMP(s, t)) - return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#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; - for (tp = soap->attributes; tp; tp = tp->next) - if (!soap_match_tag(soap, tp->name, name)) - break; - if (tp && tp->visible == 2) - { 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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, ':'); - 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 (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 of %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; - 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) -{ size_t i; - soap_wchar c; - for (i = 0; i < n; i++) - { c = soap_getutf8(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; - 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; - for (;;) - { c = soap_getutf8(soap); - if (c == SOAP_BOM) - c = soap_get(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_get(soap); - } - } - while (soap_blank(c)); - *s = '\0'; - lead = soap_strdup(soap, soap->labbuf); - } -#else - while (soap_blank(c)) - c = soap_get(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_getutf8(soap); - while (soap_blank(c)); - i = sizeof(soap->tag); - while (c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_getutf8(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - *s = '\0'; - if (*soap->tag != '?') - break; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML PI <%s?>\n", soap->tag)); - while ((int)c != EOF && c != SOAP_GT && c != '?') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf) - 2; - while (c != '=' && c != SOAP_GT && c != '?' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(soap); - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { *s++ = '='; - do c = soap_get(soap); - while (soap_blank(c)); - if (c != SOAP_QT && c != SOAP_AP) - { soap_unget(soap, c); - c = ' '; /* blank delimiter */ - } - if (soap_getattrval(soap, s, i, c) == SOAP_EOM) - { while (soap_getattrval(soap, soap->tmpbuf, sizeof(soap->tmpbuf), c) == SOAP_EOM) - ; - } - else if (!strcmp(soap->tag, "?xml") - && (!soap_tag_cmp(soap->tmpbuf, "encoding=iso-8859-1") - || !soap_tag_cmp(soap->tmpbuf, "encoding=latin1"))) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "XML latin1 encoding\n")); - soap->mode |= SOAP_ENC_LATIN; - } - } - do c = soap_get(soap); - while (soap_blank(c)); - } - } - 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; -#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 = SOAP_EOM; - 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 - for (tp = soap->attributes; tp; tp = tp->next) - tp->visible = 0; - while ((int)c != EOF && c != SOAP_GT && c != '/') - { s = soap->tmpbuf; - i = sizeof(soap->tmpbuf); - while (c != '=' && c != '/' && soap_notblank(c)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get(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 = SOAP_EOM; - (*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] == ':') - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (soap->tmpbuf[5]) - t = NULL; - else - t = SOAP_STR_EOS; - } - else - t = NULL; - for (tp = soap->attributes; 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; - tp->next = soap->attributes; - soap->attributes = tp; - } - while (soap_blank(c)) - c = soap_get(soap); - if (c == '=') - { do c = soap_get(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)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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, s + tp->size, 0); - tp->value = s; - tp->size = n; -#endif - } - do c = soap_get(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; - tp->visible = 0; - } - } -#ifdef WITH_DOM - if (att) - { soap->dom->nstr = soap_dom_current_nstr(soap, soap->tag); - for (att = &soap->dom->atts; *att; att = &(*att)->next) - (*att)->nstr = soap_dom_current_nstr(soap, (*att)->name); - } -#endif - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (!(soap->body = (c != '/'))) - do c = soap_get(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) - { if (!strcmp(tp->name, "id")) - { *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")) - { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else if ((soap->version == 2 || (soap->mode & SOAP_XML_GRAPH)) && !strcmp(tp->name, "ref")) - { *soap->href = '#'; - strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else 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->version == 1 && !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->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) - strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); - else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) - strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) - strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position")) - soap->position = soap_getposition(tp->value, soap->positions); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:root")) - soap->root = ((!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))); - else if ((soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENV:actor")) - || (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENV:role"))) - { if ((!soap->actor || strcmp(soap->actor, tp->value)) - && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next") - && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) - soap->other = 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, "xsi:null") - || !soap_match_tag(soap, tp->name, "xsi:nil")) - && (!strcmp(tp->value, "1") - || !strcmp(tp->value, "true"))) - soap->null = 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 = 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 9: - if (flag) - { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) - return soap->error; - s = t; - } - break; - case 10: - 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 13: - 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 - if (c & mask) - { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) - return soap->error; - s = t; - } - } - } - 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; - register int 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->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; -#ifndef WITH_LEAN - t = soap->tmpbuf; - t[0] = '<'; - strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 1); - strncat(t, ">", sizeof(soap->tmpbuf)); - m = strlen(soap->tag) + 2; -#endif - } - } -#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)) - 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, 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 && !(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)) - 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, 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: - 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 '<' | 0x80000000: - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - m = 3; - } - break; - case '>' | 0x80000000: - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - m = 3; - } - break; - case '&' | 0x80000000: - if (flag) - *s++ = '&'; - else - { *s++ = '&'; - t = (char*)"amp;"; - m = 4; - } - break; - case '"' | 0x80000000: - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - m = 5; - } - break; - case '\'' | 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, 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 9: - if (flag) - t = " "; - else - t = "\t"; - break; - case 10: - if (flag || !(soap->mode & SOAP_XML_CANONICAL)) - t = " "; - else - t = "\n"; - break; - case 13: - 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 > 0 && 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; - register long l = 0; - register soap_wchar c; - const char *t = NULL; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); - if (soap->peeked) - { if (!soap->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; - } - } - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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, 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; - *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)) - 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, 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; - *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)) - 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, 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; - *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)) - 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, 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)) - 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, 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)) - 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, 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) -{ const char *s; - if (soap_isnan((double)n)) - s = "NaN"; - else if (soap_ispinff(n)) - s = "INF"; - else if (soap_isninff(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->float_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 appears to be broken or doesn't link: use with caution */ -#if defined(HAVE_STRTOF) - char *r; - *p = strtof((char*)s, &r); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#ifdef 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)) - 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, 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) -{ const char *s; - if (soap_isnan(n)) - s = "NaN"; - else if (soap_ispinfd(n)) - s = "INF"; - else if (soap_isninfd(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->double_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#ifdef 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)) - 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, 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)) - 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, 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)) - 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, 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; - *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)) - 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, 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; - *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)) - 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, 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; - *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)) - 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, 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) -{ *t = NULL; - if (s && !(*t = soap_strdup(soap, s))) - soap->error = SOAP_EOM; - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2QName(struct soap *soap, const char *s, char **t) -{ if (s) - { struct soap_nlist *np; - const char *p; - if (!strncmp(s, "xml:", 4)) - { *t = soap_strdup(soap, s); - return SOAP_OK; - } - np = soap->nlist; - p = strchr(s, ':'); - if (p) - { register int n = p - s; - while (np && (strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { register const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - { -#ifndef WITH_LEAN - if (s && (soap->mode & SOAP_XML_CANONICAL)) - { t = strchr(s, ':'); - if (t) - soap_utilize_ns(soap, s, t - s); - } -#endif - return s; - } - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%d", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#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 - || 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)) - { 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->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; - } - else - *p = NULL; - 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 - || 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)) - { 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; - } - else - *p = NULL; - 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 -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#else - time_t t, g, z; -#ifdef HAVE_GMTIME_R - struct tm tm, *tmp = &tm; -#else - struct tm *tmp; -#endif - t = mktime(T); - if (t == -1) - return -1; -#ifdef HAVE_GMTIME_R - gmtime_r(&t, tmp); -#else - tmp = gmtime(&t); -#endif - tmp->tm_isdst = 0; - g = mktime(tmp); - if (g == -1) - return -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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&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)) - { ftime(&t); - 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); - } - /* The following defines were added for VxWorks*/ -# elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, abs(t.timezone)%60); - } -# else - if ((pT = localtime(&n))) - { ftime(&t); - 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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_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) - { struct tm T; - char zone[16]; - const char *t; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - if (strchr(s, '-')) - t = "%d-%d-%dT%d:%d:%d%15s"; - else if (strchr(s, ':')) - t = "%4d%2d%2dT%d:%d:%d%15s"; - else /* parse non-XSD-standard alternative ISO 8601 format */ - t = "%4d%2d%2dT%2d%2d%2d%15s"; - sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s == '+' || *s == '-') - { int h = 0, m = 0; - if (s[3] == ':') - { sscanf(s, "%d:%d", &h, &m); - if (h < 0) - m = -m; - } - else - { m = (int)atol(s); - h = m / 100; - m = m % 100; - } - T.tm_hour -= h; - T.tm_min -= m; - } - *p = soap_timegm(&T); - } - else - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - 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)) - 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, 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) -{ 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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p && *p) - { if (soap_send(soap, *p)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - { 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->null) - *p = NULL; - else - *p = soap_string_in(soap, 0, -1, -1); - 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) -{ int i; - const char *t = NULL; - wchar_t c; - const wchar_t *s; - 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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p) - { s = *p; - while ((c = *s++)) - if (soap_pututf8(soap, (unsigned char)c)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - { 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->null) - *p = NULL; - else - *p = soap_wstring_in(soap, 0, -1, -1); - 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_token(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 || soap_blank(c)) - break; - *s++ = (char)c; - c = soap_get(soap); - } - if ((int)c == EOF || c == SOAP_TT) - soap_unget(soap, c); - *s = '\0'; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element content value='%s'\n", soap->tmpbuf)); - return soap->tmpbuf; /* return non-null pointer */ -} -#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, now get \n */ - if (c == '\n') - { *s = '\0'; - if (i+1 == len) /* empty line: end of HTTP/MIME header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - else if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - 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_str_code(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->location); - /* 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] = optype >> 8; - s[1] = optype & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime.type) - typelen = strlen(soap->dime.type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); - tmp[1] = soap->dime.flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime.size >> 24; - tmp[9] = (soap->dime.size >> 16) & 0xFF; - tmp[10] = (soap->dime.size >> 8) & 0xFF; - tmp[11] = 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 (!content->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)soap->dime.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 int i; - register char *s; - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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, soap->dime.size)) - return soap->error = SOAP_EOF; - } - if (soap_move(soap, ((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; - register soap_wchar c; - register char *s; - register int i; - id = soap->dime.id; - type = soap->dime.type; - options = soap->dime.options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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, 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; - soap_resolve_attachment(soap, content); - if (soap->error) - return soap->error; - } - 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_int_code(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) -{ register soap_wchar c = 0; - if (!soap->mime.last) - return SOAP_OK; - for (;;) - { register size_t i, m = 0; - register char *s, *t = NULL; - struct soap_multipart *content = soap->mime.last; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:"", content->type?content->type:"")); - if (soap_new_block(soap)) - return soap->error = SOAP_EOM; - for (;;) - { register short flag = 0; - if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN))) - return soap->error = SOAP_EOM; - for (i = 0; i < SOAP_BLKLEN; i++) - { if (m > 0) - { flag = (*t == '\r'); - *s++ = *t++; - m--; - } - else - { if (!flag) - { c = soap_get1(soap); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - if (flag || c == '\r') - { t = soap->tmpbuf; - memset(t, 0, sizeof(soap->tmpbuf)); - strcpy(t, "\n--"); - if (soap->mime.boundary) - strncat(t, soap->mime.boundary, sizeof(soap->tmpbuf)-4); - do c = soap_getchar(soap); - while (c == *t++); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (!*--t) - goto end; - *t = (char)c; - m = t - soap->tmpbuf + 1; - t = soap->tmpbuf; - c = '\r'; - } - *s++ = (char)c; - } - } - } -end: - *s = '\0'; /* force 0-terminated */ - content->size = soap_size_block(soap, i+1)-1; - content->ptr = soap_save_block(soap, NULL, 0); - soap_resolve_attachment(soap, content); - if (c == '-' && soap_getchar(soap) == '-') - break; - while (c != '\r' && (int)c != EOF && soap_blank(c)) - c = soap_getchar(soap); - if (c != '\r' || soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - if (soap_getmimehdr(soap)) - return soap->error; - } - /* - do c = soap_getchar(soap); - while ((int)c != EOF && c != '\r' && c != '\n'); - if ((int)c != '\r' || soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - */ - return SOAP_OK; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_LEANER -#ifndef PALM_1 -static int -soap_match_cid(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; - 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(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:"")); - 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_str_code(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) - 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 = 72; - 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 = 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 - -/******************************************************************************/ - -#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++; - n = strlen(path); - for (p = soap->cookies; p; p = p->next) - if (!strcmp(p->name, name) - && domain - && p->domain - && !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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"", domain?domain:"", path?path:"")); - if (!domain) - domain = soap->cookie_domain; - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - return NULL; - } - if (*path == '/') - path++; - q = soap_cookie(soap, name, domain, path); - 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 = -1; - q->version = 0; - 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 && 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 && *domain && (q->domain = (char*)SOAP_MALLOC(soap, strlen(domain)+1))) - strcpy(q->domain, domain); - if (path && *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) - { soap_set_receiver_error(soap, "Cookie domain not set", NULL, SOAP_HTTP_ERROR); - return; - } - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - 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 -long -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; - if ((p = soap_cookie(soap, name, domain, path))) - { p->expire = 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 || !p->env) - { 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) - sprintf(s, ";Domain=\"%s\"", p->domain); - else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) - sprintf(s, ";Domain=\"%s\"", soap->cookie_domain); - strcat(s, ";Path=\"/"); - if (p->path) - t = p->path; - else - t = soap->cookie_path; - if (t) - { if (*t == '/') - t++; - if ((int)strlen(t) < tmp-s+4064) - strcat(s, t); - } - s += strlen(s); - *s++ = '"'; - if (p->version > 0) - sprintf(s, ";Version=%u", p->version); - if (p->expire >= 0) - sprintf(s, ";Max-Age=%ld", p->expire); - if (p->secure) - strcat(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 - { size_t domlen = 0; - if (q->domain) - { const char *s = strchr(q->domain, ':'); - if (s) - domlen = s - q->domain; - else - domlen = strlen(q->domain); - } - if ((!q->domain || !strncmp(q->domain, domain, domlen)) - && (!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 && (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 = (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:"", p->domain?p->domain:"", p->path?p->path:"", 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; - p->domain = domain; - p->path = 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:"", p->domain?p->domain:"", p->path?p->path:"", 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 *soap) -{ struct soap_cookie *p, **q, *r; - q = &r; - for (p = soap->cookies; p; p = p->next) - { if (!(*q = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) - return r; - **q = *p; - if (p->name) - { if (((*q)->name = (char*)SOAP_MALLOC(soap, strlen(p->name)+1))) - strcpy((*q)->name, p->name); - } - if (p->value) - { if (((*q)->value = (char*)SOAP_MALLOC(soap, strlen(p->value)+1))) - strcpy((*q)->value, p->value); - } - if (p->domain) - { if (((*q)->domain = (char*)SOAP_MALLOC(soap, strlen(p->domain)+1))) - strcpy((*q)->domain, p->domain); - } - if (p->path) - { if (((*q)->path = (char*)SOAP_MALLOC(soap, 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, 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)f != 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; - soap->error = SOAP_OK; - soap_free(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->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; -#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; - soap->xlist = NULL; -#endif -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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 -#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")); - 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 &= ~SOAP_IO; - soap->error = soap->fparse(soap); - if (soap->error && soap->error < SOAP_STOP) - { soap->keep_alive = 0; /* force close later */ - return soap->error; - } - 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 -#ifdef WITH_ZLIB - if (soap->zlib_in != SOAP_ZLIB_NONE) - { /* fparse should not use soap_unget to push back last char */ -#ifdef WITH_GZIP - 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->zlib_state = SOAP_ZLIB_INFLATE; - soap->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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_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 get = 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; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return soap->error; - 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) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - 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\n")); - 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 (s && (((get = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!get); - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!get), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (get) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - if (status) - return soap->error = status; - return SOAP_OK; - } - if (k == 0 || (k >= 200 && k <= 299) || k == 400 || k == 500) - return SOAP_OK; - 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")) - { if (soap_get_header_attribute(soap, val, "application/dime")) - soap->mode |= 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->mode |= SOAP_ENC_MIME; - } - } -#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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 if (!soap_tag_cmp(key, "Location")) - { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); - soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; - } -#ifdef WITH_COOKIES - else if (!soap_tag_cmp(key, "Cookie") || !soap_tag_cmp(key, "Set-Cookie")) - 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 (soap_notblank(*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) - { const char *s; - if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) - s = "application/dime"; - else if (soap->version == 2) - s = "application/soap+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)) + ((strlen(soap->dime.type)+3)&(~3)); - } - 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 -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)) - return soap->error = SOAP_VERSIONMISMATCH; - 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)) - 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; - 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; - if (!strncmp(endpoint, "https:", 6)) - soap->port = 443; - strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); - 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++) - { soap->host[i] = s[i]; - if (s[i] == ']') - { s++; - break; - } - } - } - 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 (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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - soap->error = SOAP_OK; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - 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) - { soap->status = http_command; - 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)); -#ifdef WITH_UDP - 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; -#ifndef WITH_NOHTTP - 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; - } - else if (action) - soap->action = soap_strdup(soap, action); - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } - *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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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 = 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) -{ register const char *s; -#ifndef WITH_LEANER - register const char *r = NULL; -#endif - register int err; - if (status == SOAP_FILE && soap->http_content) - s = soap->http_content; - else if (status == SOAP_HTML) - s = "text/html; charset=utf-8"; - else if (soap->version == 2) - s = "application/soap+xml; charset=utf-8"; - else - s = "text/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 && soap->status != SOAP_GET) - { 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); - 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 ((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", "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 (count > 0) - { 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_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"; - count = 0; - } - else - s = "POST"; -#ifdef PALM - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) -#else - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6))) -#endif - return SOAP_OK; - if (soap->proxy_host && strncmp(endpoint, "https:", 6)) - 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; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) - || (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, 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, 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 (action && soap->version == 1) - { sprintf(soap->tmpbuf, "\"%s\"", action); - 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 /* WMW_RPM_IO */ - if (!status || status == SOAP_HTML || status == SOAP_FILE) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "OK 200\n")); -#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 /* WMW_RPM_IO */ - { sprintf(soap->tmpbuf, "HTTP/%s 200 OK", soap->http_version); - if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return err; - } - else if ((err = soap->fposthdr(soap, "Status", "200 OK"))) - 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 ? 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 && !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 /* WMW_RPM_IO */ - { 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; - } - if ((err = soap->fposthdr(soap, "Server", "gSOAP/2.7")) - || (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_IO; - soap->omode |= 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 (!*c && !*s && 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 = "SOAP version mismatch or invalid SOAP message"; - break; - case SOAP_DATAENCODINGUNKNOWN: - *c = "SOAP-ENV:DataEncodingUnknown"; - *s = "Unsupported SOAP data encoding"; - break; - case SOAP_NAMESPACE: - *s = soap_set_validation_fault(soap, "namespace mismatch", 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_GET_METHOD: - *s = "HTTP GET method not implemented"; - break; - case SOAP_EOM: - *s = "Out of memory"; - 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 ref ", 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 = "HTTP error"; - 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:""); - *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, "min/maxOccurs violation", NULL); - break; - case SOAP_LENGTH: - *s = soap_set_validation_fault(soap, "content length violation", NULL); - break; - case SOAP_STOP: - *s = "Stopped: no response sent"; - break; -#endif - case SOAP_EOF: -#ifndef WITH_NOIO - sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); - *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; - int r = 1; - 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); -#ifndef WITH_NOIO -#ifndef WITH_LEAN - 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)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, NULL, &timeout); - if (r > 0) - { if (!FD_ISSET((SOAP_SOCKET)soap->socket, &sfd) - || (FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - && recv((SOAP_SOCKET)soap->socket, soap->tmpbuf, 1, MSG_PEEK) < 0)) - r = 0; - } - } -#endif -#endif - if ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && 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) -{ soap->count = 0; - if (soap_response(soap, SOAP_OK) || soap_end_send(soap)) - return soap_closesock(soap); - 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)) - return soap_closesock(soap); - return SOAP_OK; -} -#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 - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)&soap->errorstr, sizeof(soap->errorstr), NULL); - return soap->errorstr; -#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 *faultsubcode, const char *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - if (faultsubcode) - *soap_faultsubcode(soap) = faultsubcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - 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 *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ char *r = NULL, *s = NULL, *t = NULL; - if (faultsubcode) - r = soap_strdup(soap, faultsubcode); - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - 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 *faultdetail) -{ return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcode, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcode, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -#ifndef WITH_NOSTDLIB -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault(struct soap *soap, FILE *fd) -{ 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 - -/******************************************************************************/ -#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->buflen > 0) - { 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** HERE **\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 - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.h deleted file mode 100644 index 17ef597..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6b.h +++ /dev/null @@ -1,2053 +0,0 @@ -/* - -stdsoap2.h 2.7.6b - -gSOAP runtime - -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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - 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-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 --------------------------------------------------------------------------------- -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 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(__alpha) && !defined(__VMS) -# ifndef TRU64 -# define TRU64 -# endif -#endif - -#ifdef __MVS__ -# ifndef OS390 -# define OS390 -# endif -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -# ifdef WITH_OPENSSL -# ifndef HAVE_OPENSSL_SSL_H -# undef WITH_OPENSSL -# 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_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(_AIXVERSION_431) -# 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(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_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_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_STRTOLL -# define HAVE_STRTOULL -# 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_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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# 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_MB -# 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 - -/* QNX does not have a working version of strtof */ -#if defined(__QNX__) || defined(QNX) -# undef HAVE_STRTOF -#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 - -#ifndef WITH_NOSTDLIB -# include -# ifndef PALM -# include -# include -# endif -# include -# include -#endif - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# include -# include -#endif - -#ifdef WITH_NOHTTP -# ifndef WITH_NOIO -# define WITH_NOIO -# undef WITH_COOKIES -# endif -#endif - -#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 -# endif -# ifndef VXWORKS -# 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 WITH_FASTCGI -# include -#endif - -#ifdef WITH_OPENSSL -# define OPENSSL_NO_KRB5 -# 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 - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -# ifndef WITH_NOIO -# ifndef PALM -# include -# include -# include -# include -# endif -# endif -#endif - -/* Portability: define SOAP_SOCKLEN_T */ -#if 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(_AIX) -# 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 - -#ifdef WIN32 -# define SOAP_SOCKET SOCKET -#else -# define SOAP_SOCKET int -# define closesocket(n) close(n) -#endif - -#define SOAP_INVALID_SOCKET (-1) -#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) - -#if defined(SYMBIAN) -# define LONG64 long -# define ULONG64 unsigned LONG64 -#elif !defined(WIN32) || defined(__GLIBC__) || defined(__GNU__) -# ifndef LONG64 -# define LONG64 long long -# define ULONG64 unsigned LONG64 -# endif -#elif defined(UNDER_CE) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#elif defined(__BORLANDC__) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#endif - -#if defined(WIN32) -# define soap_int32 __int32 -#elif defined(SYMBIAN) -# define soap_int32 long -#elif defined(PALM) -# define soap_int32 Int32 -#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 -#else -# define SOAP_ERANGE ERANGE -# define SOAP_EINTR EINTR -# define SOAP_EAGAIN EAGAIN -# 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 GetLastError() -# else -# define soap_errno GetLastError() -# define soap_socket_errno WSAGetLastError() -# endif -#else -# ifndef WITH_NOIO -# define soap_errno errno -# define soap_socket_errno errno -# else -# define soap_errno 0 -# define soap_socket_errno 0 -# endif -#endif - -#ifndef SOAP_BUFLEN -# ifdef WITH_UDP -# define SOAP_BUFLEN (65536) /* max UDP packet size */ -# else -# ifndef WITH_LEAN -# define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -# endif -#endif -#ifndef SOAP_LABLEN -# define SOAP_LABLEN (64) /* 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 (256) /* 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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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 soap_isnan(n) isnan(n) -#endif - -#if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED)) -# define HAVE_ISNAN -#endif - -#ifndef soap_isnan -# ifdef HAVE_ISNAN -# define soap_isnan(n) isnan(n) -# else -# define soap_isnan(_) (0) -# endif -#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 -# ifdef HAVE_ISNAN -# define FLT_NAN (*(float*)(void*)&soap_double_nan) -# else -# define FLT_NAN (0.0) -# endif -#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 -# ifdef HAVE_ISNAN -# define DBL_NAN (*(double*)(void*)&soap_double_nan) -# else -# define DBL_NAN (0.0) -# endif -#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 - -#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_GET_METHOD 14 -#define SOAP_EOM 15 -#define SOAP_NULL 16 -#define SOAP_DUPLICATE_ID 17 -#define SOAP_MISSING_ID 18 -#define SOAP_HREF 19 -#define SOAP_UDP_ERROR 20 -#define SOAP_TCP_ERROR 21 -#define SOAP_HTTP_ERROR 22 -#define SOAP_SSL_ERROR 23 -#define SOAP_ZLIB_ERROR 24 -#define SOAP_DIME_ERROR 25 -#define SOAP_DIME_HREF 26 -#define SOAP_DIME_MISMATCH 27 -#define SOAP_DIME_END 28 -#define SOAP_MIME_ERROR 29 -#define SOAP_MIME_HREF 30 -#define SOAP_MIME_END 31 -#define SOAP_VERSIONMISMATCH 32 -#define SOAP_PLUGIN_ERROR 33 -#define SOAP_DATAENCODINGUNKNOWN 34 -#define SOAP_REQUIRED 35 -#define SOAP_PROHIBITED 36 -#define SOAP_OCCURS 37 -#define SOAP_LENGTH 38 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (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) >= 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 -#define SOAP_IO_LENGTH 0x00000008 -#define SOAP_IO_KEEPALIVE 0x00000010 - -#define SOAP_ENC_LATIN 0x00800020 /* 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 /* strict validation */ -#define SOAP_XML_INDENT 0x00002000 -#define SOAP_XML_CANONICAL 0x00004000 /* EXC C14N canonical XML */ -#define SOAP_XML_TREE 0x00008000 -#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 -#define SOAP_C_UTFSTRING 0x00200000 -#define SOAP_C_MBSTRING 0x00400000 - -#define SOAP_DOM_TREE 0x01000000 -#define SOAP_DOM_NODE 0x02000000 -#define SOAP_DOM_ASIS 0x04000000 - -#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_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION - -/* */ - -#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 -# endif -#endif - -#ifdef SOAP_DEBUG -# define SOAP_MALLOC(soap, size) soap_track_malloc(soap, __FILE__, __LINE__, size) -# define SOAP_FREE(soap, ptr) soap_track_free(soap, __FILE__, __LINE__, ptr) -#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(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(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 DGBFUN -# 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.2hhX ", *s++);\ - 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_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; - void (*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 */ -}; - -struct soap_cookie -{ struct soap_cookie *next; - char *name; - char *value; - char *domain; - char *path; - long expire; /* client-side: local time to expire; 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 */ -}; - -#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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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 const char* SOAP_FMAC2 soap_dom_current_nstr(struct soap *soap, const char *tag); -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) -} -extern std::ostream &operator<<(std::ostream&, const struct soap_dom_element&); -extern std::istream &operator>>(std::istream&, struct soap_dom_element&); -extern "C" { -#endif - -/******************************************************************************/ - -struct soap -{ short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ - short copy; /* 1 = copy of another soap struct */ - 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 */ - 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 (*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 (*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); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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*); -#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); -#endif - int master; - int socket; -#if defined(__cplusplus) && !defined(WITH_LEAN) - std::ostream *os; - std::istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#endif -#ifndef UNDER_CE - int sendfd; - int recvfd; -#else - FILE *sendfd; - FILE *recvfd; -#endif -#ifdef WIN32 - char errorstr[256]; /* buf for FormatMessage() */ -#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 */ -#ifdef WITH_FAST - char *labbuf; /* look-aside buffer */ - size_t lablen; /* look-aside buffer allocated length */ - size_t labidx; /* look-aside buffer index to available part */ -#endif - char buf[SOAP_BUFLEN];/* send and receive buffer */ - char tmpbuf[1024]; /* in/output buffer for HTTP headers, simpleType values, attribute names, and DIME >=1024 bytes */ - char msgbuf[1024]; /* output buffer for (error) messages <=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 keep_alive; /* connection should be kept open */ - 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 */ - unsigned int max_keep_alive; - 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 */ - 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 -#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 - size_t peerlen; -#endif -#ifdef WITH_OPENSSL - int (*fsslauth)(struct soap*); - int (*fsslverify)(int, X509_STORE_CTX*); - BIO *bio; - SSL *ssl; - SSL_CTX *ctx; - short require_server_auth; - short require_client_auth; - short rsa; /* when set, use RSA instead of DH */ - const char *keyfile; - const char *password; - const char *dhfile; - const char *cafile; - const char *capath; - const char *crlfile; - const char *randfile; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - uLong z_crc; /* internal gzip crc */ - 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 */ -#endif -/* WR[ */ -#ifdef WMW_RPM_IO - void *rpmreqid; -#endif /* WMW_RPM_IO */ -/* ]WR */ -}; - -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; - void (*fcopy)(struct soap*, int, int, void*, 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(); -#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, 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_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 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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_accept(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); - -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 *str); -SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code); - -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, void (*fdelete)(struct soap_clist*)); -SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); -SOAP_FMAC1 void SOAP_FMAC2 soap_free(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, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, 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, 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 struct soap *SOAP_FMAC2 soap_copy(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(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_token(struct soap*); -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 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); - -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 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*, int n1, int n2); - -SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, 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 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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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*); -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*); -#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_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_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); -#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); - -#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); -#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 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); -#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 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 long 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*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.c deleted file mode 100644 index 461bea7..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.c +++ /dev/null @@ -1,13362 +0,0 @@ -/* - -stdsoap2.c[pp] 2.7.6d - -gSOAP runtime - -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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems Inc., for the following additions under gSOAP public license: - - vxWorks compatible (#define VXWORKS) --------------------------------------------------------------------------------- -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 --------------------------------------------------------------------------------- -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 __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.6d 2005-12-29 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.6d 2005-12-29 12: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) -#define soap_hash_ptr(p) (((unsigned long)(p) >> 3) & (SOAP_PTRHASH - 1)) - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -static void soap_close_logfile(struct soap*, int); -static void soap_set_logfile(struct soap*, int, const char*); -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 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*); -#ifndef WITH_NOIDREF -static void soap_update_ptrs(struct soap*, char*, char*, long); -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 time_t soap_timegm(struct tm*); -static struct soap_nlist *soap_lookup_ns(struct soap *soap, const char *tag, size_t n); -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 int soap_match_cid(struct soap*, const char*, const char*); -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 -static void ssl_init(); -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -static const char *ssl_error(struct soap*, int); -/* This callback is included for future references. It should not be deleted -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_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 int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); -static int tcp_accept(struct soap*, int, 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 -#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 - -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[] = -{ { 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 - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -static int -fsend(struct soap *soap, const char *s, size_t n) -{ register int nwritten; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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)soap->socket, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return SOAP_EOF; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else if (soap->bio) - nwritten = BIO_write(soap->bio, s, n); - else -#endif -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - { if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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; - 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)soap->socket, &fd); - select((SOAP_SOCKET)(soap->socket + 1), NULL, NULL, &fd, &timeout); - if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { -#ifdef WITH_OPENSSL - int err; - if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return SOAP_EOF; -#endif - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EWOULDBLOCK && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - 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 - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -#endif -#endif -#endif - if (nwritten <= 0) - { if (soap_errno != SOAP_EINTR && soap_errno != SOAP_EWOULDBLOCK && soap_errno != SOAP_EAGAIN) - { soap->errnum = soap_errno; - 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 int 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:"")); - 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, 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; - soap->errnum = 0; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->recv_timeout) - { 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)soap->socket, &fd); - for (;;) - { r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return 0; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { soap->errnum = soap_socket_errno; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { int err; - r = SSL_read(soap->ssl, s, 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, n); - if (r > 0) - return (size_t)r; - return 0; - } - else -#endif - { -#ifdef WITH_UDP - 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)soap->socket, s, 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); - soap->port = (int)ntohs(soap->peer.sin_port); -#endif - } - else -#endif - r = recv((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags); - if (r >= 0) - return (size_t)r; - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN && soap_socket_errno != SOAP_EWOULDBLOCK) - { soap->errnum = soap_socket_errno; - return 0; - } - } -#ifndef WITH_LEAN - { struct timeval timeout; - fd_set fd; - timeout.tv_sec = 0; - timeout.tv_usec = 10000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); -#ifdef WITH_OPENSSL - if (soap->ssl && SSL_get_error(soap->ssl, r) == SSL_ERROR_WANT_WRITE) - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#endif - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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 - r = read((SOAP_SOCKET)soap->recvfd, s, n); - 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; - 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); - 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 (soap->buflen) - { soap->count += soap->buflen; - 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->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; - } - } -#endif -#ifndef WITH_NOHTTP - if ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK) /* read HTTP chunked transfer */ - { -chunk_again: - 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; - } - else - { register soap_wchar c; - char *t, tmp[8]; - 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'; - 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); - return soap->ahead = EOF; - } - 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) - goto chunk_again; - } - } - 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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - } - else - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Unable to inflate: (%d) %s\n", r, soap->d_stream.msg?soap->d_stream.msg:"")); - 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 *map, const char *str) -{ if (str) - { while (map->string) - { if (!strcmp(str, map->string)) /* case sensitive */ - return map; - map++; - } - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -long -SOAP_FMAC2 -soap_int_code(const struct soap_code_map *map, const char *str, long other) -{ while (map->string) - { if (!soap_tag_cmp(str, map->string)) /* case insensitive */ - return map->code; - map++; - } - return other; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_str_code(const struct soap_code_map *map, long code) -{ while (map->code != code && map->string) - map++; - return map->string; -} -#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_int_code(html_entity_codes, tmp, SOAP_UNKNOWN_CHAR); -#else - return SOAP_UNKNOWN_CHAR; /* use this to represent unknown code */ -#endif -} -#endif - -/******************************************************************************/ -#ifdef WITH_LEAN -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 - -/******************************************************************************/ -#ifdef WITH_LEAN -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 - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -soap_wchar -SOAP_FMAC2 -soap_get(struct soap *soap) -{ register soap_wchar c; - c = soap->ahead; - if (c) - { if (c != EOF) - soap->ahead = 0; - } - else - c = soap_get1(soap); - for (;;) - { if (soap->cdata) - { if (c == ']') - { c = soap_get1(soap); - if (c == ']') - { soap->cdata = 0; - soap_get1(soap); /* skip > */ - c = soap_get1(soap); - } - 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 > 0 && c < 0x80) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - 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 int 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, 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 int 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; - 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } while (j < 4); - *s++ = (char)((m >> 16) & 0xFF); - *s++ = (char)((m >> 8) & 0xFF); - *s++ = (char)(m & 0xFF); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } 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) && *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 = (struct soap_xlist*)SOAP_MALLOC(soap, sizeof(struct soap_xlist)); - *ptr = NULL; - *size = 0; - *id = soap_strdup(soap, soap->href); - *type = NULL; - *options = NULL; - 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 -int -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)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->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, long offset) -{ int i; - register struct soap_ilist *ip; - register struct soap_flist *fp; -#ifndef WITH_LEANER - register struct soap_xlist *xp; -#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 + offset)); - ip->ptr = (char*)ip->ptr + offset; - } - 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 + offset; - } - } - 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 + offset; - } - } - 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 + offset; - } - } - } - } -#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:"", xp->ptr, (char*)xp->ptr + offset)); - xp->ptr = (unsigned char**)((char*)xp->ptr + offset); - xp->size = (int*)((char*)xp->size + offset); - xp->type = (char**)((char*)xp->type + offset); - xp->options = (char**)((char*)xp->options + offset); - } - } -#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; - register struct soap_flist *fp; - 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; - register struct soap_flist *fp; - 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, p, ip->size); - else - soap_fcopy(soap, ip->type, fp->type, fp->ptr, 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, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(soap, p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(soap, p); - } - soap->blist = bp->next; - SOAP_FREE(soap, bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); -#ifndef WITH_NOIDREF - if (flag) - soap_update_ptrs(soap, q, q + n, (long)s - (long)q); /* pointers s and q may or may not be related */ -#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); - 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 = 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; - 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; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int 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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - return SOAP_OK; - return 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; - 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; - 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; - if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - } - else if (SOAP_STRCMP(tag1, t + 1)) - return SOAP_TAG_MISMATCH; - else if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - 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 - -/******************************************************************************/ - -#ifdef WITH_OPENSSL -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_rand() -{ unsigned char buf[4]; - 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; - if (dhfile) - { soap->dhfile = dhfile; - soap->rsa = 0; - } - else - { soap->dhfile = NULL; - soap->rsa = 1; - } - soap->randfile = randfile; - soap->require_client_auth = (flags & SOAP_SSL_REQUIRE_CLIENT_AUTHENTICATION); - if (!(err = soap->fsslauth(soap))) - { if (sid) - SSL_CTX_set_session_id_context(soap->ctx, (unsigned char*)sid, 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->rsa = 0; - soap->randfile = randfile; - soap->require_server_auth = (flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION); - return soap->fsslauth(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static void -ssl_init() -{ static int done = 0; - if (!done) - { 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 -static const char * -ssl_error(struct soap *soap, int ret) -{ int err = SSL_get_error(soap->ssl, ret); - const char *msg = soap_str_code(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 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) -{ ssl_init(); - 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); - } - 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->require_client_auth) - SSL_CTX_set_client_CA_list(soap->ctx, SSL_load_client_CA_file(soap->cafile)); - } - 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); -/* See 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 cafile first before the key file: - 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->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); - } - SSL_CTX_set_options(soap->ctx, SSL_OP_ALL | SSL_OP_NO_SSLv2); - SSL_CTX_set_verify(soap->ctx, soap->require_client_auth ? (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT) : soap->require_server_auth ? SSL_VERIFY_PEER : SSL_VERIFY_NONE, 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 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ BIO *bio; - int i, r; - 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_INVALID_SOCKET; - 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; -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)&nonblocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); - i = 100; /* 100 * 0.1 ms retries */ - while ((r = SSL_accept(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - if (i-- <= 0) - break; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - return SOAP_EOF; - } - } - else - { soap->errnum = err; - break; - } - } -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)&blocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - if (r <= 0) - { soap_set_receiver_error(soap, ssl_error(soap, r), "SSL_accept() failed in soap_ssl_accept()", SOAP_SSL_ERROR); - soap_closesock(soap); - return SOAP_SSL_ERROR; - } - if (soap->require_client_auth) - { 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 /* 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 - soap_free(soap); - while (soap->clist) - { struct soap_clist *p = soap->clist->next; - SOAP_FREE(soap, soap->clist); - soap->clist = p; - } - 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->copy) - soap->plugins->fdelete(soap, soap->plugins); - SOAP_FREE(soap, soap->plugins); - soap->plugins = p; - } - soap->fplugin = fplugin; -#ifndef WITH_NOHTTP - soap->fpost = http_post; - soap->fget = http_get; - soap->fform = NULL; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#endif -#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->copy) - { if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = 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_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_str_code(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_str_code(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(_AIXVERSION_431) || defined(TRU64) - 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__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - 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 int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ -#ifdef WITH_IPV6 - struct addrinfo hints, *res, *ressave; - int err; -#endif - register int fd; -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->socket)) - soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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, gai_strerror(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - ressave = res; -again: - fd = (int)socket(res->ai_family, res->ai_socktype, res->ai_protocol); - soap->errmode = 0; -#else -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - fd = (int)socket(AF_INET, SOCK_DGRAM, 0); - else -#endif - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -#endif - if (fd < 0) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR); - 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 = 0; - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_LINGER failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - if ((soap->connect_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, soap->connect_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_KEEPALIVE failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_SNDBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)fd, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt SO_RCVBUF failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (!(soap->omode & SOAP_IO_UDP) && setsockopt((SOAP_SOCKET)fd, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "setsockopt TCP_NODELAY failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#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, (SOAP_SOCKET)fd); - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->peer.sin_port = htons((short)port); - } - soap->errmode = 0; - if ((soap->omode & SOAP_IO_UDP)) - return fd; -#endif -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); /* modified to use fd */ - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, res->ai_addr, res->ai_addrlen)) -#else - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) -#endif - { -#ifndef WITH_LEAN - if (soap->connect_timeout && (soap_socket_errno == SOAP_EINPROGRESS || soap_socket_errno == SOAP_EWOULDBLOCK)) - { struct timeval timeout; - SOAP_SOCKLEN_T k; - fd_set fds; - 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((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)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")); - soap->errnum = soap_socket_errno; - soap_set_sender_error(soap, tcp_error(soap), "connect failed in tcp_connect()", SOAP_TCP_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - else -#endif -#ifdef WITH_IPV6 - if (res->ai_next) - { res = res->ai_next; - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - goto again; - } - else -#endif - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - 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, (SOAP_SOCKET)fd); - 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->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - soap->socket = fd; - soap->imode &= ~SOAP_ENC_SSL; - soap->omode &= ~SOAP_ENC_SSL; - if (!strncmp(endpoint, "https:", 6)) - { -#ifdef WITH_OPENSSL - BIO *bio; - int r; - if (soap->proxy_host) - { short v; - unsigned int k = 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; - soap_begin_send(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Connecting to proxy server\n")); - sprintf(soap->tmpbuf, "CONNECT %s:%d HTTP/%s", host, port, soap->http_version); - if ((soap->error = soap->fposthdr(soap, soap->tmpbuf, NULL))) - { soap->fclosesocket(soap, (SOAP_SOCKET)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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return soap->error; - } - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->omode = k; - k = soap->imode; - soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ - v = soap->version; /* preserve */ - userid = soap->userid; /* preserve */ - passwd = soap->passwd; /* preserve */ - if (soap_begin_recv(soap)) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->userid = userid; /* restore */ - soap->passwd = passwd; /* restore */ - soap->version = v; /* restore */ - soap->imode = k; /* restore */ - soap->count = n; /* restore */ - soap_begin_send(soap); - } - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; - } - 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((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - { soap_set_sender_error(soap, ssl_error(soap, r), "SSL connect failed in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(fd + 1), &fds, NULL, &fds, &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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - continue; - } - } - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if (soap->require_server_auth) - { X509 *peer; - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - X509_NAME_get_text_by_NID(X509_get_subject_name(peer), NID_commonName, soap->msgbuf, sizeof(soap->msgbuf)); - X509_free(peer); - if (soap_tag_cmp(soap->msgbuf, host)) - { soap_set_sender_error(soap, "SSL error", "SSL certificate host name mismatch in tcp_connect()", SOAP_SSL_ERROR); - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } -#else - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; -#endif - } - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -SOAP_FMAC1 -int -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; -#endif -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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; - soap->peer = *((struct sockaddr_storage*)addrinfo->ai_addr); - soap->peerlen = addrinfo->ai_addrlen; - res.ai_addr = (struct sockaddr*)&soap->peer; - res.ai_addrlen = soap->peerlen; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - soap->master = socket(res.ai_family, res.ai_socktype, res.ai_protocol); -#else -#ifdef WITH_UDP - 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_set_receiver_error(soap, tcp_error(soap), "socket failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } -#ifdef WITH_UDP - 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_SOCKET)soap->master, SOL_SOCKET, soap->bind_flags, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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 - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, res.ai_addr, res.ai_addrlen)) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, (struct sockaddr*)&soap->peer, soap->peerlen)) - { soap->errnum = soap_socket_errno; - 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_SOCKET)soap->master, backlog)) - { soap->errnum = soap_socket_errno; - 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; - int r; - 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)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - FD_SET((SOAP_SOCKET)soap->socket, &xfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, &xfd, &timeout); - if (r > 0 && FD_ISSET((SOAP_SOCKET)soap->socket, &xfd)) - r = -1; - } - else if (soap_valid_socket(soap->master)) - { FD_SET((SOAP_SOCKET)soap->master, &sfd); - r = select((SOAP_SOCKET)(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)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)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)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - || recv((SOAP_SOCKET)soap->socket, soap->tmpbuf, 1, MSG_PEEK) > 0)) - return SOAP_OK; - } - else if (r < 0) - { soap->errnum = soap_socket_errno; - if ((soap_valid_socket(soap->master) || soap_valid_socket(soap->socket)) && soap_socket_errno != 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 int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ int fd; - fd = (int)accept((SOAP_SOCKET)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 -int -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; -#ifdef WITH_UDP - 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)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->accept_timeout) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - if (soap_socket_errno != SOAP_EINTR) - { soap->errnum = soap_socket_errno; - soap_closesock(soap); - soap_set_sender_error(soap, tcp_error(soap), "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - } -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#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 = 0; - if (setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, SO_LINGER, (char*)&linger, sizeof(struct linger))) - { soap->errnum = soap_socket_errno; - 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; - } - } - if ((soap->accept_flags & ~SO_LINGER) && setsockopt((SOAP_SOCKET)soap->socket, SOL_SOCKET, soap->accept_flags & ~SO_LINGER, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, SOL_SOCKET, SO_KEEPALIVE, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, SOL_SOCKET, SO_SNDBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, SOL_SOCKET, SO_RCVBUF, (char*)&len, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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)soap->socket, IPPROTO_TCP, TCP_NODELAY, (char*)&set, sizeof(int))) - { soap->errnum = soap_socket_errno; - 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 - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -#elif defined(VXWORKS) - u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&blocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&blocking)); -#elif defined(PALM) - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); -#elif defined(SYMBIAN) - long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - } - soap->keep_alive = (((soap->imode | soap->omode) & SOAP_IO_KEEPALIVE) != 0); - return soap->socket; - } - if (soap_socket_errno != SOAP_EINTR && soap_socket_errno != SOAP_EAGAIN) - { DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Accept failed from %s\n", soap->host)); - soap->errnum = soap_socket_errno; - 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); - 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 != 1) - { s = ERR_get_error(); - if (s) - { if (soap_valid_socket(soap->socket)) - { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); - soap->socket = SOAP_INVALID_SOCKET; - } - r = SSL_shutdown(soap->ssl); - } - } - DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); - 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)soap->socket, 2); - soap->fclosesocket(soap, (SOAP_SOCKET)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 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_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 int 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_clr_attr(soap); - soap_set_local_namespaces(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; - 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) -{ soap->error = SOAP_OK; - soap_clr_attr(soap); - soap_set_local_namespaces(soap); - 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 -#ifdef WITH_UDP - 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) - soap_new_block(soap); - 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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->sendfd, _O_BINARY); -#endif -#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; -#ifdef WITH_ZLIB - soap->z_ratio_out = 1.0; - if ((soap->mode & SOAP_ENC_ZLIB) && soap->zlib_state != SOAP_ZLIB_DEFLATE) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#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; - 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_NOIDREF -#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) -{ 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:"", id, atype?atype:"")); - 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; - return -1; -} -#endif -#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, *p; - register struct soap_flist *fp, *fq; - 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; - 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; - } - return NULL; -} -#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); - 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; - } - /* keep chain of alloced cells for later destruction */ - soap->alloced = 1; - *(void**)(p + n) = soap->alist; - *(size_t*)(p + n + sizeof(void*)) = n; - soap->alist = p + n; - return p; -} -#endif - -/******************************************************************************/ -#ifdef SOAP_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_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_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 int h = soap_hash_ptr(p); - register struct soap_mlist *mp = (struct soap_mlist*)malloc(sizeof(struct soap_mlist)); - if (soap->fdebug[SOAP_INDEX_TEST]) - 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_DEBUG -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_track_free(struct soap *soap, const char *file, int line, void *p) -{ register int 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_DEBUG -static void -soap_track_unlink(struct soap *soap, const void *p) -{ register int 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) - return; - if (p) - { register char **q; - 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, "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; - 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; -#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 = &soap->clist; - if (p) - { while (*cp) - { if (p == (*cp)->ptr) - { register struct soap_clist *q = *cp; - *cp = q->next; - q->fdelete(q); - 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->ptr == (void*)soap->fault) - soap->fault = NULL; /* this was deallocated */ - else if (q->ptr == (void*)soap->header) - soap->header = NULL; /* this was deallocated */ - q->fdelete(q); - SOAP_FREE(soap, q); - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_clist * -SOAP_FMAC2 -soap_link(struct soap *soap, void *p, int t, int n, void (*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_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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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: id type=%d href type=%d\n", 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*)); - 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*)); - *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, int st, int tt, size_t n, unsigned int k, void (*fcopy)(struct soap*, int, int, void*, 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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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; - 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 href='%s'\n", st, tt, (unsigned long)n, p, k, 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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, 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } -#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)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)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)) - return soap->error; - soap->dime.list = soap->dime.first; - soap->dime.first = NULL; - soap->dime.last = NULL; - if ((soap->mode & SOAP_ENC_MIME) && soap_getmime(soap)) - return soap->error; - soap->mime.list = soap->mime.first; - soap->mime.first = NULL; - soap->mime.last = NULL; - soap->mime.boundary = NULL; -#endif - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "End of receive message ok\n")); -#ifdef WITH_ZLIB - if (soap->mode & SOAP_ENC_ZLIB) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { soap_wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(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; - } - } -#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 - return soap_resolve(soap); -#else -#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 - return SOAP_OK; -#endif -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free(struct soap *soap) -{ register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { register struct soap_nlist *np = soap->nlist->next; - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n")); - while (soap->attributes) - { register struct soap_attribute *tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap, soap->attributes->value); - SOAP_FREE(soap, soap->attributes); - soap->attributes = tp; - } -#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 - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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) -{ char *s = NULL; - soap_close_logfile(soap, i); - if (soap->logfile[i]) - SOAP_FREE(soap, (void*)soap->logfile[i]); - if (logfile) - if ((s = (char*)SOAP_MALLOC(soap, strlen(logfile) + 1))) - strcpy(s, logfile); - soap->logfile[i] = s; -} -#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(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, struct soap *soap) -{ if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - copy->copy = 1; - copy->user = NULL; - 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; -#ifdef WITH_FAST - copy->labbuf = NULL; - copy->lablen = 0; - copy->labidx = 0; -#endif -#ifdef SOAP_DEBUG - soap_init_mht(copy); -#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); -#else - copy->cookies = NULL; -#endif -#endif -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); - soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); - soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); -#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 && (soap->error = p->fcopy(copy, q, p))) - { SOAP_FREE(copy, q); - return NULL; - } - q->next = copy->plugins; - copy->plugins = q; - } - } - else - soap->error = SOAP_EOM; - return copy; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_init(struct soap *soap) -{ soap->version = 0; - soap_imode(soap, SOAP_IO_DEFAULT); - soap_omode(soap, SOAP_IO_DEFAULT); - soap->copy = 0; - soap->plugins = NULL; - soap->user = NULL; - soap->userid = NULL; - soap->passwd = NULL; -#ifndef WITH_NOHTTP - soap->fpost = http_post; - soap->fget = http_get; - soap->fform = NULL; - soap->fposthdr = http_post_header; - soap->fresponse = http_response; - soap->fparse = http_parse; - soap->fparsehdr = http_parse_header; -#endif - soap->fconnect = NULL; - soap->fdisconnect = 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; - soap->fplugin = fplugin; -#ifndef WITH_LEANER - soap->fdimereadopen = NULL; - soap->fdimewriteopen = NULL; - soap->fdimereadclose = NULL; - soap->fdimewriteclose = NULL; - soap->fdimeread = NULL; - soap->fdimewrite = NULL; -#endif - soap->float_format = "%.8g"; /* .8 preserves single FP precision as much as possible, but might not be very efficient */ - soap->double_format = "%.17lg"; /* .17 preserves double FP precision as much as possible, but might not be very efficient */ - soap->dime_id_format = "cid:id%d"; /* default DIME id format */ - soap->http_version = "1.1"; - soap->actor = NULL; - soap->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->ip = 0; -#ifdef WITH_FAST - soap->labbuf = NULL; - soap->lablen = 0; - soap->labidx = 0; -#endif - 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_OPENSSL - soap->fsslauth = ssl_auth_init; - soap->fsslverify = ssl_verify_callback; - soap->bio = NULL; - soap->ssl = NULL; - soap->ctx = NULL; - soap->require_server_auth = 0; - soap->require_client_auth = 0; - soap->rsa = 0; - 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_ZLIB - soap->zlib_state = SOAP_ZLIB_NONE; - soap->zlib_in = SOAP_ZLIB_NONE; - soap->zlib_out = SOAP_ZLIB_NONE; - soap->d_stream.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = 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 SOAP_DEBUG - soap_init_mht(soap); - soap_init_logs(soap); - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, NULL); -#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 - soap_begin(soap); -#ifdef SOAP_DEBUG - soap_set_test_logfile(soap, "TEST.log"); -#endif -} -#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, "Initializing\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(soap); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end(struct soap *soap) -{ register struct soap_clist *cp; - soap_free(soap); - soap_dealloc(soap, NULL); - while (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, 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) -{ size_t n = strlen(little); - 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 -static struct soap_nlist * -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 - -/******************************************************************************/ -#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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push namespace binding (level=%u) '%s' '%s'\n", soap->level, id, ns?ns:"")); - 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->index == 1) - utilized = np->index; - else - return NULL; - } - } - 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); - if (np) - { if (np->index == 0) - soap_push_ns(soap, np->id, np->ns, 1); - } - else - { 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) -{ DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element begin tag='%s' id='%d' type='%s'\n", tag, id, type?type:"")); -#ifdef WITH_DOM - 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 = SOAP_EOM; - 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, soap->prolog ? soap->prolog : "\n")) - 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 - 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; /* start with 0 or 2, but should be one to continue */ -#ifndef WITH_LEAN - if (soap->mode & SOAP_XML_CANONICAL) - { const char *s = strchr(tag, ':'); - if (s) - soap_utilize_ns(soap, tag, s - tag); - } -#endif - if (id > 0) - { sprintf(soap->tmpbuf, "_%d", id); - if (soap_attribute(soap, "id", soap->tmpbuf)) - return soap->error; - } - if (type && *type) - { if (soap_attribute(soap, "xsi:type", 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 - } - if (soap->null && soap->position > 0) - { 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; - 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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } -#ifndef WITH_LEAN - if (type && *type && (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; -#ifdef WITH_DOM - register struct soap_dom_attribute **att; - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { 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 = SOAP_EOM; - (*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; - tp->visible = 0; - } - } - return SOAP_OK; - } -#endif -#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); - soap_set_attr(soap, soap->tmpbuf, np->ns); - np->index = 2; - } - } - } -#endif - for (tp = soap->attributes; tp; tp = tp->next) - { if (tp->visible) - { 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; - } - else -#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 - 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; - if (soap->version == 2) - n = 1; - sprintf(soap->href, "#_%d", href); - return soap_element_href(soap, tag, id, "href" + n, 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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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 || (a && !a->__ptr)) - { 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_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_attribute(struct soap *soap, const char *name, const char *value) -{ -#ifdef WITH_DOM - if ((soap->mode & SOAP_XML_DOM) && soap->dom) - { register struct soap_dom_attribute *a = (struct soap_dom_attribute*)soap_malloc(soap, sizeof(struct soap_dom_attribute)); - 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 - 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) -{ 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 (soap->body) - soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) - return soap->error = SOAP_NULL; - } - } - 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 const char *t; - register int n = 0; - if (tag && *tag == '-') - return SOAP_OK; - soap->level--; - soap_pop_namespace(soap); -#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->error == SOAP_NO_TAG) - soap->error = SOAP_OK; - 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; - while (soap_notblank(c = soap_get(soap))) - *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:"")); - if (!tag || !*tag) - return SOAP_OK; - if ((s = strchr(soap->tag, ':'))) - s++; - else - s = soap->tag; - if ((t = strchr(tag, ':'))) - t++; - else - t = tag; - if (!SOAP_STRCMP(s, t)) - return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#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; - for (tp = soap->attributes; tp; tp = tp->next) - if (!soap_match_tag(soap, tp->name, name)) - break; - if (tp && tp->visible == 2) - { 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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, ':'); - 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 (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 of %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; - 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; - 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; - 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)) - { if (--i > 0) - *s++ = (char)c; - c = soap_get1(soap); - } - while (soap_blank(c)) - c = soap_get1(soap); - *s = '\0'; - 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; -#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 = SOAP_EOM; - 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 - 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)) - { 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 = SOAP_EOM; - (*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] == ':') - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (soap->tmpbuf[5]) - t = NULL; - else - t = SOAP_STR_EOS; - } - else - t = NULL; - for (tp = soap->attributes; 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; - 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)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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, 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; - tp->visible = 0; - } - } -#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) - { if (!strcmp(tp->name, "id")) - { *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")) - { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else if ((soap->version == 2 || (soap->mode & SOAP_XML_GRAPH)) && !strcmp(tp->name, "ref")) - { *soap->href = '#'; - strncpy(soap->href + 1, tp->value, sizeof(soap->href) - 2); - soap->href[sizeof(soap->href)-1] = '\0'; - } - else 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->version == 1 && !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->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:itemType")) - strncpy(soap->arrayType, tp->value, sizeof(soap->arrayType) - 1); - else if (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENC:arraySize")) - strncpy(soap->arraySize, tp->value, sizeof(soap->arraySize) - 1); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:offset")) - strncpy(soap->arrayOffset, tp->value, sizeof(soap->arrayOffset)); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:position")) - soap->position = soap_getposition(tp->value, soap->positions); - else if (soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENC:root")) - soap->root = ((!strcmp(tp->value, "1") || !strcmp(tp->value, "true"))); - else if ((soap->version == 1 && !soap_match_tag(soap, tp->name, "SOAP-ENV:actor")) - || (soap->version == 2 && !soap_match_tag(soap, tp->name, "SOAP-ENV:role"))) - { if ((!soap->actor || strcmp(soap->actor, tp->value)) - && strcmp(tp->value, "http://schemas.xmlsoap.org/soap/actor/next") - && strcmp(tp->value, "http://www.w3.org/2003/05/soap-envelope/role/next")) - soap->other = 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, "xsi:null") - || !soap_match_tag(soap, tp->name, "xsi:nil")) - && (!strcmp(tp->value, "1") - || !strcmp(tp->value, "true"))) - soap->null = 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 = 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 9: - if (flag) - { if (soap_send_raw(soap, s, t - s - 1) || soap_send_raw(soap, " ", 5)) - return soap->error; - s = t; - } - break; - case 10: - 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 13: - 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 - if (c & mask) - { if (soap_send_raw(soap, s, t - s - 1) || soap_pututf8(soap, (unsigned char)c)) - return soap->error; - s = t; - } - } - } - 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; - register int 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->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; -#ifndef WITH_LEAN - t = soap->tmpbuf; - t[0] = '<'; - strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 1); - strncat(t, ">", sizeof(soap->tmpbuf)); - m = strlen(soap->tag) + 2; -#endif - } - } -#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)) - 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, 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 && !(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)) - 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, 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: - 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 '<' | 0x80000000: - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - m = 3; - } - break; - case '>' | 0x80000000: - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - m = 3; - } - break; - case '&' | 0x80000000: - if (flag) - *s++ = '&'; - else - { *s++ = '&'; - t = (char*)"amp;"; - m = 4; - } - break; - case '"' | 0x80000000: - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - m = 5; - } - break; - case '\'' | 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, 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 9: - if (flag) - t = " "; - else - t = "\t"; - break; - case 10: - if (flag || !(soap->mode & SOAP_XML_CANONICAL)) - t = " "; - else - t = "\n"; - break; - case 13: - 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 > 0 && 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; - register long l = 0; - register soap_wchar c; - const char *t = NULL; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); - if (soap->peeked) - { if (!soap->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; - } - } - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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, 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)) - 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, 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)) - 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, 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)) - 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, 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)) - 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, 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)) - 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, 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) -{ const char *s; - if (soap_isnan((double)n)) - s = "NaN"; - else if (soap_ispinff(n)) - s = "INF"; - else if (soap_isninff(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->float_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 appears to be broken or doesn't link: use with caution */ -#if defined(HAVE_STRTOF) - char *r; - *p = strtof((char*)s, &r); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#ifdef 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)) - 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, 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) -{ const char *s; - if (soap_isnan(n)) - s = "NaN"; - else if (soap_ispinfd(n)) - s = "INF"; - else if (soap_isninfd(n)) - s = "-INF"; - else - { sprintf(soap->tmpbuf, soap->double_format, n); - s = soap->tmpbuf; - } - return s; -} -#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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#ifdef 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)) - 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, 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)) - 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, 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)) - 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, 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)) - 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, 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)) - 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, 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)) - 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, 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) -{ *t = NULL; - if (s && !(*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 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) - { struct soap_nlist *np; - const char *p; - if (!strncmp(s, "xml:", 4)) - { *t = soap_strdup(soap, s); - return SOAP_OK; - } - np = soap->nlist; - p = strchr(s, ':'); - if (p) - { register int n = p - s; - while (np && (strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { register const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - { -#ifndef WITH_LEAN - if (s && (soap->mode & SOAP_XML_CANONICAL)) - { t = (char*)strchr(s, ':'); - if (t) - soap_utilize_ns(soap, s, t - s); - } -#endif - return s; - } - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%d", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2wchar(struct soap *soap, const char *s, wchar_t **t) -{ wchar_t *r; - if (!s) - *t = NULL; - else - { *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 = *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 - || 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)) - { 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->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; - } - else if (soap->null) - *p = NULL; - else - *p = (char*)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 - || 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)) - { 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; - } - else if (soap->null) - *p = NULL; - else - *p = (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 -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#else - time_t t, g, z; -#ifdef HAVE_GMTIME_R - struct tm tm, *tmp = &tm; -#else - struct tm *tmp; -#endif - t = mktime(T); - if (t == -1) - return -1; -#ifdef HAVE_GMTIME_R - gmtime_r(&t, tmp); -#else - tmp = gmtime(&t); -#endif - tmp->tm_isdst = 0; - g = mktime(tmp); - if (g == -1) - return -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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&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)) - { ftime(&t); - 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); - } - /* The following defines were added for VxWorks*/ -# elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, abs(t.timezone)%60); - } -# else - if ((pT = localtime(&n))) - { ftime(&t); - 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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_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) - { struct tm T; - char zone[16]; - const char *t; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - if (strchr(s, '-')) - t = "%d-%d-%dT%d:%d:%d%15s"; - else if (strchr(s, ':')) - t = "%4d%2d%2dT%d:%d:%d%15s"; - else /* parse non-XSD-standard alternative ISO 8601 format */ - t = "%4d%2d%2dT%2d%2d%2d%15s"; - sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s == '+' || *s == '-') - { int h = 0, m = 0; - if (s[3] == ':') - { sscanf(s, "%d:%d", &h, &m); - if (h < 0) - m = -m; - } - else - { m = (int)atol(s); - h = m / 100; - m = m % 100; - } - T.tm_hour -= h; - T.tm_min -= m; - } - T.tm_isdst = 0; - *p = soap_timegm(&T); - } - else - { T.tm_isdst = -1; - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - } - 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)) - 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, 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) -{ 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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p && *p) - { if (soap_send(soap, *p)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - { 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) - *p = soap_string_in(soap, 0, -1, -1); - else if (soap->null) - *p = NULL; - else - *p = (char*)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) -{ int i; - const char *t = NULL; - wchar_t c; - const wchar_t *s; - 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++; - sprintf(soap->tmpbuf, "<%s xmlns=\"%s\">", t, soap->local_namespaces[i].ns ? soap->local_namespaces[i].ns : SOAP_STR_EOS); - } - else - { t = tag; - sprintf(soap->tmpbuf, "<%s>", tag); - } - if (soap_send(soap, soap->tmpbuf)) - return soap->error; - } - if (p) - { s = *p; - while ((c = *s++)) - if (soap_pututf8(soap, (unsigned char)c)) - return soap->error; - } - if (t) - { sprintf(soap->tmpbuf, "", t); - return soap_send(soap, soap->tmpbuf); - } - 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)) - { 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); - else if (soap->null) - *p = NULL; - else - *p = (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_token(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 || soap_blank(c)) - break; - *s++ = (char)c; - c = soap_get(soap); - } - if ((int)c == EOF || c == SOAP_TT) - soap_unget(soap, c); - *s = '\0'; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Element content value='%s'\n", soap->tmpbuf)); - return soap->tmpbuf; /* return non-null pointer */ -} -#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, now get \n */ - if (c == '\n') - { *s = '\0'; - if (i+1 == len) /* empty line: end of HTTP/MIME header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - else if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - 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_str_code(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->location); - /* 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] = optype >> 8; - s[1] = optype & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime.type) - typelen = strlen(soap->dime.type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); - tmp[1] = soap->dime.flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime.size >> 24; - tmp[9] = (soap->dime.size >> 16) & 0xFF; - tmp[10] = (soap->dime.size >> 8) & 0xFF; - tmp[11] = 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 (!content->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)soap->dime.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 int i; - register char *s; - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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, soap->dime.size)) - return soap->error = SOAP_EOF; - } - if (soap_move(soap, ((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; - register soap_wchar c; - register char *s; - register int i; - id = soap->dime.id; - type = soap->dime.type; - options = soap->dime.options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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, 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; - soap_resolve_attachment(soap, content); - if (soap->error) - return soap->error; - } - 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_int_code(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) -{ register soap_wchar c = 0; - if (!soap->mime.last) - return SOAP_OK; - for (;;) - { register size_t i, m = 0; - register char *s, *t = NULL; - struct soap_multipart *content = soap->mime.last; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Parsing MIME content id=%s type=%s\n", content->id?content->id:"", content->type?content->type:"")); - if (soap_new_block(soap)) - return soap->error = SOAP_EOM; - for (;;) - { register short flag = 0; - if (!(s = (char*)soap_push_block(soap, SOAP_BLKLEN))) - return soap->error = SOAP_EOM; - for (i = 0; i < SOAP_BLKLEN; i++) - { if (m > 0) - { *s++ = *t++; - m--; - } - else - { if (!flag) - { c = soap_get1(soap); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - if (flag || c == '\r') - { t = soap->tmpbuf; - memset(t, 0, sizeof(soap->tmpbuf)); - strcpy(t, "\n--"); - if (soap->mime.boundary) - strncat(t, soap->mime.boundary, sizeof(soap->tmpbuf)-4); - do c = soap_getchar(soap); - while (c == *t++); - if ((int)c == EOF) - return soap->error = SOAP_EOF; - if (!*--t) - goto end; - *t = (char)c; - flag = (c == '\r'); - m = t - soap->tmpbuf + 1 - flag; - t = soap->tmpbuf; - c = '\r'; - } - *s++ = (char)c; - } - } - } -end: - *s = '\0'; /* force 0-terminated */ - content->size = soap_size_block(soap, i+1)-1; - content->ptr = soap_save_block(soap, NULL, 0); - soap_resolve_attachment(soap, content); - if (c == '-' && soap_getchar(soap) == '-') - break; - while (c != '\r' && (int)c != EOF && soap_blank(c)) - c = soap_getchar(soap); - if (c != '\r' || soap_getchar(soap) != '\n') - return soap->error = SOAP_MIME_ERROR; - if (soap_getmimehdr(soap)) - return soap->error; - } - return SOAP_OK; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_LEANER -#ifndef PALM_1 -static int -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:"")); - 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_str_code(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) - 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 = 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 - -/******************************************************************************/ - -#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++; - n = strlen(path); - for (p = soap->cookies; p; p = p->next) - if (!strcmp(p->name, name) - && domain - && p->domain - && !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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"", domain?domain:"", path?path:"")); - if (!domain) - domain = soap->cookie_domain; - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - return NULL; - } - if (*path == '/') - path++; - q = soap_cookie(soap, name, domain, path); - 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 = -1; - q->version = 0; - 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 && 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 && *domain && (q->domain = (char*)SOAP_MALLOC(soap, strlen(domain)+1))) - strcpy(q->domain, domain); - if (path && *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) - { soap_set_receiver_error(soap, "Cookie domain not set", NULL, SOAP_HTTP_ERROR); - return; - } - if (!path) - path = soap->cookie_path; - if (!path) - { soap_set_receiver_error(soap, "Cookie path not set", NULL, SOAP_HTTP_ERROR); - 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 -long -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; - if ((p = soap_cookie(soap, name, domain, path))) - { p->expire = 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 || !p->env) - { 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) - sprintf(s, ";Domain=\"%s\"", p->domain); - else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) - sprintf(s, ";Domain=\"%s\"", soap->cookie_domain); - strcat(s, ";Path=\"/"); - if (p->path) - t = p->path; - else - t = soap->cookie_path; - if (t) - { if (*t == '/') - t++; - if ((int)strlen(t) < tmp-s+4064) - strcat(s, t); - } - s += strlen(s); - *s++ = '"'; - if (p->version > 0) - sprintf(s, ";Version=%u", p->version); - if (p->expire >= 0) - sprintf(s, ";Max-Age=%ld", p->expire); - if (p->secure) - strcat(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 - { size_t domlen = 0; - if (q->domain) - { const char *s = strchr(q->domain, ':'); - if (s) - domlen = s - q->domain; - else - domlen = strlen(q->domain); - } - if ((!q->domain || !strncmp(q->domain, domain, domlen)) - && (!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 && (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 = (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:"", p->domain?p->domain:"", p->path?p->path:"", 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; - p->domain = domain; - p->path = 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:"", p->domain?p->domain:"", p->path?p->path:"", 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 *soap) -{ struct soap_cookie *p, **q, *r; - q = &r; - for (p = soap->cookies; p; p = p->next) - { if (!(*q = (struct soap_cookie*)SOAP_MALLOC(soap, sizeof(struct soap_cookie)))) - return r; - **q = *p; - if (p->name) - { if (((*q)->name = (char*)SOAP_MALLOC(soap, strlen(p->name)+1))) - strcpy((*q)->name, p->name); - } - if (p->value) - { if (((*q)->value = (char*)SOAP_MALLOC(soap, strlen(p->value)+1))) - strcpy((*q)->value, p->value); - } - if (p->domain) - { if (((*q)->domain = (char*)SOAP_MALLOC(soap, strlen(p->domain)+1))) - strcpy((*q)->domain, p->domain); - } - if (p->path) - { if (((*q)->path = (char*)SOAP_MALLOC(soap, 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, 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)f != 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; - soap->error = SOAP_OK; - soap_free(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->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; -#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; - soap->xlist = NULL; -#endif -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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 -#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")); - 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 &= ~SOAP_IO; - soap->error = soap->fparse(soap); - if (soap->error && soap->error < SOAP_STOP) - { soap->keep_alive = 0; /* force close later */ - return soap->error; - } - 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 -#ifdef WITH_ZLIB - if (soap->zlib_in != SOAP_ZLIB_NONE) - { /* fparse should not use soap_unget to push back last char */ -#ifdef WITH_GZIP - 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->zlib_state = SOAP_ZLIB_INFLATE; - soap->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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_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 get = 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; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return soap->error; - 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) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - 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\n")); - 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 (s && (((get = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!get); - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!get), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (get) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - if (status) - return soap->error = status; - return SOAP_OK; - } - if (k == 0 || (k >= 200 && k <= 299) || k == 400 || k == 500) - return SOAP_OK; - 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")) - { if (soap_get_header_attribute(soap, val, "application/dime")) - soap->mode |= 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->mode |= SOAP_ENC_MIME; - } - } -#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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 if (!soap_tag_cmp(key, "Location")) - { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); - soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; - } -#ifdef WITH_COOKIES - else if (!soap_tag_cmp(key, "Cookie") || !soap_tag_cmp(key, "Set-Cookie")) - 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 (soap_notblank(*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) - { const char *s; - if ((soap->mode & SOAP_ENC_DIME) && !(soap->mode & SOAP_ENC_MTOM)) - s = "application/dime"; - else if (soap->version == 2) - s = "application/soap+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)) + ((strlen(soap->dime.type)+3)&(~3)); - } - 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 -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)) - return soap->error = SOAP_VERSIONMISMATCH; - 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)) - 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; - 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; - if (!strncmp(endpoint, "https:", 6)) - soap->port = 443; - strncpy(soap->endpoint, endpoint, sizeof(soap->endpoint) - 1); - 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++) - { soap->host[i] = s[i]; - if (s[i] == ']') - { s++; - break; - } - } - } - 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 (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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - soap->error = SOAP_OK; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - 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) - { soap->status = http_command; - 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)); -#ifdef WITH_UDP - 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; -#ifndef WITH_NOHTTP - 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; - } - else if (action) - soap->action = soap_strdup(soap, action); - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { m = (m << 6) + soap_base64i[c]; - j++; - } - } - *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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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 = 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) -{ register const char *s = NULL; - 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) - { if (soap->version == 2) - s = "application/soap+xml; charset=utf-8"; - else - s = "text/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 && soap->status != SOAP_GET) - { 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); - 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", "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 (soap->status != SOAP_GET) - { 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_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 || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6)) && strncmp(endpoint, "_beam:", 6) && strncmp(endpoint, "_local:", 7) && strncmp(endpoint, "_btobex:", 8)) -#else - if (!endpoint || (strncmp(endpoint, "http:", 5) && strncmp(endpoint, "https:", 6) && strncmp(endpoint, "httpg:", 6))) -#endif - return SOAP_OK; - if (soap->proxy_host && strncmp(endpoint, "https:", 6)) - 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; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) - || (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, 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, 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 (action && soap->version == 1) - { sprintf(soap->tmpbuf, "\"%s\"", action); - 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 (!status || status == SOAP_HTML || status == SOAP_FILE) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "OK 200\n")); -#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 200 OK", soap->http_version); - if ((err = soap->fposthdr(soap, soap->tmpbuf, NULL))) - return err; - } - else if ((err = soap->fposthdr(soap, "Status", "200 OK"))) - 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 ? 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 && !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))) - return err; - } - if ((err = soap->fposthdr(soap, "Server", "gSOAP/2.7")) - || (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_IO; - soap->omode |= 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 (!*c && !*s && 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 = "SOAP version mismatch or invalid SOAP message"; - break; - case SOAP_DATAENCODINGUNKNOWN: - *c = "SOAP-ENV:DataEncodingUnknown"; - *s = "Unsupported SOAP data encoding"; - break; - case SOAP_NAMESPACE: - *s = soap_set_validation_fault(soap, "namespace mismatch", 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_GET_METHOD: - *s = "HTTP GET method not implemented"; - break; - case SOAP_EOM: - *s = "Out of memory"; - 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 ref ", 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 = "HTTP error"; - 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:""); - *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, "min/maxOccurs violation", NULL); - break; - case SOAP_LENGTH: - *s = soap_set_validation_fault(soap, "content length violation", NULL); - break; - case SOAP_STOP: - *s = "Stopped: no response sent"; - break; -#endif - case SOAP_EOF: -#ifndef WITH_NOIO - sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); - *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; - int r = 1; - 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); -#ifndef WITH_NOIO -#ifndef WITH_LEAN - 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)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, NULL, &timeout); - if (r > 0) - { if (!FD_ISSET((SOAP_SOCKET)soap->socket, &sfd) - || (FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - && recv((SOAP_SOCKET)soap->socket, soap->tmpbuf, 1, MSG_PEEK) < 0)) - r = 0; - } - } -#endif -#endif - if ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && 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) -{ soap->count = 0; - if (soap_response(soap, SOAP_OK) || soap_end_send(soap)) - return soap_closesock(soap); - 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)) - return soap_closesock(soap); - return SOAP_OK; -} -#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 - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, (LPTSTR)&soap->errorstr, sizeof(soap->errorstr), NULL); - return soap->errorstr; -#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 *faultsubcode, const char *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - if (faultsubcode) - *soap_faultsubcode(soap) = faultsubcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - 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 *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ char *r = NULL, *s = NULL, *t = NULL; - if (faultsubcode) - r = soap_strdup(soap, faultsubcode); - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - 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 *faultdetail) -{ return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcode, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcode, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -#ifndef WITH_NOSTDLIB -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_print_fault(struct soap *soap, FILE *fd) -{ 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 - -/******************************************************************************/ -#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->buflen > 0) - { 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** HERE **\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 - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.h deleted file mode 100644 index 6047fb6..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.6d.h +++ /dev/null @@ -1,2075 +0,0 @@ -/* - -stdsoap2.h 2.7.6d - -gSOAP runtime - -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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - 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-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 --------------------------------------------------------------------------------- -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 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(__alpha) && !defined(__VMS) -# ifndef TRU64 -# define TRU64 -# endif -#endif - -#ifdef __MVS__ -# ifndef OS390 -# define OS390 -# endif -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -# ifdef WITH_OPENSSL -# ifndef HAVE_OPENSSL_SSL_H -# undef WITH_OPENSSL -# 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_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(_AIXVERSION_431) -# 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(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_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_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_STRTOLL -# define HAVE_STRTOULL -# 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_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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# 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 -# 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 - -/* QNX does not have a working version of strtof */ -#if defined(__QNX__) || defined(QNX) -# undef HAVE_STRTOF -#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 - -#ifndef WITH_NOSTDLIB -# include -# ifndef PALM -# include -# include -# endif -# include -# include -#endif - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# include -# include -#endif - -#ifdef WITH_NOHTTP -# ifndef WITH_NOIO -# define WITH_NOIO -# undef WITH_COOKIES -# endif -#endif - -#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 -# endif -# ifndef VXWORKS -# 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 WITH_FASTCGI -# include -#endif - -#ifdef WITH_OPENSSL -# define OPENSSL_NO_KRB5 -# 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 - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -# ifndef WITH_NOIO -# ifndef PALM -# include -# include -# include -# include -# endif -# endif -#endif - -/* Portability: define SOAP_SOCKLEN_T */ -#if defined(_AIX) -# define SOAP_SOCKLEN_T socklen_t -#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) -# 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 -# else -# define SOAP_SOCKET int -# define closesocket(n) close(n) -# endif -#endif - -#define SOAP_INVALID_SOCKET (-1) -#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) - -#if defined(SYMBIAN) -# define LONG64 long -# define ULONG64 unsigned LONG64 -#elif !defined(WIN32) || defined(__GLIBC__) || defined(__GNU__) -# ifndef LONG64 -# define LONG64 long long -# define ULONG64 unsigned LONG64 -# endif -#elif defined(UNDER_CE) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#elif defined(__BORLANDC__) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#endif - -#if defined(WIN32) -# define soap_int32 __int32 -#elif defined(SYMBIAN) -# define soap_int32 long -#elif defined(PALM) -# define soap_int32 Int32 -#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 -#else -# define SOAP_ERANGE ERANGE -# define SOAP_EINTR EINTR -# define SOAP_EAGAIN EAGAIN -# 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 GetLastError() -# define soap_reset_errno SetLastError(0) -# else -# define soap_errno GetLastError() -# define soap_socket_errno WSAGetLastError() -# define soap_reset_errno SetLastError(0) -# endif -#else -# ifndef WITH_NOIO -# define soap_errno errno -# define soap_socket_errno errno -# define soap_reset_errno (errno = 0) -# else -# define soap_errno 0 -# define soap_socket_errno 0 -# define soap_reset_errno -# endif -#endif - -#ifndef SOAP_BUFLEN -# ifdef WITH_UDP -# define SOAP_BUFLEN (65536) /* max UDP packet size */ -# else -# ifndef WITH_LEAN -# define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -# endif -#endif -#ifndef SOAP_LABLEN -# define SOAP_LABLEN (64) /* 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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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 soap_isnan(n) isnan(n) -#endif - -#if !defined(HAVE_ISNAN) && (defined(_MATH_H) || defined(_MATH_INCLUDED)) -# define HAVE_ISNAN -#endif - -#ifndef soap_isnan -# ifdef HAVE_ISNAN -# define soap_isnan(n) isnan(n) -# else -# define soap_isnan(_) (0) -# endif -#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 -# ifdef HAVE_ISNAN -# define FLT_NAN (*(float*)(void*)&soap_double_nan) -# else -# define FLT_NAN (0.0) -# endif -#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 -# ifdef HAVE_ISNAN -# define DBL_NAN (*(double*)(void*)&soap_double_nan) -# else -# define DBL_NAN (0.0) -# endif -#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 - -#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_GET_METHOD 14 -#define SOAP_EOM 15 -#define SOAP_NULL 16 -#define SOAP_DUPLICATE_ID 17 -#define SOAP_MISSING_ID 18 -#define SOAP_HREF 19 -#define SOAP_UDP_ERROR 20 -#define SOAP_TCP_ERROR 21 -#define SOAP_HTTP_ERROR 22 -#define SOAP_SSL_ERROR 23 -#define SOAP_ZLIB_ERROR 24 -#define SOAP_DIME_ERROR 25 -#define SOAP_DIME_HREF 26 -#define SOAP_DIME_MISMATCH 27 -#define SOAP_DIME_END 28 -#define SOAP_MIME_ERROR 29 -#define SOAP_MIME_HREF 30 -#define SOAP_MIME_END 31 -#define SOAP_VERSIONMISMATCH 32 -#define SOAP_PLUGIN_ERROR 33 -#define SOAP_DATAENCODINGUNKNOWN 34 -#define SOAP_REQUIRED 35 -#define SOAP_PROHIBITED 36 -#define SOAP_OCCURS 37 -#define SOAP_LENGTH 38 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (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) >= 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 -#define SOAP_IO_LENGTH 0x00000008 -#define SOAP_IO_KEEPALIVE 0x00000010 - -#define SOAP_ENC_LATIN 0x00800020 /* 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 /* strict validation */ -#define SOAP_XML_INDENT 0x00002000 -#define SOAP_XML_CANONICAL 0x00004000 /* EXC C14N canonical XML */ -#define SOAP_XML_TREE 0x00008000 -#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 -#define SOAP_C_UTFSTRING 0x00200000 -#define SOAP_C_MBSTRING 0x00400000 - -#define SOAP_DOM_TREE 0x01000000 -#define SOAP_DOM_NODE 0x02000000 -#define SOAP_DOM_ASIS 0x04000000 - -#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_DEFAULT SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION - -/* */ - -#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 -# endif -#endif - -#ifdef SOAP_DEBUG -# define SOAP_MALLOC(soap, size) soap_track_malloc(soap, __FILE__, __LINE__, size) -# define SOAP_FREE(soap, ptr) soap_track_free(soap, __FILE__, __LINE__, ptr) -#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(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(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 DGBFUN -# 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.2hhX ", *s++);\ - 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_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; - void (*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 */ -}; - -struct soap_cookie -{ struct soap_cookie *next; - char *name; - char *value; - char *domain; - char *path; - long expire; /* client-side: local time to expire; 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 */ -}; - -#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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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) -} -extern std::ostream &operator<<(std::ostream&, const struct soap_dom_element&); -extern std::istream &operator>>(std::istream&, struct soap_dom_element&); -extern "C" { -#endif - -/******************************************************************************/ - -struct soap -{ short version; /* 1 = SOAP1.1 and 2 = SOAP1.2 (set automatically from namespace URI in nsmap table) */ - short copy; /* 1 = copy of another soap struct */ - 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 */ - 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 (*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 (*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); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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*); -#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); -#endif - int master; - int socket; -#if defined(__cplusplus) && !defined(WITH_LEAN) - std::ostream *os; - std::istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#endif -#ifndef UNDER_CE - int sendfd; - int recvfd; -#else - FILE *sendfd; - FILE *recvfd; -#endif -#ifdef WIN32 - char errorstr[256]; /* buf for FormatMessage() */ -#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 */ -#ifdef WITH_FAST - char *labbuf; /* look-aside buffer */ - size_t lablen; /* look-aside buffer allocated length */ - size_t labidx; /* look-aside buffer index to available part */ -#endif - char buf[SOAP_BUFLEN];/* send and receive buffer */ - char tmpbuf[1024]; /* in/output buffer for HTTP headers, simpleType values, attribute names, and DIME >=1024 bytes */ - char msgbuf[1024]; /* output buffer for (error) messages <=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 keep_alive; /* connection should be kept open */ - 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 */ - unsigned int max_keep_alive; - 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 */ - 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 -#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 - size_t peerlen; -#endif -#ifdef WITH_OPENSSL - int (*fsslauth)(struct soap*); - int (*fsslverify)(int, X509_STORE_CTX*); - BIO *bio; - SSL *ssl; - SSL_CTX *ctx; - short require_server_auth; - short require_client_auth; - short rsa; /* when set, use RSA instead of DH */ - const char *keyfile; - const char *password; - const char *dhfile; - const char *cafile; - const char *capath; - const char *crlfile; - const char *randfile; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - uLong z_crc; /* internal gzip crc */ - 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 */ -#endif -#ifdef WMW_RPM_IO - void *rpmreqid; -#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; - void (*fcopy)(struct soap*, int, int, void*, 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(); -#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, 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_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 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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int SOAP_FMAC2 soap_accept(struct soap*); -SOAP_FMAC1 int SOAP_FMAC2 soap_ssl_accept(struct soap*); - -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 *str); -SOAP_FMAC1 long SOAP_FMAC2 soap_int_code(const struct soap_code_map*, const char *str, long other); -SOAP_FMAC1 const char* SOAP_FMAC2 soap_str_code(const struct soap_code_map*, long code); - -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, void (*fdelete)(struct soap_clist*)); -SOAP_FMAC1 void SOAP_FMAC2 soap_unlink(struct soap*, const void*); -SOAP_FMAC1 void SOAP_FMAC2 soap_free(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, int st, int tt, size_t n, unsigned int k, void(*fcopy)(struct soap*, int, int, void*, 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, 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_del(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(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_token(struct soap*); -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 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); - -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 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*, int n1, int n2); - -SOAP_FMAC1 int SOAP_FMAC2 soap_set_namespaces(struct soap*, 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 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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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*); -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*); -#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); -#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); - -#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); -#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 struct soap_multipart* SOAP_FMAC2 soap_next_multipart(struct soap_multipart*); -#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 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 long 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*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.c deleted file mode 100644 index 959147e..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.c +++ /dev/null @@ -1,14172 +0,0 @@ -/* - -stdsoap2.c[pp] 2.7.9b - -gSOAP runtime - -gSOAP XML Web services tools -Copyright (C) 2000-2007, 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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems Inc., for the following additions under gSOAP public license: - - vxWorks compatible (#define VXWORKS) --------------------------------------------------------------------------------- -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-2007, 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 --------------------------------------------------------------------------------- -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 WIN32 -# pragma comment(lib, "wsock32.lib") -#endif - -#ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.9b 2007-01-01 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.9 2007-01-01 12: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) - -#define soap_hash_ptr(p) ((size_t)(((unsigned long)(p) >> 3) & (SOAP_PTRHASH-1))) - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -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 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*); -#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 time_t soap_timegm(struct tm*); -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 -static int ssl_init_done = 0; -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -/* This callback is included for future references. It should not be deleted -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_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_LEAN -static size_t frecv_stop(struct soap*, char*, size_t); -#endif -#ifndef WITH_IPV6 -static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr); -#endif -static int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); -static int tcp_accept(struct soap*, int, 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 -#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 - -/******************************************************************************/ -#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) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(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) - { soap->errnum = err; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else if (soap->bio) - nwritten = BIO_write(soap->bio, s, n); - else -#endif -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - { if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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)soap->socket, &fd); - select((SOAP_SOCKET)(soap->socket + 1), NULL, NULL, &fd, &timeout); - if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { -#ifdef WITH_OPENSSL - int err; - if (soap->ssl && (err = SSL_get_error(soap->ssl, nwritten)) != SSL_ERROR_NONE && err != SSL_ERROR_WANT_READ && err != SSL_ERROR_WANT_WRITE) - return SOAP_EOF; -#endif - err = soap_socket_errno(soap->socket); - if (err && err != SOAP_EINTR && err != SOAP_EWOULDBLOCK && err != SOAP_EAGAIN) - { 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 - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -#endif -#endif -#endif - if (nwritten <= 0) - { err = soap_errno; - 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 int 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:"")); - 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, 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; -#ifdef PALM - register int timeouts = 0; -#endif - soap->errnum = 0; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifndef WITH_LEAN - if (soap->recv_timeout) - { 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; - } -#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)soap->socket, &fd); - for (;;) - { r = select((SOAP_SOCKET)(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) - { soap->errnum = r; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { int err; - r = SSL_read(soap->ssl, s, 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, n); - if (r > 0) - return (size_t)r; - return 0; - } - else -#endif - { -#ifdef WITH_UDP - 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)soap->socket, s, 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)soap->socket, s, 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; - timeout.tv_sec = 0; - timeout.tv_usec = 10000; -#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)soap->socket, &fd); -#ifdef WITH_OPENSSL - if (soap->ssl && SSL_get_error(soap->ssl, r) == SSL_ERROR_WANT_WRITE) - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#endif - if (r < 0 && (r = soap_socket_errno(soap->socket)) != SOAP_EINTR) - { soap->errnum = r; - return 0; - } - } -#endif -#ifdef PALM - if (r < 0 && (r = soap_socket_errno(soap->socket)) == SOAP_EINTR) - { timeouts++; - if (timeouts > 10) - { 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 - r = read((SOAP_SOCKET)soap->recvfd, s, n); - if (r >= 0) - return (size_t)r; - soap->errnum = soap_errno; - return 0; -#endif -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -#ifndef WITH_NOIO -#ifndef PALM_1 -static size_t -frecv_stop(struct soap *soap, char *s, size_t n) -{ return 0; -} -#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); - 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->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 */ - { -chunk_again: - 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; - } - else - { register soap_wchar c; - char *t, tmp[8]; - 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'; - 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); - return soap->ahead = EOF; - } - 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) - goto chunk_again; - } - } - 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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - 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->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 >= 0x20) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (c >= 0x80 && (soap->mode & SOAP_XML_CANONICAL)) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - 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 int 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, 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 int 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; - 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - 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); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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 = (struct soap_xlist*)SOAP_MALLOC(soap, sizeof(struct soap_xlist)); - *ptr = NULL; - *size = 0; - *id = soap_strdup(soap, soap->href); - *type = NULL; - *options = NULL; - 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 -int -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)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->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; - register struct soap_flist *fp; -#ifndef WITH_LEANER - register struct soap_xlist *xp; -#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:"", 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; - register struct soap_flist *fp; - 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; - register struct soap_flist *fp; - 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, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(soap, p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(soap, p); - } - soap->blist = bp->next; - SOAP_FREE(soap, bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); -#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); - 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 = 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; - 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; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int 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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - return SOAP_OK; - return 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; - 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; - 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; - if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - } - else if (SOAP_STRCMP(tag1, t + 1)) - return SOAP_TAG_MISMATCH; - else if (t != tag2 && 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)); - return SOAP_TAG_MISMATCH; - } - 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 (!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, 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; - 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 (!ssl_init_done) - { 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 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 (!ssl_init_done) - soap_ssl_init(); - 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); - } - 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 (!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 cafile first before the key file: - 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 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ BIO *bio; - int i, r; - 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_INVALID_SOCKET; - 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; -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)&nonblocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); - i = 100; /* 100 * 0.1 ms retries */ - while ((r = SSL_accept(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err == SSL_ERROR_WANT_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - if (i-- <= 0) - break; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - if (r < 0 && (r = soap_socket_errno(soap->socket)) != SOAP_EINTR) - { soap->errnum = r; - return SOAP_EOF; - } - } - else - { soap->errnum = err; - break; - } - } -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)&blocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#endif - 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 /* 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->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->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_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = 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_free_mht(soap); - soap->state = 0; -#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(_AIXVERSION_431) || defined(TRU64) - 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__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - 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 int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ -#ifdef WITH_IPV6 - struct addrinfo hints, *res, *ressave; -#endif - register int err, fd; -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->socket)) - soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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, gai_strerror(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - ressave = res; -again: - fd = (int)socket(res->ai_family, res->ai_socktype, res->ai_protocol); - soap->errmode = 0; -#else -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - fd = (int)socket(AF_INET, SOCK_DGRAM, 0); - else -#endif - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -#endif - if (fd < 0) - { soap->errnum = soap_socket_errno(fd); - soap_set_sender_error(soap, tcp_error(soap), "socket failed in tcp_connect()", SOAP_TCP_ERROR); - 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 = 0; - if (setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - else if (soap->connect_flags && setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (!(soap->omode & SOAP_IO_UDP) && setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } -#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, (SOAP_SOCKET)fd); - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->peer.sin_port = htons((short)port); - } - soap->errmode = 0; - if ((soap->omode & SOAP_IO_UDP)) - return fd; -#endif -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); /* modified to use fd */ - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, res->ai_addr, res->ai_addrlen)) -#else - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) -#endif - { -#ifndef WITH_LEAN - if (soap->connect_timeout && (soap_socket_errno(fd) == SOAP_EINPROGRESS || soap_socket_errno(fd) == SOAP_EWOULDBLOCK)) - { struct timeval timeout; - SOAP_SOCKLEN_T k; - fd_set fds; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - { soap->error = SOAP_FD_EXCEEDED; - return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ - } -#endif - FD_ZERO(&fds); - FD_SET((SOAP_SOCKET)fd, &fds); - for (;;) - { register int r = select((SOAP_SOCKET)(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, (SOAP_SOCKET)fd); - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - else -#endif -#ifdef WITH_IPV6 - if (res->ai_next) - { res = res->ai_next; - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - goto again; - } - else -#endif - err = soap_socket_errno(fd); - 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, (SOAP_SOCKET)fd); - 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->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#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) - { unsigned int k = soap->omode; /* make sure we only parse HTTP */ - size_t n = soap->count; /* save the content length */ - char *userid, *passwd; - char endp[sizeof(soap->endpoint)]; - 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, (SOAP_SOCKET)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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return soap->error; - } - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->omode = k; - k = soap->imode; - soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ - strcpy(endp, soap->endpoint); - userid = soap->userid; /* preserve */ - passwd = soap->passwd; /* preserve */ - if ((soap->error = soap->fparse(soap))) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - strcpy(soap->endpoint, endp); /* restore */ - soap->userid = userid; /* restore */ - soap->passwd = passwd; /* restore */ - soap->imode = k; /* restore */ - soap->count = n; /* restore */ - if (soap_begin_send(soap)) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; - } - 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((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - { soap->error = SOAP_FD_EXCEEDED; - return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ - } -#endif - FD_ZERO(&fds); - FD_SET((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(fd + 1), &fds, NULL, &fds, &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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - continue; - } - } - break; - } -#ifndef WITH_LEAN - if (soap->connect_timeout) -#ifdef WIN32 - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - if ((soap->ssl_flags & SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION)) - { int err; - // TODO: add callback to verify server - 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, (SOAP_SOCKET)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, (SOAP_SOCKET)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; - unsigned char *data; - 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, ... - */ - 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 && !soap_tag_cmp((const char*)name, host)) - ok = 1; - else - { unsigned char *tmp = NULL; - ASN1_STRING_to_UTF8(&tmp, name); - if (tmp) - { if (!soap_tag_cmp((const char*)tmp, host)) - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - } -#else - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; -#endif - } - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -SOAP_FMAC1 -int -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; -#endif -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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; - soap->peer = *((struct sockaddr_storage*)addrinfo->ai_addr); - soap->peerlen = addrinfo->ai_addrlen; - res.ai_addr = (struct sockaddr*)&soap->peer; - res.ai_addrlen = soap->peerlen; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - soap->master = socket(res.ai_family, res.ai_socktype, res.ai_protocol); -#else -#ifdef WITH_UDP - 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; - } -#ifdef WITH_UDP - 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_SOCKET)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_SOCKET)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_SOCKET)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_SOCKET)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_SOCKET)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 - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, res.ai_addr, 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_SOCKET)soap->master, (struct sockaddr*)&soap->peer, 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_SOCKET)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; - int r; - timeout.tv_sec = 0; - timeout.tv_usec = 0; -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&rfd); - FD_ZERO(&sfd); - FD_ZERO(&xfd); - if (soap_valid_socket(soap->socket)) - { FD_SET((SOAP_SOCKET)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - FD_SET((SOAP_SOCKET)soap->socket, &xfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, &xfd, &timeout); - if (r > 0 && FD_ISSET((SOAP_SOCKET)soap->socket, &xfd)) - r = -1; - } - else if (soap_valid_socket(soap->master)) - { FD_SET((SOAP_SOCKET)soap->master, &sfd); - r = select((SOAP_SOCKET)(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)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)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)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - || recv((SOAP_SOCKET)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 int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ int fd; - fd = (int)accept((SOAP_SOCKET)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 -int -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; -#ifdef WITH_UDP - 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) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - { soap->error = SOAP_FD_EXCEEDED; - return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ - } -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, NULL, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - 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 defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#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 = 0; - if (setsockopt((SOAP_SOCKET)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)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)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)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)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)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 - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -#elif defined(VXWORKS) - u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&blocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&blocking)); -#elif defined(PALM) - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); -#elif defined(SYMBIAN) - long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#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) - { 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); - 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 != 1) - { s = ERR_get_error(); - if (s) - { if (soap_valid_socket(soap->socket)) - { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 1); - soap->socket = SOAP_INVALID_SOCKET; - } - r = SSL_shutdown(soap->ssl); - } - } - DBGLOG(TEST, if (s) SOAP_MESSAGE(fdebug, "Shutdown failed: %d\n", SSL_get_error(soap->ssl, r))); - 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)soap->socket, 2); - soap->fclosesocket(soap, (SOAP_SOCKET)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) -{ -#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) -{ 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 -#ifdef WITH_UDP - 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) - soap_new_block(soap); - 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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->sendfd, _O_BINARY); -#endif -#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) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#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; - 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_NOIDREF -#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) -{ 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:"", id, atype?atype:"")); - 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; - return -1; -} -#endif -#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, *p; - register struct soap_flist *fp, *fq; - 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; - 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; - } - return NULL; -} -#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)); - if (soap->fdebug[SOAP_INDEX_TEST]) - 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) - { fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); - 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) - { fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); - 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; -#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; - q->fdelete(q); - 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; - q->fdelete(q); - SOAP_FREE(soap, q); - } - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -struct soap_clist * -SOAP_FMAC2 -soap_link(struct soap *soap, void *p, int t, int n, void (*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_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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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: id type=%d href type=%d\n", 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*)); - 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*)); - *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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } -#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)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)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)) - 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) - { if (soap->mode & SOAP_MIME_POSTCHECK) - { soap_resolve(soap); - return SOAP_OK; - } - 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) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { soap_wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(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; - } - } -#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 - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free_temp(struct soap *soap) -{ register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { register struct soap_nlist *np = soap->nlist->next; - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n")); - while (soap->attributes) - { register struct soap_attribute *tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap, soap->attributes->value); - SOAP_FREE(soap, soap->attributes); - soap->attributes = tp; - } -#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 - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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) -{ char *s = NULL; - soap_close_logfile(soap, i); - if (soap->logfile[i]) - SOAP_FREE(soap, (void*)soap->logfile[i]); - if (logfile) - if ((s = (char*)SOAP_MALLOC(soap, strlen(logfile) + 1))) - strcpy(s, logfile); - soap->logfile[i] = s; -} -#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(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, struct soap *soap) -{ if (soap_check_state(soap)) - return NULL; - if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - 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_DEBUG - soap_init_mht(copy); -#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 -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); - soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); - soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); -#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 && (soap->error = 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; - } - } - else - soap->error = SOAP_EOM; - 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->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 = soap->d_stream; - copy->z_buflen = soap->z_buflen; - copy->z_level = soap->z_level; - copy->z_crc = soap->z_crc; - copy->z_ratio_in = soap->z_ratio_in; - copy->z_ratio_out = soap->z_ratio_out; - 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; - 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->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 -#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 = "%G"; - soap->double_format = "%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->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->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_OPENSSL - if (!ssl_init_done) - soap_ssl_init(); - 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_ZLIB - soap->zlib_state = SOAP_ZLIB_NONE; - soap->zlib_in = SOAP_ZLIB_NONE; - soap->zlib_out = SOAP_ZLIB_NONE; - soap->d_stream.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = 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 SOAP_DEBUG - soap_init_mht(soap); - soap_init_logs(soap); -#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 SOAP_DEBUG - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, "TEST.log"); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing context\n")); -#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) -{ register struct soap_clist *cp; - if (soap_check_state(soap)) - return; - soap_free_temp(soap); - soap_dealloc(soap, NULL); - while (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) -{ size_t n = strlen(little); - 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:"")); -#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 = SOAP_EOM; - 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, soap->prolog ? soap->prolog : "\n")) - 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; /* start with 0 or 2, but should be one to continue */ -#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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } -#ifndef WITH_LEAN - if (type && *type && (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 = SOAP_EOM; - (*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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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 || (a && !a->__ptr)) - { 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); - /* 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) -{ -#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)); - 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 (soap->body) - soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) - return soap->error = SOAP_NULL; - if (type && *soap->type && soap_match_tag(soap, soap->type, type)) - return soap->error = SOAP_TYPE; - } - } - 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 const char *t; - register int n = 0; - if (tag && *tag == '-') - return SOAP_OK; - soap->level--; - soap_pop_namespace(soap); -#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->error == SOAP_NO_TAG) - soap->error = SOAP_OK; - 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:"")); - if (!tag || !*tag) - return SOAP_OK; - if ((s = strchr(soap->tag, ':'))) - s++; - else - s = soap->tag; - if ((t = strchr(tag, ':'))) - t++; - else - t = tag; - if (!SOAP_STRCMP(s, t)) - return SOAP_OK; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#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; - 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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; - 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; - 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'; - 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; -#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 = SOAP_EOM; - 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 - 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 = SOAP_EOM; - (*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] == ':') - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (soap->tmpbuf[5]) - t = NULL; - else - t = SOAP_STR_EOS; - } - else - t = NULL; - for (tp = soap->attributes; 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; - 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)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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, 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; - tp->visible = 0; - } - } -#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) - { if (!strcmp(tp->name, "id")) - { if (soap->version > 0 - || (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)) - { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - soap->href[sizeof(soap->href)-1] = '\0'; - } - } - else 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) - { 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 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 = 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 - 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; - } - } - } - 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; - register int 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->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; -#ifndef WITH_LEAN - t = soap->tmpbuf; - t[0] = '<'; - strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 1); - strncat(t, ">", sizeof(soap->tmpbuf)); - m = strlen(soap->tag) + 2; -#endif - } - } -#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)) - 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, 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 && !(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)) - 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, 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: - 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 '<' | 0x80000000: - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - m = 3; - } - break; - case '>' | 0x80000000: - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - m = 3; - } - break; - case '&' | 0x80000000: - if (flag) - *s++ = '&'; - else - { *s++ = '&'; - t = (char*)"amp;"; - m = 4; - } - break; - case '"' | 0x80000000: - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - m = 5; - } - break; - case '\'' | 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, 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; - register long l = 0; - register soap_wchar c; - const char *t = NULL; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); - if (soap->peeked) - { if (!soap->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; - } - } - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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, 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)) - s = "NaN"; - else if (soap_ispinff(n)) - s = "INF"; - else if (soap_isninff(n)) - s = "-INF"; - else - { char *t; - s = soap->tmpbuf; - sprintf(soap->tmpbuf, soap->float_format, n); - t = strchr(s, ','); /* convert decimal comma to DP */ - if (t) - *t = '.'; - } - return s; -} -#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 appears to be broken or doesn't link: use with caution */ -#if defined(HAVE_STRTOF) - char *r; - *p = strtof((char*)s, &r); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#ifdef 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)) - s = "NaN"; - else if (soap_ispinfd(n)) - s = "INF"; - else if (soap_isninfd(n)) - s = "-INF"; - else - { char *t; - s = soap->tmpbuf; - sprintf(soap->tmpbuf, soap->double_format, n); - t = strchr(s, ','); /* convert decimal comma to DP */ - if (t) - *t = '.'; - } - return s; -} -#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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#ifdef 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) -{ *t = NULL; - 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) - { struct soap_nlist *np = soap->nlist; - const char *p; - /* if there is no namespace stack, or prefix is "xml" then pass string */ - if (!np || !strncmp(s, "xml:", 4)) - { *t = soap_strdup(soap, s); - return SOAP_OK; - } - /* else we normalize the QName by replacing its prefix */ - p = strchr(s, ':'); - if (p) - { register int n = p - s; - while (np && (strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { register const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - else - *t = NULL; - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - { -#ifndef WITH_LEAN - if (s && (soap->mode & SOAP_XML_CANONICAL)) - { t = (char*)strchr(s, ':'); - if (t) - soap_utilize_ns(soap, s, t - s); - } -#endif - return s; - } - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%d", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2wchar(struct soap *soap, const char *s, wchar_t **t) -{ wchar_t *r; - if (!s) - *t = NULL; - else - { *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 = *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->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; - } - else if (soap->null) - *p = NULL; - else - *p = (char*)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; - } - else if (soap->null) - *p = NULL; - else - *p = (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 -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#else - time_t t, g, z; -#ifdef HAVE_GMTIME_R - struct tm tm, *tmp = &tm; -#else - struct tm *tmp; -#endif - t = mktime(T); - if (t == -1) - return -1; -#ifdef HAVE_GMTIME_R - gmtime_r(&t, tmp); -#else - tmp = gmtime(&t); -#endif - tmp->tm_isdst = 0; - g = mktime(tmp); - if (g == -1) - return -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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&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); - } - /* The following defines were added for VxWorks*/ -# elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, 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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_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) - { struct tm T; - char zone[32]; - const char *t; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - 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"; - sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s == '+' || *s == '-') - { int h = 0, m = 0; - if (s[3] == ':') - { sscanf(s, "%d:%d", &h, &m); - if (h < 0) - m = -m; - } - else - { m = (int)atol(s); - h = m / 100; - m = m % 100; - } - T.tm_hour -= h; - T.tm_min -= m; - } - T.tm_isdst = 0; - *p = soap_timegm(&T); - } - else - { T.tm_isdst = -1; - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - } - 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) - *p = soap_string_in(soap, 0, -1, -1); - else if (soap->null) - *p = NULL; - else - *p = (char*)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); - else if (soap->null) - *p = NULL; - else - *p = (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, now get \n */ - if (c == '\n') - { *s = '\0'; - if (i+1 == len) /* empty line: end of HTTP/MIME header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - else if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - 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] = optype >> 8; - s[1] = optype & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime.type) - typelen = strlen(soap->dime.type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); - tmp[1] = soap->dime.flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime.size >> 24; - tmp[9] = (soap->dime.size >> 16) & 0xFF; - tmp[10] = (soap->dime.size >> 8) & 0xFF; - tmp[11] = 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 int i; - register char *s; - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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, soap->dime.size)) - return soap->error = SOAP_EOF; - } - if (soap_move(soap, ((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; - register soap_wchar c; - register char *s; - register int i; - id = soap->dime.id; - type = soap->dime.type; - options = soap->dime.options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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, 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:"", content->type?content->type:"")); - if (!content->ptr && soap_new_block(soap)) - { soap->error = SOAP_EOM; - return NULL; - } - for (;;) - { if (content->ptr) - s = soap->tmpbuf; - else if (!(s = (char*)soap_push_block(soap, 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, i+1)-1; - content->ptr = soap_save_block(soap, 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:"")); - 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set cookie: %s=%s domain=%s path=%s\n", name, value?value:"(null)", domain?domain:"(null)", path?path:"(null)")); - 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); - 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 = -1; - 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 || !p->env) - { 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) - sprintf(s, ";Domain=\"%s\"", p->domain); - else if (soap->cookie_domain && (int)strlen(soap->cookie_domain) < tmp-s+4064) - sprintf(s, ";Domain=\"%s\"", soap->cookie_domain); - strcat(s, ";Path=/"); - if (p->path) - t = p->path; - else - t = soap->cookie_path; - if (t) - { if (*t == '/') - t++; - if ((int)strlen(t) < tmp-s+4064) - strcat(s, t); - } - s += strlen(s); - 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 (p->secure && s-tmp < 4073) - 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 - { size_t domlen = 0; - if (q->domain) - { const char *s = strchr(q->domain, ':'); - if (s) - domlen = s - q->domain; - else - domlen = strlen(q->domain); - } - if ((!q->domain || !strncmp(q->domain, domain, domlen)) - && (!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 = (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 - { p->domain = (char*)SOAP_MALLOC(soap, strlen(soap->host)+1); - strcpy(p->domain, soap->host); - } - if (path) - p->path = path; - else - { p->path = (char*)SOAP_MALLOC(soap, strlen(soap->path)+1); - strcpy(p->path, soap->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, 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, 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; - 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->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->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; - soap->xlist = NULL; -#endif -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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 -#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")); - 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 &= ~SOAP_IO; - soap->error = soap->fparse(soap); - if (soap->error && soap->error < SOAP_STOP) - { soap->keep_alive = 0; /* force close later */ - return soap->error; - } - 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; - return soap->error = soap->status; - } -#ifdef WITH_ZLIB - if (soap->zlib_in != SOAP_ZLIB_NONE) -#ifdef WITH_GZIP - { 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->zlib_state = SOAP_ZLIB_INFLATE; - soap->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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 get = 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; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return soap->error; - 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) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - 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 (s && (((get = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!get); - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!get), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (get) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - if (status) - return soap->error = status; - } - soap->status = k; - if (k == 0 || k == 200 || (((k > 200 && k <= 299) || k == 400 || k == 500) && ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || soap->length > 0))) - return SOAP_OK; - 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")) - { soap->http_content = soap_strdup(soap, val); - if (soap_get_header_attribute(soap, val, "application/dime")) - soap->mode |= 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->mode |= SOAP_ENC_MIME; - } - } -#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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 if (!soap_tag_cmp(key, "Location")) - { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); - soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; - } -#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 (soap_notblank(*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 - 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 -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)) - { -#ifndef WITH_LEAN - if (!soap_element_begin_in(soap, "html", 0, NULL)) - { /* get HTML from buffer, stop receiving to avoid HTML parsing issues */ - char *s; -#ifndef WITH_NOIO - size_t (*f)(struct soap*, char*, size_t) = soap->frecv; - soap->frecv = frecv_stop; -#endif - soap_revert(soap); - s = soap_string_in(soap, 1, -1, -1); -#ifndef WITH_NOIO - soap->frecv = f; -#endif - return soap_set_receiver_error(soap, "HTTP Error", s, SOAP_HTTP_ERROR); - } -#endif - return soap->error = SOAP_VERSIONMISMATCH; - } - 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++) - { soap->host[i] = s[i]; - if (s[i] == ']') - { s++; - break; - } - } - } - 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 (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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - soap->error = SOAP_OK; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - 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) - { soap->status = http_command; - 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)); -#ifdef WITH_UDP - 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; -#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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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 = 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) -{ 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 && soap->status != SOAP_GET && 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); - 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", "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 && soap->status != SOAP_GET) - { 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_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; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) - || (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, 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, 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->version == 1 || (action && *action && strlen(action) < sizeof(soap->tmpbuf) - 2)) - { sprintf(soap->tmpbuf, "\"%s\"", action?action:""); - 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 (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) - s = "200 OK"; - else - s = "202 ACCEPTED"; - 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\"", 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 && !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", "gSOAP/2.7")) - || (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_IO; - soap->omode |= 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 = "SOAP version mismatch or invalid SOAP message"; - break; - case SOAP_DATAENCODINGUNKNOWN: - *c = "SOAP-ENV:DataEncodingUnknown"; - *s = "Unsupported SOAP data encoding"; - break; - case SOAP_NAMESPACE: - *s = soap_set_validation_fault(soap, "namespace mismatch", 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_EOM: - *s = "Out of memory"; - break; - case SOAP_MOE: - *s = "Memory overflow or corruption error"; - 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 ref ", 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:""); - *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, "min/maxOccurs violation", NULL); - break; - case SOAP_LENGTH: - *s = soap_set_validation_fault(soap, "content 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 - sprintf(soap->msgbuf, "End of file or no input: '%s'", soap_strerror(soap)); - *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; - int r = 1; - 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); -#ifndef WITH_NOIO -#ifndef WITH_LEAN - 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)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, NULL, &timeout); - if (r > 0) - { if (!FD_ISSET((SOAP_SOCKET)soap->socket, &sfd) - || (FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - && recv((SOAP_SOCKET)soap->socket, soap->tmpbuf, 1, MSG_PEEK) < 0)) - r = 0; - } - } -#endif -#endif - if ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && 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 status) -{ register soap_mode m = soap->omode; - soap->count = 0; - if ((m & SOAP_IO) == SOAP_IO_CHUNK) - { soap->omode &= ~SOAP_IO_CHUNK; - soap->omode |= SOAP_IO_BUFFER; - } - if (soap_response(soap, status) || 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)) - { if (soap->error != 202) - return soap_closesock(soap); - soap->error = SOAP_OK; - } - return SOAP_OK; -} -#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 - } - return "Operation interrupted or timed out"; -} -#endif -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - if (faultsubcode) - *soap_faultsubcode(soap) = faultsubcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - 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 *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ char *r = NULL, *s = NULL, *t = NULL; - if (faultsubcode) - r = soap_strdup(soap, faultsubcode); - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - 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 *faultdetail) -{ return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcode, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcode, faultstring, faultdetail); -} -#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 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 - -/******************************************************************************/ -#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 -#ifndef WITH_LEAN -soap::soap() -{ soap_init(this); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::soap(soap_mode m) -{ soap_init1(this, m); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::soap(soap_mode im, soap_mode om) -{ soap_init2(this, im, om); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::soap(struct soap& soap) -{ soap_copy_context(this, &soap); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::~soap() -{ soap_destroy(this); - soap_end(this); - soap_done(this); -} -#endif -#endif - -/******************************************************************************/ diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.h deleted file mode 100644 index 2a8928b..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9b.h +++ /dev/null @@ -1,2166 +0,0 @@ -/* - -stdsoap2.h 2.7.9b - -gSOAP runtime - -gSOAP XML Web services tools -Copyright (C) 2000-2007, 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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - 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-2007, 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 --------------------------------------------------------------------------------- -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(__alpha) && !defined(__VMS) -# ifndef TRU64 -# define TRU64 -# endif -#endif - -#ifdef __MVS__ -# ifndef OS390 -# define OS390 -# endif -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -# ifdef WITH_OPENSSL -# ifndef HAVE_OPENSSL_SSL_H -# undef WITH_OPENSSL -# 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_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(_AIXVERSION_431) -# 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(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_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_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_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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# 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 - -#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 - -#ifndef WITH_NOSTDLIB -# include -# ifndef PALM -# include -# include -# endif -# include -# include -#endif - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# include -# include -#endif - -#ifdef WITH_NOHTTP -# ifndef WITH_NOIO -# define WITH_NOIO -# undef WITH_COOKIES -# endif -#endif - -#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 -# endif -# ifndef VXWORKS -# 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 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 - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -# ifndef WITH_NOIO -# ifndef PALM -# include -# include -# include -# include -# endif -# endif -#endif - -/* Portability: define SOAP_SOCKLEN_T */ -#if defined(_AIX) -# define SOAP_SOCKLEN_T socklen_t -#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) -# 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 (-1) -#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) - -#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 -# define LONG64 long long -# define ULONG64 unsigned LONG64 -# endif -#elif defined(UNDER_CE) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#elif defined(__BORLANDC__) -# define LONG64 __int64 -# define ULONG64 unsigned LONG64 -#endif - -#if defined(WIN32) && !defined(CYGWIN) -# define soap_int32 __int32 -#elif defined(SYMBIAN) -# define soap_int32 long -#elif defined(PALM) -# define soap_int32 Int32 -#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 -#else -# define SOAP_ERANGE ERANGE -# define SOAP_EINTR EINTR -# define SOAP_EAGAIN EAGAIN -# 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 -# ifdef WITH_UDP -# define SOAP_BUFLEN (65536) /* max UDP packet size */ -# else -# ifndef WITH_LEAN -# define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -# 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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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_EOM 16 -#define SOAP_MOE 17 -#define SOAP_NULL 18 -#define SOAP_DUPLICATE_ID 19 -#define SOAP_MISSING_ID 20 -#define SOAP_HREF 21 -#define SOAP_UDP_ERROR 22 -#define SOAP_TCP_ERROR 23 -#define SOAP_HTTP_ERROR 24 -#define SOAP_SSL_ERROR 25 -#define SOAP_ZLIB_ERROR 26 -#define SOAP_DIME_ERROR 27 -#define SOAP_DIME_HREF 28 -#define SOAP_DIME_MISMATCH 29 -#define SOAP_DIME_END 30 -#define SOAP_MIME_ERROR 31 -#define SOAP_MIME_HREF 32 -#define SOAP_MIME_END 33 -#define SOAP_VERSIONMISMATCH 34 -#define SOAP_PLUGIN_ERROR 35 -#define SOAP_DATAENCODINGUNKNOWN 36 -#define SOAP_REQUIRED 37 -#define SOAP_PROHIBITED 38 -#define SOAP_OCCURS 39 -#define SOAP_LENGTH 40 -#define SOAP_FD_EXCEEDED 41 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (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_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_RSA 0x06 /* use RSA */ -#define SOAP_SSLv3_TLSv1 0x00 /* SSL v3 and TLS v1 support by default */ -#define SOAP_SSLv3 0x10 /* SSL v3 only */ -#define SOAP_TLSv1 0x20 /* TLS v1 only */ - -#define SOAP_SSL_DEFAULT (SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1) - -/* state */ - -#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 DGBFUN -# 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; - void (*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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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) -} -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 */ - 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 (*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); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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 - int master; - int socket; -#if defined(__cplusplus) && !defined(WITH_LEAN) - std::ostream *os; - std::istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#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 tmpbuf[1024]; /* in/output buffer for HTTP/MIME headers, simpleType values, attribute names, and DIME must be >=1024 bytes */ - char msgbuf[1024]; /* in/output buffer for messages >=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 keep_alive; /* connection should be kept open */ - 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 */ - unsigned int max_keep_alive; - 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 */ - 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 -#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; - 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; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - uLong z_crc; /* internal gzip crc */ - 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 */ -#endif -#ifdef WMW_RPM_IO - void *rpmreqid; -#endif -#ifndef WITH_LEAN -#ifdef __cplusplus - soap(); - soap(soap_mode); - soap(soap_mode, soap_mode); - soap(struct soap&); - ~soap(); -#endif -#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_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(void); -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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int 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, void (*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(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, 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 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*, int n1, int 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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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*); -#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); -#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*, struct soap*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif - diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.c b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.c deleted file mode 100644 index efff89b..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.c +++ /dev/null @@ -1,14414 +0,0 @@ -/* - -stdsoap2.c[pp] 2.7.9d - -gSOAP runtime - -gSOAP XML Web services tools -Copyright (C) 2000-2007, 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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems Inc., for the following additions under gSOAP public license: - - vxWorks compatible (#define VXWORKS) --------------------------------------------------------------------------------- -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-2007, 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 --------------------------------------------------------------------------------- -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 WIN32 -# pragma comment(lib, "wsock32.lib") -#endif - -#ifdef __cplusplus -SOAP_SOURCE_STAMP("@(#) stdsoap2.cpp ver 2.7.9d 2007-02-19 12:00:00 GMT") -extern "C" { -#else -SOAP_SOURCE_STAMP("@(#) stdsoap2.c ver 2.7.9d 2007-02-19 12: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) - -#ifdef WIN32 -#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 - -#ifdef SOAP_DEBUG -static void soap_init_logs(struct soap*); -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 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*); -#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 time_t soap_timegm(struct tm*); -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 -static int ssl_init_done = 0; -static int ssl_auth_init(struct soap*); -static int ssl_verify_callback(int, X509_STORE_CTX*); -static int ssl_password(char*, int, int, void *); -/* This callback is included for future references. It should not be deleted -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_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_LEAN -static size_t frecv_stop(struct soap*, char*, size_t); -#endif -#ifndef WITH_IPV6 -static int tcp_gethost(struct soap*, const char *addr, struct in_addr *inaddr); -#endif -static int tcp_connect(struct soap*, const char *endpoint, const char *host, int port); -static int tcp_accept(struct soap*, int, 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 -#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 - -/******************************************************************************/ -#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) - if (soap->os) - { soap->os->write(s, n); - if (soap->os->good()) - return SOAP_OK; - return SOAP_EOF; - } -#endif - while (n) - { if (soap_valid_socket(soap->socket)) - { -#ifndef WITH_LEAN - if (soap->send_timeout) - { struct timeval timeout; - fd_set fd; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - for (;;) - { register int r; -#ifdef WITH_OPENSSL - if (soap->ssl) - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, &fd, &fd, &timeout); - else -#endif - r = select((SOAP_SOCKET)(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) - { soap->errnum = err; - return SOAP_EOF; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - nwritten = SSL_write(soap->ssl, s, n); - else if (soap->bio) - nwritten = BIO_write(soap->bio, s, n); - else -#endif -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - { if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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)soap->socket, &fd); - select((SOAP_SOCKET)(soap->socket + 1), NULL, NULL, &fd, &timeout); - if (soap->peerlen) - nwritten = sendto((SOAP_SOCKET)soap->socket, s, n, soap->socket_flags, (struct sockaddr*)&soap->peer, soap->peerlen); - else - nwritten = send((SOAP_SOCKET)soap->socket, s, 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)soap->socket, s, n, soap->socket_flags); -#else - nwritten = send((SOAP_SOCKET)soap->socket, (void*)s, n, soap->socket_flags); -#endif - if (nwritten <= 0) - { register int r; -#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) - return SOAP_EOF; -#endif - err = soap_socket_errno(soap->socket); - if (err == SOAP_EWOULDBLOCK || err == SOAP_EAGAIN) - { -#ifndef WITH_LEAN - struct timeval timeout; - fd_set fd; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); -#ifdef WITH_OPENSSL - if (soap->ssl && r == SSL_ERROR_WANT_READ) - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); -#endif - 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 - nwritten = write((SOAP_SOCKET)soap->sendfd, s, n); -#endif -#endif -#endif - if (nwritten <= 0) - { err = soap_errno; - 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 int 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:"")); - 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, 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; -#ifdef PALM - register int timeouts = 10; -#endif - soap->errnum = 0; -#if defined(__cplusplus) && !defined(WITH_LEAN) - if (soap->is) - { if (soap->is->good()) - return soap->is->read(s, n).gcount(); - return 0; - } -#endif - if (soap_valid_socket(soap->socket)) - { for (;;) - { -#ifdef WITH_OPENSSL - register int err = 0; -#endif -#ifndef WITH_LEAN - if (soap->recv_timeout) - { 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; - } -#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)soap->socket, &fd); - for (;;) - { -#ifdef WITH_OPENSSL - if (soap->ssl) - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, &fd, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#endif - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - return 0; - } - r = soap_socket_errno(soap->socket); - if (r != SOAP_EINTR && r != SOAP_EAGAIN) - { soap->errnum = r; - return 0; - } - } - } -#endif -#ifdef WITH_OPENSSL - if (soap->ssl) - { r = SSL_read(soap->ssl, s, 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, n); - if (r > 0) - return (size_t)r; - return 0; - } - else -#endif - { -#ifdef WITH_UDP - 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)soap->socket, s, 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)soap->socket, s, 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 = 0; - timeout.tv_usec = 10000; - } -#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)soap->socket, &fd); -#ifdef WITH_OPENSSL - if (soap->ssl && err == SSL_ERROR_WANT_WRITE) - r = select((SOAP_SOCKET)(soap->socket + 1), NULL, &fd, &fd, &timeout); - else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#else - r = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); -#endif - if (r < 0 && (r = soap_socket_errno(soap->socket)) != SOAP_EINTR) - { soap->errnum = r; - return 0; - } - if (!r && soap->recv_timeout) - { soap->errnum = 0; - return 0; - } - } -#endif -#ifdef PALM - r = soap_socket_errno(soap->socket); - if (r != SOAP_EINTR && timeouts-- <= 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 - r = read((SOAP_SOCKET)soap->recvfd, s, n); - if (r >= 0) - return (size_t)r; - soap->errnum = soap_errno; - return 0; -#endif -#endif -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -#ifndef WITH_NOIO -#ifndef PALM_1 -static size_t -frecv_stop(struct soap *soap, char *s, size_t n) -{ return 0; -} -#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); - 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->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 */ - { -chunk_again: - 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; - } - else - { register soap_wchar c; - char *t, tmp[8]; - 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'; - 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); - return soap->ahead = EOF; - } - 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) - goto chunk_again; - } - } - 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 = ret = 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)ret)); - if (!ret) - goto zlib_again; - 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; - } - 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->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 >= 0x20) - { *tmp = (char)c; - return soap_send_raw(soap, tmp, 1); - } -#ifndef WITH_LEAN - if (c >= 0x80 && (soap->mode & SOAP_XML_CANONICAL)) - { 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 -#endif - sprintf(tmp, "&#%lu;", c); - 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 int 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - return p; - } - *s++ = ((d1 >= 'A' ? (d1 & 0x7) + 9 : d1 - '0') << 4) + (d2 >= 'A' ? (d2 & 0x7) + 9 : d2 - '0'); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, SOAP_BLKLEN); - if (!s) - { soap_end_block(soap); - 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); - soap->error = SOAP_TYPE; - return NULL; - } - } - else - { unsigned char *p; - soap_unget(soap, c); - if (n) - *n = soap_size_block(soap, 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 int 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; - 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 - k + i); - p = (unsigned char*)soap_malloc(soap, soap->lablen - k + i); - if (p) - memcpy(p, soap->labbuf, soap->lablen - k + i); - 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); - } - } -#else - if (soap_new_block(soap)) - return NULL; - for (;;) - { register int i; - register char *s = (char*)soap_push_block(soap, 3 * SOAP_BLKLEN); /* must be multiple of 3 */ - if (!s) - { soap_end_block(soap); - 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, 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 = (struct soap_xlist*)SOAP_MALLOC(soap, sizeof(struct soap_xlist)); - *ptr = NULL; - *size = 0; - *id = soap_strdup(soap, soap->href); - *type = NULL; - *options = NULL; - 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 -int -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)))) - return SOAP_EOM; - p->next = soap->blist; - p->ptr = NULL; - p->size = 0; - soap->blist = p; - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void* -SOAP_FMAC2 -soap_push_block(struct soap *soap, size_t n) -{ char *p; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Push block of %u bytes (%u bytes total)\n", (unsigned int)n, (unsigned int)soap->blist->size + (unsigned int)n)); - if (!(p = (char*)SOAP_MALLOC(soap, n + sizeof(char*) + sizeof(size_t)))) - { soap->error = SOAP_EOM; - return NULL; - } - *(char**)p = soap->blist->ptr; - *(size_t*)(p + sizeof(char*)) = n; - soap->blist->ptr = p; - soap->blist->size += n; - return p + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_pop_block(struct soap *soap) -{ char *p; - if (!soap->blist->ptr) - return; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Pop block\n")); - p = soap->blist->ptr; - soap->blist->size -= *(size_t*)(p + sizeof(char*)); - soap->blist->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; - register struct soap_flist *fp; -#ifndef WITH_LEANER - register struct soap_xlist *xp; -#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:"", 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; - register struct soap_flist *fp; - 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; - register struct soap_flist *fp; - 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, size_t n) -{ if (soap->blist->ptr) - { soap->blist->size -= *(size_t*)(soap->blist->ptr + sizeof(char*)) - n; - *(size_t*)(soap->blist->ptr + sizeof(char*)) = n; - } - return soap->blist->size; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_first_block(struct soap *soap) -{ char *p, *q, *r; - p = soap->blist->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); - soap->blist->ptr = r; - return r + sizeof(char*) + sizeof(size_t); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -char* -SOAP_FMAC2 -soap_next_block(struct soap *soap) -{ char *p; - p = soap->blist->ptr; - if (p) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Next block\n")); - soap->blist->ptr = *(char**)p; - SOAP_FREE(soap, p); - if (soap->blist->ptr) - return soap->blist->ptr + sizeof(char*) + sizeof(size_t); - } - return NULL; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -size_t -SOAP_FMAC2 -soap_block_size(struct soap *soap) -{ return *(size_t*)(soap->blist->ptr + sizeof(char*)); -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_end_block(struct soap *soap) -{ struct soap_blist *bp; - char *p, *q; - bp = soap->blist; - if (bp) - { DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End of block sequence, free all remaining blocks\n")); - for (p = bp->ptr; p; p = q) - { q = *(char**)p; - SOAP_FREE(soap, p); - } - soap->blist = bp->next; - SOAP_FREE(soap, bp); - } - 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, char *p, int flag) -{ register size_t n; - register char *q, *s; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Save all blocks in contiguous memory space of %u bytes (%p->%p)\n", (unsigned int)soap->blist->size, soap->blist->ptr, p)); - if (soap->blist->size) - { if (!p) - p = (char*)soap_malloc(soap, soap->blist->size); - if (p) - { for (s = p, q = soap_first_block(soap); q; q = soap_next_block(soap)) - { n = soap_block_size(soap); -#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); - 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 = 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; - 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; - while (soap->nlist && soap->nlist->level >= soap->level) - { np = soap->nlist->next; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Popped namespace binding (level=%u) '%s'\n", soap->level, soap->nlist->id)); - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_match_namespace(struct soap *soap, const char *id1, const char *id2, int n1, int 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 && !strcmp(id1, "xml") && !strcmp(id1, id2)) - 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; - 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; - 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 (!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, 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; - 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 (!ssl_init_done) - { 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 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 (!ssl_init_done) - soap_ssl_init(); - 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 (!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 cafile first before the key file: - 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 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_ssl_accept(struct soap *soap) -{ BIO *bio; - int timeouts, 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_INVALID_SOCKET; - 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 */ -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)&nonblocking); - } -#else - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)|O_NONBLOCK); -#endif - bio = BIO_new_socket((SOAP_SOCKET)soap->socket, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); - timeouts = 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_READ || err == SSL_ERROR_WANT_WRITE) - { struct timeval timeout; - fd_set fd; - timeout.tv_sec = 0; - timeout.tv_usec = 100000; -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->socket, &fd); - if (err == SSL_ERROR_WANT_READ) - s = select((SOAP_SOCKET)(soap->socket + 1), &fd, NULL, &fd, &timeout); - else - s = select((SOAP_SOCKET)(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 (timeouts-- <= 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 /* 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->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->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_SOCKET)soap->master); - soap->master = SOAP_INVALID_SOCKET; - } -#ifdef WITH_OPENSSL - if (soap->ctx) - { SSL_CTX_free(soap->ctx); - soap->ctx = 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_free_mht(soap); - soap->state = 0; -#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(_AIXVERSION_431) || defined(TRU64) - 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(FREEBSD) || defined(__FreeBSD__) - if (gethostbyname_r(addr, &hostent, soap->buf, SOAP_BUFLEN, &host, &soap->errnum) < 0) - host = NULL; -#elif defined(_AIXVERSION_431) || defined(TRU64) - 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 int -tcp_connect(struct soap *soap, const char *endpoint, const char *host, int port) -{ -#ifdef WITH_IPV6 - struct addrinfo hints, *res, *ressave; -#endif - register int fd, 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->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; -#ifdef WITH_UDP - 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, gai_strerror(err), "getaddrinfo failed in tcp_connect()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - ressave = res; -again: - fd = (int)socket(res->ai_family, res->ai_socktype, res->ai_protocol); - soap->errmode = 0; -#else -again: -#ifdef WITH_UDP - if ((soap->omode & SOAP_IO_UDP)) - fd = (int)socket(AF_INET, SOCK_DGRAM, 0); - else -#endif - fd = (int)socket(AF_INET, SOCK_STREAM, 0); -#endif - if (fd < 0) - { 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 = 0; - if (setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } - } - else if (soap->connect_flags && setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } - if (soap->keep_alive && setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } - if (setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } -#ifdef TCP_NODELAY - if (!(soap->omode & SOAP_IO_UDP) && setsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } -#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, (SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } - soap->peer.sin_port = htons((short)port); - } - soap->errmode = 0; - if ((soap->omode & SOAP_IO_UDP)) - { -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return fd; - } -#endif -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); /* modified to use fd */ - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#endif - for (;;) - { -#ifdef WITH_IPV6 - if (connect((SOAP_SOCKET)fd, res->ai_addr, res->ai_addrlen)) -#else - if (connect((SOAP_SOCKET)fd, (struct sockaddr*)&soap->peer, sizeof(soap->peer))) -#endif - { err = soap_socket_errno(fd); -#ifndef WITH_LEAN - if (err == SOAP_EADDRINUSE) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - if (retry-- > 0) - goto again; - } - else if (soap->connect_timeout && (err == SOAP_EINPROGRESS || err == SOAP_EWOULDBLOCK)) - { struct timeval timeout; - SOAP_SOCKLEN_T k; - fd_set fds; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - { soap->error = SOAP_FD_EXCEEDED; -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ - } -#endif - FD_ZERO(&fds); - FD_SET((SOAP_SOCKET)fd, &fds); - for (;;) - { register int r = select((SOAP_SOCKET)(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, (SOAP_SOCKET)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, (SOAP_SOCKET)fd); -#ifdef WITH_IPV6 - freeaddrinfo(ressave); -#endif - return SOAP_INVALID_SOCKET; - } - } - k = (SOAP_SOCKLEN_T)sizeof(soap->errnum); - if (!getsockopt((SOAP_SOCKET)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, (SOAP_SOCKET)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, (SOAP_SOCKET)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, (SOAP_SOCKET)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->connect_timeout) -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)&~O_NONBLOCK); -#endif -#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) - { unsigned int k = soap->omode; /* make sure we only parse HTTP */ - size_t n = soap->count; /* save the content length */ - char *userid, *passwd; - char endp[sizeof(soap->endpoint)]; - 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, (SOAP_SOCKET)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, strlen(soap->tmpbuf + 262)); - if ((soap->error = soap->fposthdr(soap, "Proxy-Authorization", soap->tmpbuf))) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return soap->error; - } - } -#endif - if ((soap->error = soap->fposthdr(soap, NULL, NULL)) - || soap_flush(soap)) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->omode = k; - k = soap->imode; - soap->imode &= ~SOAP_ENC; /* mask IO and ENC */ - strcpy(endp, soap->endpoint); - userid = soap->userid; /* preserve */ - passwd = soap->passwd; /* preserve */ - if ((soap->error = soap->fparse(soap))) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - strcpy(soap->endpoint, endp); /* restore */ - soap->userid = userid; /* restore */ - soap->passwd = passwd; /* restore */ - soap->imode = k; /* restore */ - soap->count = n; /* restore */ - if (soap_begin_send(soap)) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - soap->ssl = SSL_new(soap->ctx); - if (!soap->ssl) - { soap->fclosesocket(soap, (SOAP_SOCKET)fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; - } - 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((SOAP_SOCKET)fd, BIO_NOCLOSE); - SSL_set_bio(soap->ssl, bio, bio); - /* Connect timeout: set SSL sockets to non-blocking */ -#ifndef WITH_LEAN - if (soap->connect_timeout) -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#endif - /* Try connecting until success or timeout */ - for (;;) - { if ((r = SSL_connect(soap->ssl)) <= 0) - { int err = SSL_get_error(soap->ssl, r); - if (err != SSL_ERROR_NONE && 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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - if (soap->connect_timeout) - { struct timeval timeout; - fd_set fds; - 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; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - { soap->error = SOAP_FD_EXCEEDED; - return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ - } -#endif - FD_ZERO(&fds); - FD_SET((SOAP_SOCKET)fd, &fds); - for (;;) - { int r = select((SOAP_SOCKET)(fd + 1), &fds, NULL, &fds, &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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - continue; - } - } - break; - } - /* Set SSL sockets to non-blocking */ -#ifndef WITH_LEAN -#if defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)fd, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)fd, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)fd, F_SETFL, fcntl((SOAP_SOCKET)fd, F_GETFL)|O_NONBLOCK); -#endif -#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, (SOAP_SOCKET)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, (SOAP_SOCKET)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; - unsigned char *data; - 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 && !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, (SOAP_SOCKET)fd); - return SOAP_INVALID_SOCKET; - } - } - } -#else - soap->fclosesocket(soap, (SOAP_SOCKET)fd); - soap->error = SOAP_SSL_ERROR; - return SOAP_INVALID_SOCKET; -#endif - } - return fd; -} -#endif -#endif - -/******************************************************************************/ -#ifndef WITH_NOIO -#ifndef PALM_1 -SOAP_FMAC1 -int -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; -#endif -#ifndef WITH_LEAN - int len = SOAP_BUFLEN; - int set = 1; -#endif - if (soap_valid_socket(soap->master)) - { soap->fclosesocket(soap, (SOAP_SOCKET)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; -#ifdef WITH_UDP - 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; - soap->peer = *((struct sockaddr_storage*)addrinfo->ai_addr); - soap->peerlen = addrinfo->ai_addrlen; - res.ai_addr = (struct sockaddr*)&soap->peer; - res.ai_addrlen = soap->peerlen; - freeaddrinfo(addrinfo); - } - if (err) - { soap_set_receiver_error(soap, gai_strerror(err), "getaddrinfo failed in soap_bind()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - soap->master = socket(res.ai_family, res.ai_socktype, res.ai_protocol); -#else -#ifdef WITH_UDP - 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; - } -#ifdef WITH_UDP - 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_SOCKET)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_SOCKET)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_SOCKET)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_SOCKET)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_SOCKET)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 - soap->errmode = 0; - if (bind((SOAP_SOCKET)soap->master, res.ai_addr, 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_SOCKET)soap->master, (struct sockaddr*)&soap->peer, 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_SOCKET)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; - int r; - timeout.tv_sec = 0; - timeout.tv_usec = 0; -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - return SOAP_FD_EXCEEDED; /* Hint: MUST increase FD_SETSIZE */ -#endif - FD_ZERO(&rfd); - FD_ZERO(&sfd); - FD_ZERO(&xfd); - if (soap_valid_socket(soap->socket)) - { FD_SET((SOAP_SOCKET)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - FD_SET((SOAP_SOCKET)soap->socket, &xfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, &xfd, &timeout); - if (r > 0 && FD_ISSET((SOAP_SOCKET)soap->socket, &xfd)) - r = -1; - } - else if (soap_valid_socket(soap->master)) - { FD_SET((SOAP_SOCKET)soap->master, &sfd); - r = select((SOAP_SOCKET)(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)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)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)soap->socket, &sfd) - && (!FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - || recv((SOAP_SOCKET)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 int -tcp_accept(struct soap *soap, int s, struct sockaddr *a, int *n) -{ int fd; - fd = (int)accept((SOAP_SOCKET)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 -int -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; -#ifdef WITH_UDP - 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) - { struct timeval timeout; - fd_set fd; - if (soap->accept_timeout > 0) - { timeout.tv_sec = soap->accept_timeout; - timeout.tv_usec = 0; - } - else - { timeout.tv_sec = -soap->accept_timeout/1000000; - timeout.tv_usec = -soap->accept_timeout%1000000; - } -#ifndef WIN32 - if ((int)soap->socket >= (int)FD_SETSIZE) - { soap->error = SOAP_FD_EXCEEDED; - return SOAP_INVALID_SOCKET; /* Hint: MUST increase FD_SETSIZE */ - } -#endif - FD_ZERO(&fd); - FD_SET((SOAP_SOCKET)soap->master, &fd); - for (;;) - { register int r = select((SOAP_SOCKET)(soap->master + 1), &fd, &fd, &fd, &timeout); - if (r > 0) - break; - if (!r) - { soap->errnum = 0; - soap_set_receiver_error(soap, "Timeout", "accept failed in soap_accept()", SOAP_TCP_ERROR); - return SOAP_INVALID_SOCKET; - } - 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 defined(WIN32) - { u_long nonblocking = 1; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &nonblocking); - } -#elif defined(VXWORKS) - { u_long nonblocking = 1; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&nonblocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)|O_NONBLOCK); -#endif - } - else -#if defined(WIN32) - { u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - } -#elif defined(VXWORKS) - { u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&blocking)); - } -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); -#endif -#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 = 0; - if (setsockopt((SOAP_SOCKET)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)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)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)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)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)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 - if (soap->accept_timeout) - { -#if defined(WIN32) - u_long blocking = 0; - ioctlsocket((SOAP_SOCKET)soap->master, FIONBIO, &blocking); - ioctlsocket((SOAP_SOCKET)soap->socket, FIONBIO, &blocking); -#elif defined(VXWORKS) - u_long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, FIONBIO, (int)(&blocking)); - ioctl((SOAP_SOCKET)soap->socket, FIONBIO, (int)(&blocking)); -#elif defined(PALM) - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL,0)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL,0)&~O_NONBLOCK); -#elif defined(SYMBIAN) - long blocking = 0; - ioctl((SOAP_SOCKET)soap->master, 0/*FIONBIO*/, &blocking); -#else - fcntl((SOAP_SOCKET)soap->master, F_SETFL, fcntl((SOAP_SOCKET)soap->master, F_GETFL)&~O_NONBLOCK); - fcntl((SOAP_SOCKET)soap->socket, F_SETFL, fcntl((SOAP_SOCKET)soap->socket, F_GETFL)&~O_NONBLOCK); -#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) - { 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)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)soap->socket, &fd); - r = select((SOAP_SOCKET)(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->socket = SOAP_INVALID_SOCKET; - SSL_free(soap->ssl); - soap->ssl = NULL; - 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->socket = SOAP_INVALID_SOCKET; - } - SSL_free(soap->ssl); - soap->ssl = NULL; - ERR_remove_state(0); - return SOAP_SSL_ERROR; - } - } - SSL_free(soap->ssl); - soap->ssl = NULL; - ERR_remove_state(0); - } -#endif - if (soap_valid_socket(soap->socket) && !(soap->omode & SOAP_IO_UDP)) - { soap->fshutdownsocket(soap, (SOAP_SOCKET)soap->socket, 2); - soap->fclosesocket(soap, (SOAP_SOCKET)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) -{ -#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) -{ 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 -#ifdef WITH_UDP - 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) - soap_new_block(soap); - 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 */ -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->sendfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->sendfd, _O_BINARY); -#endif -#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) - { -#ifdef WITH_GZIP - 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); - if (deflateInit2(&soap->d_stream, soap->z_level, Z_DEFLATED, -MAX_WBITS, 8, Z_DEFAULT_STRATEGY) != Z_OK) -#else - soap->d_stream.next_out = (Byte*)soap->z_buf; - soap->d_stream.avail_out = SOAP_BUFLEN; - if (deflateInit(&soap->d_stream, soap->z_level) != Z_OK) -#endif - return soap->error = SOAP_ZLIB_ERROR; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Deflate initialized\n")); - soap->zlib_state = SOAP_ZLIB_DEFLATE; - } -#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_NOIDREF -#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) -{ 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:"", id, atype?atype:"")); - 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; - return -1; -} -#endif -#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, *p; - register struct soap_flist *fp, *fq; - 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; - 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; - } - return NULL; -} -#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)); - if (soap->fdebug[SOAP_INDEX_TEST]) - 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) - { fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); - 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) - { fprintf(stderr, "Data corruption in dynamic allocation (see logs)\n"); - 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; -#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); - } - } -} -#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_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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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: id type=%d href type=%d\n", 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*)); - 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*)); - *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) - { ip = soap_enter(soap, href); /* new hash table entry for string id */ - 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) - { ip = soap_enter(soap, id); /* new hash table entry for string id */ - 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 %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:"")); - return soap->error = SOAP_ZLIB_ERROR; - } -#ifdef WITH_GZIP - 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); p; p = soap_next_block(soap)) - { DBGMSG(SENT, p, soap_block_size(soap)); - if ((soap->error = soap->fsend(soap, p, soap_block_size(soap)))) - { soap_end_block(soap); - return soap->error; - } - } - soap_end_block(soap); - } -#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)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)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)) - 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) - { 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; -#ifdef WITH_GZIP - if (soap->zlib_in == SOAP_ZLIB_GZIP) - { soap_wchar c; - short i; - for (i = 0; i < 8; i++) - { if ((int)(c = soap_getchar(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; - } - } -#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 - return SOAP_OK; -} -#endif - -/******************************************************************************/ -#ifndef PALM_1 -SOAP_FMAC1 -void -SOAP_FMAC2 -soap_free_temp(struct soap *soap) -{ register struct Namespace *ns; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free namespace stack\n")); - while (soap->nlist) - { register struct soap_nlist *np = soap->nlist->next; - SOAP_FREE(soap, soap->nlist); - soap->nlist = np; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free any remaining temp blocks\n")); - while (soap->blist) - soap_end_block(soap); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Free attribute storage\n")); - while (soap->attributes) - { register struct soap_attribute *tp = soap->attributes->next; - if (soap->attributes->value) - SOAP_FREE(soap, soap->attributes->value); - SOAP_FREE(soap, soap->attributes); - soap->attributes = tp; - } -#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 - -/******************************************************************************/ -#ifdef 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 - -/******************************************************************************/ -#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(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, struct soap *soap) -{ if (soap_check_state(soap)) - return NULL; - if (copy) - { register struct soap_plugin *p; - memcpy(copy, soap, sizeof(struct soap)); - 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_DEBUG - soap_init_mht(copy); -#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 -#ifdef SOAP_DEBUG - soap_init_logs(copy); - soap_set_recv_logfile(copy, soap->logfile[SOAP_INDEX_RECV]); - soap_set_sent_logfile(copy, soap->logfile[SOAP_INDEX_SENT]); - soap_set_test_logfile(copy, soap->logfile[SOAP_INDEX_TEST]); -#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 && (soap->error = 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; - } - } - else - soap->error = SOAP_EOM; - 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->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 = soap->d_stream; - copy->z_buflen = soap->z_buflen; - copy->z_level = soap->z_level; - copy->z_crc = soap->z_crc; - copy->z_ratio_in = soap->z_ratio_in; - copy->z_ratio_out = soap->z_ratio_out; - 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; - 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->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 -#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 = "%G"; - soap->double_format = "%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->max_keep_alive = SOAP_MAXKEEPALIVE; - soap->keep_alive = 0; - 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->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.zalloc = NULL; - soap->d_stream.zfree = NULL; - soap->d_stream.opaque = 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 SOAP_DEBUG - soap_init_mht(soap); - soap_init_logs(soap); -#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 SOAP_DEBUG - soap_set_recv_logfile(soap, "RECV.log"); - soap_set_sent_logfile(soap, "SENT.log"); - soap_set_test_logfile(soap, "TEST.log"); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Initializing context\n")); -#endif -#ifdef WITH_OPENSSL - if (!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 - 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) -{ size_t n = strlen(little); - 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:"")); -#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 = SOAP_EOM; - 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, soap->prolog ? soap->prolog : "\n")) - 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; /* start with 0 or 2, but should be one to continue */ -#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 (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 (type && *type && (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 (type && *type && (soap_attribute(soap, "SOAP-ENC:arrayType", type))) - return soap->error; - } -#ifndef WITH_LEAN - if (type && *type && (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 = SOAP_EOM; - (*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 (soap->part != SOAP_IN_HEADER && soap->encodingStyle) - if (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 || (a && !a->__ptr)) - { 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); - /* 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) -{ -#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)); - 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 (soap->body) - soap->level++; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Begin element found (level=%u) '%s'='%s'\n", soap->level, soap->tag, tag?tag:"" )); - if (!nillable && soap->null && (soap->mode & SOAP_XML_STRICT)) - return soap->error = SOAP_NULL; - if (type && *soap->type && soap_match_tag(soap, soap->type, type)) - return soap->error = SOAP_TYPE; - } - } - 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:"")); - if (!tag || !*tag || !soap_match_tag(soap, soap->tag, tag)) - { soap->level--; - soap_pop_namespace(soap); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "End element tag name does not match\n")); - return soap->error = SOAP_SYNTAX_ERROR; -} -#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; - 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; - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Set attribute %s='%s'\n", name, value?value:"")); - 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; - 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; - 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'; - 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; -#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 = SOAP_EOM; - 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 - 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 = SOAP_EOM; - (*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] == ':') - { soap->tmpbuf[5] = '\0'; - t = soap->tmpbuf + 6; - } - else if (soap->tmpbuf[5]) - t = NULL; - else - t = SOAP_STR_EOS; - } - else - t = NULL; - for (tp = soap->attributes; 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; - 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)) - return soap->error; - for (;;) - { if (!(s = (char*)soap_push_block(soap, 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, 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; - tp->visible = 0; - } - } -#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) - { if (!strcmp(tp->name, "id")) - { if (soap->version > 0 - || (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)) - { strncpy(soap->href, tp->value, sizeof(soap->href) - 1); - soap->href[sizeof(soap->href)-1] = '\0'; - } - } - else 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) - { 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 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 = 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 - 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; - } - } - } - 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; - register int 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->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; -#ifndef WITH_LEAN - t = soap->tmpbuf; - t[0] = '<'; - strncpy(t + 1, soap->tag, sizeof(soap->tmpbuf) - 1); - strncat(t, ">", sizeof(soap->tmpbuf)); - m = strlen(soap->tag) + 2; -#endif - } - } -#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)) - 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, 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 && !(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)) - 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, 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: - 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 '<' | 0x80000000: - if (flag) - *s++ = '<'; - else - { *s++ = '&'; - t = (char*)"lt;"; - m = 3; - } - break; - case '>' | 0x80000000: - if (flag) - *s++ = '>'; - else - { *s++ = '&'; - t = (char*)"gt;"; - m = 3; - } - break; - case '&' | 0x80000000: - if (flag) - *s++ = '&'; - else - { *s++ = '&'; - t = (char*)"amp;"; - m = 4; - } - break; - case '"' | 0x80000000: - if (flag) - *s++ = '"'; - else - { *s++ = '&'; - t = (char*)"quot;"; - m = 5; - } - break; - case '\'' | 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, 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; - register long l = 0; - register soap_wchar c; - const char *t = NULL; - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Reading wide string content\n")); - if (soap->peeked) - { if (!soap->body) - return NULL; - if (*soap->tag) - { n = 1; - soap->peeked = 0; - } - } - if (soap_new_block(soap)) - return NULL; - for (;;) - { if (!(s = (wchar_t*)soap_push_block(soap, 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: - 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 = "lt;"; - } - break; - case '>': - if (flag) - *s++ = (soap_wchar)'>'; - else - { *s++ = (soap_wchar)'&'; - t = "gt;"; - } - break; - case '"': - if (flag) - *s++ = (soap_wchar)'"'; - else - { *s++ = (soap_wchar)'&'; - t = "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, 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, 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, *t; - if (soap_isnan((double)n)) - return "NaN"; - if (soap_ispinff(n)) - return "INF"; - if (soap_isninff(n)) - return "-INF"; - s = soap->tmpbuf; - sprintf(soap->tmpbuf, soap->float_format, n); - t = strchr(s, ','); /* convert decimal comma to DP */ - if (t) - *t = '.'; - return s; -} -#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 appears to be broken or doesn't link: use with caution */ -#if defined(HAVE_STRTOF) - char *r; - *p = strtof((char*)s, &r); - if (*r) -#elif defined(HAVE_STRTOD) - char *r; - *p = (float)strtod(s, &r); - if (*r) -#endif -#ifdef 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, *t; - if (soap_isnan(n)) - return "NaN"; - if (soap_ispinfd(n)) - return "INF"; - if (soap_isninfd(n)) - return "-INF"; - s = soap->tmpbuf; - sprintf(soap->tmpbuf, soap->double_format, n); - t = strchr(s, ','); /* convert decimal comma to DP */ - if (t) - *t = '.'; - return s; -} -#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 - { -#ifdef HAVE_STRTOD - char *r; - *p = strtod(s, &r); - if (*r) -#endif -#ifdef 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) -{ *t = NULL; - 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) - { struct soap_nlist *np = soap->nlist; - const char *p; - /* if there is no namespace stack, or prefix is "xml" then pass string */ - if (!np || !strncmp(s, "xml:", 4)) - { *t = soap_strdup(soap, s); - return SOAP_OK; - } - /* else we normalize the QName by replacing its prefix */ - p = strchr(s, ':'); - if (p) - { register int n = p - s; - while (np && (strncmp(np->id, s, n) || np->id[n])) - np = np->next; - p++; - } - else - { while (np && *np->id) - np = np->next; - p = s; - } - if (np) - { if (np->index >= 0 && soap->local_namespaces) - { register const char *q = soap->local_namespaces[np->index].id; - if (q) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(q) + 2))) - sprintf(*t, "%s:%s", q, p); - return SOAP_OK; - } - } - if (np->ns) - { if ((*t = (char*)soap_malloc(soap, strlen(p) + strlen(np->ns) + 4))) - sprintf(*t, "\"%s\":%s", np->ns, p); - return SOAP_OK; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined (index=%d, URI=%s)\n", s, np->index, np->ns?np->ns:"")); - return soap->error = SOAP_NAMESPACE; - } - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "Namespace prefix of '%s' not defined, assuming empty namespace\n", s)); - if ((*t = (char*)soap_malloc(soap, strlen(p) + 4))) - sprintf(*t, "\"\":%s", p); - } - else - *t = NULL; - return soap->error; -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -const char* -SOAP_FMAC2 -soap_QName2s(struct soap *soap, const char *s) -{ struct Namespace *p; - char *t; - int n; - if (!s || *s != '"') - { -#ifndef WITH_LEAN - if (s && (soap->mode & SOAP_XML_CANONICAL)) - { t = (char*)strchr(s, ':'); - if (t) - soap_utilize_ns(soap, s, t - s); - } -#endif - return s; - } - s++; - if ((p = soap->local_namespaces)) - { 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; - } - if (p && p->id) - { s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(p->id) + strlen(s)); - strcpy(t, p->id); - strcat(t, s + 1); - return t; - } - } - } - t = (char*)strchr(s, '"'); - if (t) - n = t - s; - else - n = 0; - t = soap_strdup(soap, s); - t[n] = '\0'; - sprintf(soap->tmpbuf, "xmlns:_%d", soap->idnum++); - soap_set_attr(soap, soap->tmpbuf, t); - s = strchr(s, '"'); - if (s) - { t = (char*)soap_malloc(soap, strlen(soap->tmpbuf) + strlen(s) - 6); - strcpy(t, soap->tmpbuf + 6); - strcat(t, s + 1); - } - return t; -} -#endif - -/******************************************************************************/ -#ifndef WITH_LEAN -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_s2wchar(struct soap *soap, const char *s, wchar_t **t) -{ wchar_t *r; - if (!s) - *t = NULL; - else - { *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 = *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->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 (soap->null) - *p = NULL; - else - *p = (char*)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 (soap->null) - *p = NULL; - else - *p = (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 -static time_t -soap_timegm(struct tm *T) -{ -#if defined(HAVE_TIMEGM) - return timegm(T); -#else - time_t t, g, z; -#ifdef HAVE_GMTIME_R - struct tm tm, *tmp = &tm; -#else - struct tm *tmp; -#endif - t = mktime(T); - if (t == -1) - return -1; -#ifdef HAVE_GMTIME_R - gmtime_r(&t, tmp); -#else - tmp = gmtime(&t); -#endif - tmp->tm_isdst = 0; - g = mktime(tmp); - if (g == -1) - return -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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PGMTIME_R) - if (gmtime_r(&n, pT)) - strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%SZ", pT); -#elif defined(HAVE_PGMTIME) - if (gmtime(&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); - } - /* The following defines were added for VxWorks*/ -# elif defined(HAVE_PLOCALTIME_R) - if (localtime_r(&n, pT)) - { strftime(soap->tmpbuf, sizeof(soap->tmpbuf), "%Y-%m-%dT%H:%M:%S", pT); - sprintf(soap->tmpbuf+strlen(soap->tmpbuf), "%+03d:%02d", t.timezone/60, 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); - /* The following defines were added for VxWorks*/ -#elif defined(HAVE_PLOCALTIME_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) - { struct tm T; - char zone[32]; - const char *t; - memset((void*)&T, 0, sizeof(T)); - zone[sizeof(zone)-1] = '\0'; - 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"; - sscanf(s, t, &T.tm_year, &T.tm_mon, &T.tm_mday, &T.tm_hour, &T.tm_min, &T.tm_sec, zone); - if (T.tm_year == 1) - T.tm_year = 70; - else - T.tm_year -= 1900; - T.tm_mon--; - if (*zone) - { if (*zone == '.') - { for (s = zone + 1; *s; s++) - if (*s < '0' || *s > '9') - break; - } - else - s = zone; - if (*s == '+' || *s == '-') - { int h = 0, m = 0; - if (s[3] == ':') - { sscanf(s, "%d:%d", &h, &m); - if (h < 0) - m = -m; - } - else - { m = (int)atol(s); - h = m / 100; - m = m % 100; - } - T.tm_hour -= h; - T.tm_min -= m; - } - T.tm_isdst = 0; - *p = soap_timegm(&T); - } - else - { T.tm_isdst = -1; - *p = mktime(&T); /* no time zone: suppose it is localtime? */ - } - } - 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) - { *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 = (char*)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 (soap->null) - *p = NULL; - else - *p = (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, now get \n */ - if (c == '\n') - { *s = '\0'; - if (i+1 == len) /* empty line: end of HTTP/MIME header */ - break; - c = soap_unget(soap, soap_getchar(soap)); - if (c != ' ' && c != '\t') /* HTTP line continuation? */ - break; - } - else if ((int)c == EOF) - return soap->error = SOAP_EOF; - } - 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] = optype >> 8; - s[1] = optype & 0xFF; - s[2] = n >> 8; - s[3] = 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:"")); - 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 (soap->dime.type) - typelen = strlen(soap->dime.type); - tmp[0] = SOAP_DIME_VERSION | (soap->dime.flags & 0x7); - tmp[1] = soap->dime.flags & 0xF0; - tmp[2] = optlen >> 8; - tmp[3] = optlen & 0xFF; - tmp[4] = idlen >> 8; - tmp[5] = idlen & 0xFF; - tmp[6] = typelen >> 8; - tmp[7] = typelen & 0xFF; - tmp[8] = soap->dime.size >> 24; - tmp[9] = (soap->dime.size >> 16) & 0xFF; - tmp[10] = (soap->dime.size >> 8) & 0xFF; - tmp[11] = 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 int i; - register char *s; - 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->dime.type?soap->dime.type:"", soap->dime.options?soap->dime.options+4:"")); - 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, soap->dime.size)) - return soap->error = SOAP_EOF; - } - if (soap_move(soap, ((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; - register soap_wchar c; - register char *s; - register int i; - id = soap->dime.id; - type = soap->dime.type; - options = soap->dime.options; - if (soap_new_block(soap)) - return SOAP_EOM; - for (;;) - { s = (char*)soap_push_block(soap, 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, 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:"", content->type?content->type:"")); - if (!content->ptr && soap_new_block(soap)) - { soap->error = SOAP_EOM; - return NULL; - } - for (;;) - { if (content->ptr) - s = soap->tmpbuf; - else if (!(s = (char*)soap_push_block(soap, 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, i+1)-1; - content->ptr = soap_save_block(soap, 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:"")); - 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 ? "" : "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 */ - if (!flag) - { struct hostent *hostent = gethostbyname(domain); - if (hostent) - { char *r = strchr(hostent->h_name, '.'); - if (!r) - r = hostent->h_name; - flag = !strncmp(t, r, n); - } - } - 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 = (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, 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; - 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->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->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; - soap->xlist = NULL; -#endif -#ifdef WIN32 -#ifndef UNDER_CE -#ifndef WITH_FASTCGI - if (!soap_valid_socket(soap->socket)) -#ifdef __BORLANDC__ - setmode((SOAP_SOCKET)soap->recvfd, O_BINARY); -#else - _setmode((SOAP_SOCKET)soap->recvfd, _O_BINARY); -#endif -#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 -#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")); - 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 &= ~SOAP_IO; - soap->error = soap->fparse(soap); - 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; - 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; - return soap->error = soap->status; - } -#ifdef WITH_ZLIB - if (soap->zlib_in != SOAP_ZLIB_NONE) -#ifdef WITH_GZIP - { 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->zlib_state = SOAP_ZLIB_INFLATE; - soap->z_crc = crc32(0L, NULL, 0); - DBGLOG(TEST, SOAP_MESSAGE(fdebug, "gzip initialized\n")); - } - else - { soap_revget1(soap); -#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; - 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 get = 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; - do - { if (soap_getline(soap, soap->msgbuf, sizeof(soap->msgbuf))) - return soap->error; - 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) - { *s = '\0'; - do s++; - while (*s && *s <= 32); - 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 (s && (((get = !strncmp(soap->msgbuf, "GET ", 4))) || !strncmp(soap->msgbuf, "POST ", 5))) - { size_t m = strlen(soap->endpoint); - size_t n = m + (s - soap->msgbuf) - 5 - (!get); - if (m > n) - m = n; - if (n >= sizeof(soap->endpoint)) - n = sizeof(soap->endpoint) - 1; - strncpy(soap->path, soap->msgbuf + 4 + (!get), n - m); - soap->path[n - m] = '\0'; - strcat(soap->endpoint, soap->path); - DBGLOG(TEST,SOAP_MESSAGE(fdebug, "Target endpoint='%s'\n", soap->endpoint)); - if (get) - { soap->error = soap->fget(soap); - if (soap->error == SOAP_OK) - soap->error = SOAP_STOP; /* prevents further processing */ - return soap->error; - } - if (status) - return soap->error = status; - } - soap->status = k; - if (k == 0 || k == 200 || (((k > 200 && k <= 299) || k == 400 || k == 500) && ((soap->mode & SOAP_IO) == SOAP_IO_CHUNK || soap->length > 0))) - return SOAP_OK; - 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")) - { soap->http_content = soap_strdup(soap, val); - if (soap_get_header_attribute(soap, val, "application/dime")) - soap->mode |= 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->mode |= SOAP_ENC_MIME; - } - } -#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->mode &= ~SOAP_IO; - if (!soap_tag_cmp(val, "chunked")) - soap->mode |= 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 if (!soap_tag_cmp(key, "Location")) - { strncpy(soap->endpoint, val, sizeof(soap->endpoint)); - soap->endpoint[sizeof(soap->endpoint) - 1] = '\0'; - } -#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 (soap_notblank(*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 - 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 -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)) - { -#ifndef WITH_LEAN - if (!soap_element_begin_in(soap, "html", 0, NULL)) - { /* get HTML from buffer, stop receiving to avoid HTML parsing issues */ - char *s; -#ifndef WITH_NOIO - size_t (*f)(struct soap*, char*, size_t) = soap->frecv; - soap->frecv = frecv_stop; -#endif - soap_revert(soap); - s = soap_string_in(soap, 1, -1, -1); -#ifndef WITH_NOIO - soap->frecv = f; -#endif - return soap_set_receiver_error(soap, "HTTP Error", s, SOAP_HTTP_ERROR); - } -#endif - return soap->error = SOAP_VERSIONMISMATCH; - } - 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++) - { soap->host[i] = s[i]; - if (s[i] == ']') - { s++; - break; - } - } - } - 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 (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 *endpoint, const char *action) -{ char host[sizeof(soap->host)]; - int port; - size_t count; - soap->error = SOAP_OK; - strcpy(host, soap->host); /* save to compare */ - port = soap->port; /* save to compare */ - 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) - { soap->status = http_command; - 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)); -#ifdef WITH_UDP - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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) - { soap->error = SOAP_EOM; - 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 = 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); - 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) - { err = soap->fposthdr(soap, "Content-Encoding", soap->zlib_out == SOAP_ZLIB_GZIP ? "gzip" : "deflate"); - 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_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; - if (port != 80) - sprintf(soap->tmpbuf, "%s:%d", host, port); - else - strcpy(soap->tmpbuf, host); - if ((err = soap->fposthdr(soap, "Host", soap->tmpbuf)) - || (err = soap->fposthdr(soap, "User-Agent", "gSOAP/2.7")) - || (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, 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, 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 && strlen(action) < sizeof(soap->tmpbuf) - 2))) - { sprintf(soap->tmpbuf, "\"%s\"", action?action:""); - 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 (count || ((soap->omode & SOAP_IO) == SOAP_IO_CHUNK)) - s = "200 OK"; - else - s = "202 ACCEPTED"; - 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\"", 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 && !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", "gSOAP/2.7")) - || (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_IO; - soap->omode |= 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 = "SOAP version mismatch or invalid SOAP message"; - 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_EOM: - *s = "Out of memory"; - break; - case SOAP_MOE: - *s = "Memory overflow or memory corruption error"; - 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 ref ", 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:""); - *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, "min/maxOccurs violation", NULL); - break; - case SOAP_LENGTH: - *s = soap_set_validation_fault(soap, "content 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; - int r = 1; - 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); -#ifndef WITH_NOIO -#ifndef WITH_LEAN - 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)soap->socket, &rfd); - FD_SET((SOAP_SOCKET)soap->socket, &sfd); - r = select((SOAP_SOCKET)(soap->socket + 1), &rfd, &sfd, NULL, &timeout); - if (r > 0) - { if (!FD_ISSET((SOAP_SOCKET)soap->socket, &sfd) - || (FD_ISSET((SOAP_SOCKET)soap->socket, &rfd) - && recv((SOAP_SOCKET)soap->socket, soap->tmpbuf, 1, MSG_PEEK) < 0)) - r = 0; - } - } -#endif -#endif - if ((status != SOAP_EOF || (!soap->recv_timeout && !soap->send_timeout)) && 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 status) -{ register soap_mode m = soap->omode; - soap->count = 0; - if ((m & SOAP_IO) == SOAP_IO_CHUNK) - { soap->omode &= ~SOAP_IO_CHUNK; - soap->omode |= SOAP_IO_BUFFER; - } - if (soap_response(soap, status) || 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)) - { if (soap->error != 202) - return soap_closesock(soap); - soap->error = SOAP_OK; - } - return SOAP_OK; -} -#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 - } - return "Operation interrupted or timed out"; -} -#endif -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_set_error(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail, int soaperror) -{ *soap_faultcode(soap) = faultcode; - if (faultsubcode) - *soap_faultsubcode(soap) = faultsubcode; - *soap_faultstring(soap) = faultstring; - if (faultdetail && *faultdetail) - { register const char **s = soap_faultdetail(soap); - if (s) - *s = faultdetail; - } - 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 *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_set_receiver_error(struct soap *soap, const char *faultstring, const char *faultdetail, int soaperror) -{ return soap_set_error(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", NULL, faultstring, faultdetail, soaperror); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -static int -soap_copy_fault(struct soap *soap, const char *faultcode, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ char *r = NULL, *s = NULL, *t = NULL; - if (faultsubcode) - r = soap_strdup(soap, faultsubcode); - if (faultstring) - s = soap_strdup(soap, faultstring); - if (faultdetail) - t = soap_strdup(soap, faultdetail); - 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 *faultdetail) -{ return soap_sender_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_sender_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Sender" : "SOAP-ENV:Client", faultsubcode, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault(struct soap *soap, const char *faultstring, const char *faultdetail) -{ return soap_receiver_fault_subcode(soap, NULL, faultstring, faultdetail); -} -#endif - -/******************************************************************************/ -#ifndef PALM_2 -SOAP_FMAC1 -int -SOAP_FMAC2 -soap_receiver_fault_subcode(struct soap *soap, const char *faultsubcode, const char *faultstring, const char *faultdetail) -{ return soap_copy_fault(soap, soap->version == 2 ? "SOAP-ENV:Receiver" : "SOAP-ENV:Server", faultsubcode, faultstring, faultdetail); -} -#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 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 - -/******************************************************************************/ -#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 -#ifndef WITH_LEAN -soap::soap() -{ soap_init(this); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::soap(soap_mode m) -{ soap_init1(this, m); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::soap(soap_mode im, soap_mode om) -{ soap_init2(this, im, om); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::soap(struct soap& soap) -{ soap_copy_context(this, &soap); -} -#endif -#endif - -/******************************************************************************/ -#ifdef __cplusplus -#ifndef WITH_LEAN -soap::~soap() -{ soap_destroy(this); - soap_end(this); - soap_done(this); -} -#endif -#endif - -/******************************************************************************/ diff --git a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.h b/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.h deleted file mode 100644 index 44efa13..0000000 --- a/org.glite.security.gsoap-plugin/src/stdsoap2_2.7.9d.h +++ /dev/null @@ -1,2184 +0,0 @@ -/* - -stdsoap2.h 2.7.9d - -gSOAP runtime - -gSOAP XML Web services tools -Copyright (C) 2000-2007, 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. --------------------------------------------------------------------------------- -Contributors: - -Wind River Systems, Inc., for the following additions (marked WR[...]): - - 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-2007, 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 --------------------------------------------------------------------------------- -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(__alpha) && !defined(__VMS) -# ifndef TRU64 -# define TRU64 -# endif -#endif - -#ifdef __MVS__ -# ifndef OS390 -# define OS390 -# endif -#endif - -#ifdef HAVE_CONFIG_H -# include "config.h" -# ifdef WITH_OPENSSL -# ifndef HAVE_OPENSSL_SSL_H -# undef WITH_OPENSSL -# 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_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(_AIXVERSION_431) -# 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(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_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_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_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) -# define HAVE_STRRCHR -# define HAVE_STRTOD -# define HAVE_SSCANF -# define HAVE_STRTOL -# define HAVE_STRTOUL -# define HAVE_PGMTIME_R -# define HAVE_PLOCALTIME_R -# 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 - -#ifndef WITH_NOSTDLIB -# include -# ifndef PALM -# include -# include -# endif -# include -# include -#endif - -#if defined(__cplusplus) && !defined(WITH_LEAN) -# include -# include -#endif - -#ifdef WITH_NOHTTP -# ifndef WITH_NOIO -# define WITH_NOIO -# undef WITH_COOKIES -# endif -#endif - -#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 -# endif -# ifndef VXWORKS -# 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 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 - -#ifdef WIN32 -# ifndef UNDER_CE -# include -# include -# endif -# include -/* # include */ /* Alternative: use winsock2 (not available with eVC) */ -# ifdef WITH_IPV6 -# include -# include -# endif -#else -# ifdef VXWORKS -# include -# include -# include -# endif -# ifndef WITH_NOIO -# ifndef PALM -# include -# include -# include -# include -# endif -# endif -#endif - -/* Portability: define SOAP_SOCKLEN_T */ -#if defined(_AIX) -# define SOAP_SOCKLEN_T socklen_t -#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) -# 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 (-1) -#define soap_valid_socket(n) ((n) != SOAP_INVALID_SOCKET) - -#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(__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 -#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 -# ifdef WITH_UDP -# define SOAP_BUFLEN (65536) /* max UDP packet size */ -# else -# ifndef WITH_LEAN -# define SOAP_BUFLEN (65536) /* buffer length for socket packets, also used by gethostbyname_r so don't make this too small */ -# else -# define SOAP_BUFLEN (2048) -# endif -# 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 - -#ifndef SOAP_MAXKEEPALIVE -# define SOAP_MAXKEEPALIVE (100) /* max iterations to keep server connection alive */ -#endif - -#ifndef SOAP_MAXARRAYSIZE -# define SOAP_MAXARRAYSIZE (100000) /* "trusted" max size of inbound SOAP array for compound array allocation */ -#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_EOM 16 -#define SOAP_MOE 17 -#define SOAP_NULL 18 -#define SOAP_DUPLICATE_ID 19 -#define SOAP_MISSING_ID 20 -#define SOAP_HREF 21 -#define SOAP_UDP_ERROR 22 -#define SOAP_TCP_ERROR 23 -#define SOAP_HTTP_ERROR 24 -#define SOAP_SSL_ERROR 25 -#define SOAP_ZLIB_ERROR 26 -#define SOAP_DIME_ERROR 27 -#define SOAP_DIME_HREF 28 -#define SOAP_DIME_MISMATCH 29 -#define SOAP_DIME_END 30 -#define SOAP_MIME_ERROR 31 -#define SOAP_MIME_HREF 32 -#define SOAP_MIME_END 33 -#define SOAP_VERSIONMISMATCH 34 -#define SOAP_PLUGIN_ERROR 35 -#define SOAP_DATAENCODINGUNKNOWN 36 -#define SOAP_REQUIRED 37 -#define SOAP_PROHIBITED 38 -#define SOAP_OCCURS 39 -#define SOAP_LENGTH 40 -#define SOAP_FD_EXCEEDED 41 - -#define soap_xml_error_check(e) ((e) == SOAP_TAG_MISMATCH || (e) == SOAP_TAG_END || (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_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_RSA 0x08 /* use RSA */ -#define SOAP_SSLv3_TLSv1 0x00 /* SSL v3 and TLS v1 support by default */ -#define SOAP_SSLv3 0x10 /* SSL v3 only */ -#define SOAP_TLSv1 0x20 /* TLS v1 only */ - -#define SOAP_SSL_DEFAULT (SOAP_SSL_REQUIRE_SERVER_AUTHENTICATION | SOAP_SSLv3_TLSv1) - -/* state */ - -#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 DGBFUN -# 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 content == iter.content; } - bool operator!=(const soap_multipart_iterator& iter) const - { return 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) -} -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 */ - 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 (*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); - int (*fopen)(struct soap*, const char*, const char*, int); - int (*faccept)(struct soap*, int, 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 - int master; - int socket; -#if defined(__cplusplus) && !defined(WITH_LEAN) - std::ostream *os; - std::istream *is; -#else - void *os; /* preserve alignment */ - void *is; /* preserve alignment */ -#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/output buffer for messages >=1024 bytes */ - char tmpbuf[1024]; /* in/output buffer for HTTP/MIME headers, simpleType values, attribute 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 keep_alive; /* connection should be kept open */ - 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 */ - unsigned int max_keep_alive; - 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 */ - 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 -#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; - 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; - SSL_SESSION *session; - char session_host[SOAP_TAGLEN]; - int session_port; -#endif -#ifdef WITH_ZLIB - 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 */ - z_stream d_stream; /* decompression stream */ - char z_buf[SOAP_BUFLEN]; /* buffer */ - size_t z_buflen; - unsigned short z_level; /* compression level to be used (0=none, 1=fast to 9=best) */ - uLong z_crc; /* internal gzip crc */ - 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 */ -#endif -#ifdef WMW_RPM_IO - void *rpmreqid; -#endif -#ifndef WITH_LEAN -#ifdef __cplusplus - soap(); - soap(soap_mode); - soap(soap_mode, soap_mode); - soap(struct soap&); - ~soap(); -#endif -#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_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(void); -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 int SOAP_FMAC2 soap_bind(struct soap*, const char*, int, int); -SOAP_FMAC1 int 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(struct soap*); -SOAP_FMAC1 struct soap *SOAP_FMAC2 soap_copy_context(struct soap*, 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 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*, int n1, int 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 int SOAP_FMAC2 soap_new_block(struct soap*); -SOAP_FMAC1 void* SOAP_FMAC2 soap_push_block(struct soap*, size_t); -SOAP_FMAC1 void SOAP_FMAC2 soap_pop_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_size_block(struct soap*, size_t); -SOAP_FMAC1 char* SOAP_FMAC2 soap_first_block(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_next_block(struct soap*); -SOAP_FMAC1 size_t SOAP_FMAC2 soap_block_size(struct soap*); -SOAP_FMAC1 char* SOAP_FMAC2 soap_save_block(struct soap*, char*, int); -SOAP_FMAC1 void SOAP_FMAC2 soap_end_block(struct soap*); - -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*); -#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); -#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*, struct soap*); -SOAP_FMAC1 extern void SOAP_FMAC2 soap_free_cookies(struct soap*); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp b/org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp deleted file mode 100644 index 27593ae..0000000 --- a/org.glite.security.gsoap-plugin/test/test_gsplugin_cxx.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include - -#include "stdsoap2.h" -#include "glite_gsplugin.h" - -#define TEST_STR "123456789ABCDEF" - -int main() { - struct soap *mydlo = NULL; - glite_gsplugin_Context gsplugin_ctx = NULL; - int ok1, ok2; - - // test 1 - stdsoap2.c compatibility - if ((mydlo = soap_new()) == NULL) { - std::cerr << "Couldn't create soap" << std::endl; - return 1; - } - soap_set_endpoint(mydlo, TEST_STR); - std::cout << mydlo->endpoint << std::endl; - ok1 = strcmp(mydlo->endpoint, TEST_STR); - - // test 2 - glite_gsplugin.c compatibility - // - // not real test, just may crash in bad test case on calling - // soap->fdelete where will be other function - if ( glite_gsplugin_init_context(&gsplugin_ctx) ) { - std::cerr << "Couldn't create gSOAP plugin context" << std::endl; - goto err; - } - if (soap_register_plugin_arg(mydlo, glite_gsplugin, gsplugin_ctx)) { - std::cerr << "Couldn't register gSoap plugin" << std::endl; - goto err; - } - - soap_done(mydlo); - free(mydlo); - glite_gsplugin_free_context(gsplugin_ctx); - return ok1 && ok2; - -err: - if (gsplugin_ctx) glite_gsplugin_free_context(gsplugin_ctx); - if (mydlo) soap_destroy(mydlo); - return 1; -} - -Namespace namespaces[] = {{NULL, NULL, NULL, NULL}}; diff --git a/org.glite.security.gss/LICENSE b/org.glite.security.gss/LICENSE deleted file mode 100644 index 259a91f..0000000 --- a/org.glite.security.gss/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.security.gss/Makefile b/org.glite.security.gss/Makefile deleted file mode 100644 index 612b573..0000000 --- a/org.glite.security.gss/Makefile +++ /dev/null @@ -1,170 +0,0 @@ -# defaults -top_srcdir=.. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -globalprefix=glite -package=gss -version=1.0.0 -PREFIX=/opt/glite - -glite_location=/opt/glite -globus_prefix=/opt/globus -cppunit_prefix=/opt/cppunit - -CC=gcc - --include Makefile.inc --include ../project/version.properties - -version=${module.version} - -# In order to use libtool versioning correcty, we must have: -# -# current = major + minor + offset -# revision = patch -# age = minor -# -# where offset is a sum of maximal released minor's of all previous major's -# - -# counted minors: gsoap-plugin 1.5 -# TODO: bump offset to 5 on next major change -offset=-1 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -VPATH=${top_srcdir}/src:${top_srcdir}/test - -default: all - -DEBUG:=-g -O0 -W -Wall -Wno-unused-parameter -# not for globus, gsoap: -Werror - -CFLAGS:= ${CFLAGS} ${DEBUG} \ - -DVERSION=\"${version}\" \ - -I. -I${top_srcdir}/interface \ - -I${stagedir}/include \ - ${COVERAGE_FLAGS} -D_GNU_SOURCE -DDATAGRID_EXTENSION - -LDFLAGS:=${LDFLAGS} ${COVERAGE_FLAGS} - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} -rpath ${stagedir}/${libdir} ${LDFLAGS} -LINKXX:=libtool --mode=link ${CXX} -rpath ${stagedir}/${libdir} ${LDFLAGS} -INSTALL:=libtool --mode=install install - -CPPUNIT_LIBS?=-L${cppunit_prefix}/${libdir} -lcppunit -CPPUNIT_CFLAGS?=-I${cppunit_prefix}/include - -GLOBUS_NOTHR_INC:= -I${globus_prefix}/include/${nothrflavour} -GLOBUS_THR_INC:= -I${globus_prefix}/include/${thrflavour} - -GLOBUS_NOTHR_LIBS:= -L${globus_prefix}/lib \ - -lglobus_common_${nothrflavour} \ - -lglobus_gssapi_gsi_${nothrflavour} -GLOBUS_THR_LIBS:= -L${globus_prefix}/lib \ - -lglobus_common_${thrflavour} \ - -lglobus_gssapi_gsi_${thrflavour} - -GLOBUS_GSSAPI_GSI_LIBS?=${GLOBUS_NOTHR_LIBS} -GLOBUS_GSSAPI_GSI_CFLAGS?=${GLOBUS_NOTHR_INC} - -LIBCARES_CFLAGS?=-I${cares_prefix}/include -LIBCARES_LIBS?=-L${cares_prefix}/${libdir} -L${cares_prefix}/lib -lcares - -HDRS:=glite_gss.h - -GSS_OBJS:=glite_gss.o -GSS_LOBJS:=${GSS_OBJS:.o=.lo} -GSS_THROBJS:=${GSS_OBJS:.o=.thr.o} -GSS_THRLOBJS:=${GSS_OBJS:.o=.thr.lo} - -GSS_NOTHRSTATICLIB:=libglite_security_gss_${nothrflavour}.a -GSS_THRSTATICLIB:=libglite_security_gss_${thrflavour}.a -GSS_STATICLIB:=libglite_security_gss.a -GSS_NOTHRLTLIB:=libglite_security_gss_${nothrflavour}.la -GSS_THRLTLIB:=libglite_security_gss_${thrflavour}.la -GSS_LTLIB:=libglite_security_gss.la - -ifeq ($(thrflavour),) -lib_LTLIBRARIES=${GSS_LTLIB} -lib_LIBRARIES=${GSS_STATICLIB} -default_gss=${GSS_LTLIB} -else -lib_LTLIBRARIES=${GSS_NOTHRLTLIB} ${GSS_THRLTLIB} -lib_LIBRARIES=${GSS_NOTHRSTATICLIB} ${GSS_THRSTATICLIB} -default_gss=${GSS_NOTHRLTLIB} -endif - - -ifeq ($(thrflavour),) -${GSS_STATICLIB}: ${GSS_OBJS} - ar crv $@ ${GSS_OBJS} - ranlib $@ - -${GSS_LTLIB}: ${GSS_OBJS} - ${LINK} ${version_info} -o $@ ${GSS_LOBJS} ${GLOBUS_GSSAPI_GSI_LIBS} ${LIBCARES_LIBS} -else -${GSS_NOTHRSTATICLIB}: ${GSS_OBJS} - ar crv $@ ${GSS_OBJS} - ranlib $@ - -${GSS_THRSTATICLIB}: ${GSS_THROBJS} - ar crv $@ ${GSS_THROBJS} - ranlib $@ - -${GSS_NOTHRLTLIB}: ${GSS_OBJS} - ${LINK} ${version_info} -o $@ ${GSS_LOBJS} ${GLOBUS_NOTHR_LIBS} ${LIBCARES_LIBS} - -${GSS_THRLTLIB}: ${GSS_THROBJS} - ${LINK} ${version_info} -o $@ ${GSS_THRLOBJS} ${GLOBUS_THR_LIBS} ${LIBCARES_LIBS} -endif - - -all compile: $(lib_LTLIBRARIES) ${lib_LIBRARIES} examples - -check: compile check.gss - -check.gss: test_gss - # ./test_gss out.xml - echo test_gss not run automatically util we have got some credentials in X509_USER_PROXY - -test_gss: test_gss.o - ${LINKXX} -o $@ test_gss.o ${default_gss} ${CPPUNIT_LIBS} ${GLOBUS_GSSAPI_GSI_LIBS} ${LIBCARES_LIBS} - -test_coverage: - -mkdir coverage - cd coverage && $(MAKE) -f ../Makefile top_srcdir=../../ COVERAGE_FLAGS="-fprofile-arcs -ftest-coverage" check - cd coverage && for i in ${OBJS}; do gcov -o .libs/ $$i ; done - -examples: - -doc: - -stage: - $(MAKE) install PREFIX=${stagedir} DOSTAGE=yes - -install: - -mkdir -p ${PREFIX}/${libdir} - -mkdir -p ${PREFIX}/share/doc/${package}-${version} - -mkdir -p ${PREFIX}/include/glite/security - ${INSTALL} -m 755 ${lib_LTLIBRARIES} ${PREFIX}/${libdir} - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - cd ${top_srcdir}/interface && ${INSTALL} -m 644 ${HDRS} ${PREFIX}/include/glite/security/ - if [ x${DOSTAGE} = xyes ]; then \ - install -m 644 ${lib_LIBRARIES} ${PREFIX}/${libdir}; \ - fi - -clean: - rm -rf *.o *.lo *.a *.la .libs test_gss - rm -rvf log.xml project/ rpmbuild/ RPMS/ tgz/ debian/ - -%.o: %.c - ${COMPILE} ${GLOBUS_GSSAPI_GSI_CFLAGS} ${LIBCARES_CFLAGS} -o $@ -c $< - -%.thr.o: %.c - ${COMPILE} ${GLOBUS_THR_INC} ${LIBCARES_CFLAGS} -o $@ -c $< - -test_gss.o: %.o: %.cpp - ${CXX} -c ${CFLAGS} ${GLOBUS_GSSAPI_GSI_CFLAGS} ${CPPUNIT_CFLAGS} -Wno-error $< diff --git a/org.glite.security.gss/configure b/org.glite.security.gss/configure deleted file mode 100755 index dba8bf2..0000000 --- a/org.glite.security.gss/configure +++ /dev/null @@ -1,975 +0,0 @@ -#!/usr/bin/perl - -# WARNING: Don't edit this file unless it is the master copy in org.glite.lb -# -# For the purpose of standalone builds of lb/jobid/lbjp-common components -# it is copied on tagging - -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Getopt::Long; - -my $pwd = `pwd`; chomp $pwd; -my $prefix = $pwd.'/stage'; -my $stagedir; -my $staged; -my $module; -my $thrflavour = 'gcc64dbgpthr'; -my $nothrflavour = 'gcc64dbg'; -my $mode = 'build'; -my $help = 0; -my $listmodules; -my $version; -my $branch; -my $output; -my $lb_tag = ''; -my $lbjp_tag = ''; -my $jp_tag = ''; -my $sec_tag = ''; -my $jobid_tag = ''; -my $libdir = getlibdir(); - -my @nodes = qw/client server logger utils client-java doc ws-test db jpprimary jpindex jpclient harvester/; -my %enable_nodes; -my %disable_nodes; - -my %extern_prefix = ( - cares => '/opt/c-ares', - classads => '/opt/classads', - cppunit => '/usr', - expat => '/usr', - globus => '/opt/globus', - myproxy => '/opt/myproxy', - gsoap => '/usr', - mysql => '/usr', - 'mysql-devel' => '', - 'mysql-server' => '', - voms => '/opt/glite', - gridsite => '/opt/glite', - lcas => '/opt/glite', - trustmanager => '/opt/glite', - utiljava => '/opt/glite', - ant => '/usr', - jdk => '/usr', - libtar => '/usr', - axis => '/usr', - log4c => '/usr', - postgresql => '/usr' -); - -my %jar = ( - 'jakarta-commons-codec' => '/usr/share/java/commons-codec.jar', - 'jakarta-commons-lang' => '/usr/share/java/commons-lang.jar', -); - - -my %glite_prefix; -my %need_externs; -my %need_externs_type; -my %need_jars; -my %extrafull; -my %extranodmod; -my %deps; -my %deps_type; -my %buildroot; - -my %lbmodules = ( - 'lb' => [ qw/client client-java common doc logger server state-machine types utils ws-interface ws-test harvester yaim glite-LB/], - 'security' => [qw/gss gsoap-plugin/], - 'lbjp-common' => [qw/db log maildir server-bones trio jp-interface/], - 'jobid' => [qw/api-c api-cpp api-java/], - 'jp' => [ qw/client doc index primary server-common ws-interface/ ], - 'gridsite' => [ qw/apache shared commands core/ ], - 'px' => [ qw/proxyrenewal glite-PX myproxy-yaim/ ], - ); - - -my @opts = ( - 'prefix=s' => \$prefix, - 'staged=s' => \$staged, - 'module=s' => \$module, - 'thrflavour:s' => \$thrflavour, - 'nothrflavour:s' => \$nothrflavour, - 'mode=s' => \$mode, - 'listmodules=s' => \$listmodules, - 'version=s' => \$version, - 'branch=s' => \$branch, - 'output=s' => \$output, - 'stage=s' => \$stagedir, - 'lb-tag=s' => \$lb_tag, - 'lbjp-common-tag=s' => \$lbjp_tag, - 'jp-tag=s' => \$jp_tag, - 'security-tag=s' => \$sec_tag, - 'jobid-tag=s' => \$jobid_tag, - 'help' => \$help, - 'libdir=s' => \$libdir, - 'emi' => \$emi, -); - -for (@nodes) { - $enable_nodes{$_} = 0; - $disable_nodes{$_} = 0; - - push @opts,"disable-$_",\$disable_nodes{$_}; - push @opts,"enable-$_",\$enable_nodes{$_}; -} - -push @opts,"with-$_=s",\$extern_prefix{$_} for keys %extern_prefix; -push @opts,"with-$_=s",\$jar{$_} for keys %jar; - -my @keeparg = @ARGV; - -GetOptions @opts or die "Errors parsing command line\n"; - -$extern_prefix{'mysql-devel'}=$extern_prefix{mysql} if $extern_prefix{'mysql-devel'} eq ''; -$extern_prefix{'mysql-server'}=$extern_prefix{mysql} if $extern_prefix{'mysql-server'} eq ''; - -if ($help) { usage(); exit 0; } - -if ($listmodules) { - my @m = map "org.glite.$listmodules.$_",@{$lbmodules{$listmodules}}; - print "@m\n"; - exit 0; -} - -warn "$0: --version, --branch and --output make sense only in --mode=etics\n" - if ($version || $output || $branch) && $mode ne 'etics'; - -my $en; -for (keys %enable_nodes) { $en = 1 if $enable_nodes{$_}; } - -my $dis; -for (keys %disable_nodes) { $dis = 1 if $disable_nodes{$_}; } - -die "--enable-* and --disable-* are mutually exclusive\n" - if $en && $dis; - -die "--module cannot be used with --enable-* or --disable-*\n" - if $module && ($en || $dis); - -die "$module: unknown module\n" if $module && ! grep $module,@{$lbmodules{lb}},@{$lbmodules{security}},{$lbmodules{jp}}; - -if ($dis) { - for (@nodes) { - $enable_nodes{$_} = 1 unless $disable_nodes{$_}; - } -} - -if (!$en && !$dis) { $enable_nodes{$_} = 1 for (@nodes) } ; - -for (keys %enable_nodes) { delete $enable_nodes{$_} unless $enable_nodes{$_}; } - -$stagedir = $prefix unless $stagedir; - -if ($mode eq 'build') { - print "Writing config.status\n"; - open CONF,">config.status" or die "config.status: $!\n"; - print CONF "$0 @keeparg\n"; - close CONF; -} - - -my @modules; -my %aux; - -if ($module) { -# push @modules,split(/[,.]+/,$module); - push @modules,$module; -} -else { - @modules = map(($extranodmod{$_} ? $extranodmod{$_} : 'lb.'.$_),(keys %enable_nodes)); - - my $n; - - do { - local $"="\n"; - $n = $#modules; - push @modules,(map @{$deps{$_}},@modules); - - undef %aux; @aux{@modules} = (1) x ($#modules+1); - @modules = keys %aux; - } while ($#modules > $n); -} - -@aux{@modules} = (1) x ($#modules+1); -delete $aux{$_} for (split /,/,$staged); -@modules = keys %aux; - -mode_build() if $mode eq 'build'; -mode_checkout() if $mode eq 'checkout'; -mode_etics($module) if $mode eq 'etics'; - -sub mode_build { - print "\nBuilding modules: @modules\n"; - - my @ext = map @{$need_externs{$_}},@modules; - my @myjars = map @{$need_jars{$_}},@modules; - undef %aux; @aux{@ext} = 1; - @ext = keys %aux; - undef %aux; @aux{@myjars} = (1) x ($#myjars+1); - @myjars = keys %aux; - - print "\nRequired externals:\n"; - print "\t$_: $extern_prefix{$_}\n" for @ext; - print "\t$_: $jar{$_}\n" for @myjars; - print "\nThis is a poor-man configure, it's up to you to have sources and externals there\n\n"; - - mkinc($_) for @modules; - - print "Creating Makefile\n"; - - open MAK,">Makefile" or die "Makefile: $!\n"; - - print MAK "all: @modules\n\nclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK "\tcd $full/$buildroot{$_} && \${MAKE} clean\n" - } - - print MAK "\ndistclean:\n"; - - for (@modules) { - my $full = full($_); - print MAK $buildroot{$_} eq '' ? - "\tcd $full && \${MAKE} distclean\n" : - "\trm -rf $full/$buildroot{$_}\n" - } - - print MAK "\n"; - - for (@modules) { - my %ldeps; undef %ldeps; - @ldeps{@{$deps{$_}}} = 1; - for my $x (split /,/,$staged) { delete $ldeps{$x}; } - my @dnames = $module ? () : keys %ldeps; - - my $full = full($_); - my $build = $buildroot{$_}; - - print MAK "$_: @dnames\n\tcd $full/$build && \${MAKE} && \${MAKE} install\n\n"; - } - - close MAK; -} - -sub mode_checkout() { - for (@modules) { - my $module = $_; - my $tag = ""; - if ($lb_tag){ - for (@{$lbmodules{lb}}){ - if ("lb.".$_ eq $module){ - $tag = '-r '.$lb_tag; - } - } - } - if ($lbjp_tag){ - for (@{$lbmodules{'lbjp-common'}}){ - if ("lbjp-common.".$_ eq $module){ - $tag = '-r '.$lbjp_tag; - } - } - } - if ($jp_tag){ - for (@{$lbmodules{'jp'}}){ - if ("jp.".$_ eq $module){ - $tag = '-r '.$jp_tag; - } - } - } - if ($sec_tag){ - for (@{$lbmodules{security}}){ - if ("security.".$_ eq $module){ - $tag = '-r '.$sec_tag; - } - } - } - if ($jobid_tag){ - for (@{$lbmodules{jobid}}){ - if ("jobid.".$_ eq $module){ - $tag = '-r '.$jobid_tag; - } - } - } - #if (grep {"lb.".$_ eq $module} @{$lbmodules{lb}}){ - # print "found"; - #} - $_ = full($_); - print "\n*** Checking out $_\n"; - system("cvs checkout $tag $_") == 0 or die "cvs checkout $tag $_: $?\n"; - } -} - -BEGIN{ -%need_externs_aux = ( - 'lb.client' => [ qw/cppunit:B classads/ ], - 'lb.client-java' => [ qw/ant:B jdk:B axis:B trustmanager utiljava/ ], - 'lb.common' => [ qw/expat cares:B cppunit:B classads/ ], - 'lb.doc' => [], - 'lb.logger' => [ qw/cppunit:B/ ], - 'lb.server' => [ qw/globus_essentials:R globus:B expat cares mysql:R mysql-server:R mysql-devel:B cppunit:B gsoap:B classads voms lcas gridsite/ ], - 'lb.state-machine' => [ qw/classads/ ], - 'lb.utils' => [ qw/cppunit:B/ ], - 'lb.ws-interface' => [], - 'lb.ws-test' => [ qw/gsoap:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw// ], - 'lb.yaim' => [ qw/yaim_core:R/ ], - 'lb.glite-LB' => [ qw/fetchcrl:R gpt:R gip_release:R gip_service:R bdii:R glite_version:R glite_info_templates:R glue_schema:R/ ], - 'lbjp-common.db' => [ qw/mysql:B mysql-devel:B postgresql:B cppunit:B log4c:B/ ], - 'lbjp-common.log' => [ qw/log4c/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.server-bones' => [ qw// ], - 'lbjp-common.trio' => [ qw/cppunit:B/ ], - 'lbjp-common.jp-interface' => [ qw/cppunit:B log4c:B/ ], - 'security.gss' => [ qw/globus_essentials:R globus:B cares cppunit:B/ ], - 'security.gsoap-plugin' => [ qw/cppunit:B globus_essentials:R globus:B cares:B gsoap:B/ ], - 'jobid.api-c' => [ qw/cppunit:B/ ], - 'jobid.api-cpp' => [ qw/cppunit:B/ ], - 'jobid.api-java' => [ qw/ant:B jdk:B/ ], - 'jp.client' => [ qw/gsoap libtar globus_essentials:R globus:B/ ], - 'jp.doc' => [], - 'jp.index' => [ qw/gsoap globus_essentials:R globus:B/ ], - 'jp.primary' => [ qw/classads gsoap libtar globus_essentials:R globus:B/ ], - 'jp.server-common' => [], - 'jp.ws-interface' => [], - 'gridsite.core' => [qw/httpd-devel:B gsoap:B globus:B/ ], - 'px.proxyrenewal' => [ qw/globus:B myproxy voms/ ], - 'px.glite-PX' => [qw/myproxy:R/], - 'px.myproxy-yaim' => [ qw/yaim_core:R/ ], -); - -for my $ext (keys %need_externs_aux) { - for (@{$need_externs_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$need_externs{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $need_externs_type{$ext}->{$1} = $type; - } -} - -%need_jars = ( - 'jobid.api-java' => [ qw/jakarta-commons-codec/ ], - 'lb.client-java' => [ qw/jakarta-commons-lang/ ], -); - -for my $jar (keys %need_jars) { - for (@{$need_jars{$jar}}) { - $need_externs_type{$jar}->{$_} = 'BR'; # XXX - } -} - -%deps_aux = ( - 'lb.client' => [ qw/ - lb.types:B lb.common - lbjp-common.trio - jobid.api-cpp:B jobid.api-c - security.gss - / ], - 'lb.client-java' => [ qw/ - lb.types:B - lb.ws-interface:B - jobid.api-java - / ], - 'lb.common' => [ qw/ - jobid.api-cpp:B jobid.api-c - lb.types:B lbjp-common.trio security.gss - / ], - 'lb.doc' => [ qw/lb.types:B/ ], - 'lb.logger' => [ qw/ - lbjp-common.trio - lbjp-common.log - jobid.api-c - lb.common - security.gss - / ], - 'lb.server' => [ qw/ - lb.ws-interface lb.types:B lb.common lb.state-machine - lbjp-common.db lbjp-common.server-bones lbjp-common.trio lbjp-common.maildir lbjp-common.log - jobid.api-c - security.gsoap-plugin security.gss - / ], - 'lb.state-machine' => [ qw/lb.types:B lb.common lbjp-common.jp-interface security.gss/ ], - 'lb.utils' => [ qw/ - lbjp-common.jp-interface - jobid.api-c - lbjp-common.trio lbjp-common.maildir - lb.client lb.state-machine - / ], - 'lb.ws-test' => [ qw/security.gsoap-plugin lb.ws-interface/ ], - 'lb.ws-interface' => [ qw/lb.types:B/ ], - 'lb.types' => [ qw// ], - 'lb.harvester' => [ qw/ - jobid.api-c lbjp-common.trio lbjp-common.db lb.common lb.client - security.gss lbjp-common.log - / ], - 'lb.yaim' => [ qw// ], - 'lb.glite-LB' => [ qw/ - lb.logger:R lb.server:R lb.utils:R lb.doc:R - lb.ws-test:R lb.harvester:R lb.yaim:R lb.client-java:R - / ], - 'lbjp-common.db' => [ qw/lbjp-common.trio lbjp-common.log/ ], - 'lbjp-common.maildir' => [ qw// ], - 'lbjp-common.log' => [ qw// ], - 'lbjp-common.server-bones' => [ qw/lbjp-common.log/ ], - 'lbjp-common.trio' => [ qw// ], - 'security.gss' => [ qw// ], - 'security.gsoap-plugin' => [ qw/security.gss/ ], - 'jobid.api-c' => [ qw// ], - 'jobid.api-cpp' => [ qw/jobid.api-c/ ], - 'jobid.api-java' => [ qw// ], - - 'lbjp-common.jp-interface' => [ qw/lbjp-common.db jobid.api-c/ ], - - 'jp.client' => [ qw/ - jp.ws-interface - lbjp-common.jp-interface lbjp-common.maildir - jobid.api-c - security.gsoap-plugin - / ], - 'jp.doc' => [ qw// ], - 'jp.index' => [ qw/ - jp.server-common jp.ws-interface - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.primary' => [ qw/ - jobid.api-c - jp.server-common jp.ws-interface - lb.state-machine - lbjp-common.jp-interface lbjp-common.trio lbjp-common.db lbjp-common.server-bones - security.gsoap-plugin - / ], - 'jp.server-common' => [ qw/ - lbjp-common.jp-interface lbjp-common.db - / ], - 'jp.ws-interface' => [ qw// ], - - 'gridsite.core' => [ qw/build.common-cpp:B/ ], - - 'px.proxyrenewal' => [ qw// ], - 'px.glite-PX' => [qw/px.myproxy-yaim:R/], - 'px.myproxy-yaim' => [], -); - -for my $ext (keys %deps_aux) { - for (@{$deps_aux{$ext}}) { - /([^:]*)(?::(.*))?/; - push @{$deps{$ext}},$1; - my $type = $2 ? $2 : 'BR'; - $deps_type{$ext}->{$1} = $type; - } -} - - -%extrafull = ( gridsite=>'org.gridsite.core'); - -#( java => 'client-java' ); -%extranodmod = ( - db => 'lbjp-common.db', - jpprimary => 'jp.primary', - jpindex => 'jp.index', - jpclient => 'jp.client', -); - -%obsoletes = ( - 'lb.yaim' => [ qq/glite-yaim-lb/ ], - 'px.proxyrenewal' => [ qq/glite-security-proxyrenewal/ ], - 'px.myproxy-yaim' => [ qq/glite-yaim-myproxy/ ], -); - -%cvs_prefix = ( - 'lb' => 'org.glite', - 'jp' => 'org.glite', - 'jobid' => 'org.glite', - 'lbjp-common' => 'org.glite', - 'gridsite' => 'org', - 'security' => 'org.glite', - 'px' => 'org.glite', -); - -%conf_prefix = ( - 'lb' => 'glite-', - 'jp' => 'glite-', - 'jobid' => 'glite-', - 'lbjp-common' => 'glite-', - 'gridsite' => '', - 'security' => 'glite-', - 'px' => 'glite-', -); - -%emi_conf_prefix = ( - 'lb' => 'emi-', - 'jp' => 'emi-', - 'jobid' => 'emi-', - 'lbjp-common' => 'emi-', - 'gridsite' => '', - 'security' => 'emi-', - 'px' => 'emi-', -); - -my @k = keys %deps_aux; -@buildroot{@k} = ('build') x ($#k+1); - -my @t = qw/lb.client-java jobid.api-java lb.types/; -@buildroot{@t} = ('') x ($#t+1); - -$buildroot{'gridsite.core'} = 'src'; -} - -sub full -{ - my $short = shift; - return $extrafull{$short} ? $extrafull{$short} : 'org.glite.'.$short; -} - -sub mkinc -{ - my %aux; - undef %aux; - my @m=qw/ -lb.client lb.doc lb.state-machine lb.ws-interface lb.logger lb.types lb.common lb.server lb.utils lb.ws-test lb.client-java lb.harvester lb.yaim lb.glite-LB -security.gss security.gsoap-plugin -jobid.api-c jobid.api-cpp jobid.api-java -lbjp-common.db lbjp-common.log lbjp-common.maildir lbjp-common.server-bones lbjp-common.trio lbjp-common.jp-interface -jp.client jp.doc jp.index jp.primary jp.server-common jp.ws-interface -px.proxyrenewal px.myproxy-yaim px.glite-PX -/; - @aux{@m} = (1) x ($#m+1); - - my $short = shift; - my $full = full $short; - - unless ($aux{$short}) { - print "Makefile.inc not needed in $full\n"; - return; - } - - my $build = ''; - - unless ($buildroot{$_} eq '') { - $build = "/$buildroot{$_}"; - unless (-d "$full/$buildroot{$_}") { - mkdir "$full/$buildroot{$_}" or die "mkdir $full/$buildroot{$_}: $!\n"; - } - unlink "$full/$buildroot{$_}/Makefile"; - symlink "../Makefile","$full/$buildroot{$_}/Makefile" or die "symlink ../Makefile $full/$buildroot{$_}/Makefile: $!\n"; - } - - open MKINC,">$full/$buildroot{$_}/Makefile.inc" - or die "$full/$buildroot{$_}/Makefile.inc: $!\n"; - - print "Creating $full/$buildroot{$_}/Makefile.inc\n"; - - print MKINC qq{ -PREFIX = $prefix -stagedir = $stagedir -thrflavour = $thrflavour -nothrflavour = $nothrflavour -libdir = $libdir -}; - - for (@{$need_externs{$short}}) { - print MKINC "${_}_prefix = $extern_prefix{$_}\n" - } - - for (@{$need_jars{$short}}) { - print MKINC "${_}_jar = $jar{$_}\n" - } - - my $need_gsoap = 0; - for (@{$need_externs{$short}}) { $need_gsoap = 1 if $_ eq 'gsoap'; } - - print MKINC "gsoap_default_version=".gsoap_version()."\n" if $need_gsoap; - - close MKINC; -} - -my %etics_externs; -my %etics_projects; -BEGIN{ - %etics_externs = ( - globus_essentials=>'vdt_globus_essentials', - globus=>'globus', - myproxy=>'myproxy', - cares=>'c-ares', - voms=>'org.glite.security.voms-api-cpp', - gridsite=>'org.gridsite.shared', - lcas=>'org.glite.security.lcas', - trustmanager=>'org.glite.security.trustmanager', - utiljava=>'org.glite.security.util-java', - gpt=>'gpt', - fetchcrl=>'fetch-crl', - gip_release=>'glite-info-provider-release', - gip_service=>'glite-info-provider-service', - bdii=>'bdii', - glite_version=>'glite-version', - glite_info_templates=>'glite-info-templates', - glue_schema=>'glue-schema', - yaim_core=>'org.glite.yaim.core', - ); - %etics_projects = ( - vdt=>[qw/globus globus_essentials myproxy/], - 'org.glite'=>[qw/voms gridsite lcas gpt gip_release gip_service bdii glite_version glite_info_templates glue_schema yaim_core/], - ); - - %platform_properties = ( - 'gridsite.core' => { - sl5_x86_64_gcc412 => { aprSuffix => '1' }, - sl5_ia32_gcc412 => { aprSuffix => '1' }, - deb5_x86_64_gcc432 => { aprSuffix => '1.0' }, - deb5_ia32_gcc432 => { aprSuffix => '1.0' }, - slc4_x86_64_gcc346 => { aprSuffix => '0' }, - slc4_ia32_gcc346 => { aprSuffix => '0' }, - default => { - } - }, - ); -}; - -sub mode_etics { - $fmod = shift; - - die "$0: --module required with --etics\n" unless $fmod; - - my ($subsys,$module) = split /\./,$fmod; - - my ($major,$minor,$rev,$age); - - if ($version) { - $version =~ /([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)-(.+)/; - ($major,$minor,$rev,$age) = ($1,$2,$3,$4); - } - else { - open V,"$cvs_prefix{$subsys}.$subsys.$module/project/version.properties" - or die "$cvs_prefix{$subsys}.$subsys.$module/project/version.properties: $!\n"; - - while ($_ = ) { - chomp; - ($major,$minor,$rev) = ($1,$2,$3) if /module\.version\s*=\s*([[:digit:]]+)\.([[:digit:]]+)\.([[:digit:]]+)/; - $age = $1 if /module\.age\s*=\s*([[:digit:]]+)/; - } - close V; - } - - my @copts = (); - my %ge; - @ge{@{$etics_projects{'org.glite'}}} = (1) x ($#{$etics_projects{'org.glite'}}+1); - - for (@{$need_externs{"$subsys.$module"}}) { - if ($need_externs_type{"$subsys.$module"}->{$_}=~/B/) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - push @copts,$ge{$_} ? "--with-$_=\${stageDir}" : "--with-$_=\${$eext.location}"; - } - } - - for (@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - push @copts,"--with-$_ \${$eext.location}$jar{$_}"; - } - - my $conf; - my $conftag; - my $confprefix; - - $dwpath = "path = \${projectName}/\${moduleName}/\${version}/\${platformName}/\${packageName}-\${version}-\${age}.tar.gz\n"; - - if ($emi) { $confprefix = $emi_conf_prefix{$subsys} } - else { $confprefix = $conf_prefix{$subsys} } - - if ($branch) { - $conf = "$confprefix${subsys}-${module}_$branch"; - $conftag = $branch; - # forced low age number - $age = $branch eq 'HEAD' ? '0head' : '0dev'; } - else { - $conf = "$confprefix$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; - -# XXX: gridsite hack - $conftag = $subsys eq 'gridsite' ? "$conf_prefix{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}" : - "$conf_prefix{$subsys}$subsys-${module}_R_${major}_${minor}_${rev}_${age}"; } - if ($emi) { - $age = "${age}emi"; - } - - my $file = $output ? $output : "$conf.ini"; - open C,">$file" or die "$file: $!\n"; - - my $buildroot = $buildroot{"$subsys.$module"} eq '' ? '#no build.root' : "build.root = " . $buildroot{"$subsys.$module"}; - - my $confdir = $buildroot{"$subsys.$module"} eq '' ? '..' : '../..'; - - my $package_description = ""; - my $package_summary = ""; - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.description") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.description"; - $package_description = join ("", ); - close V; - chomp $package_description; - $package_description =~ s/\n/\\n/g; - $package_description = "package.description = $package_description\n"; - } - else { - print STDERR "package.description not found for $subsys.$module!\n"; } - - if (-e "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary") { - open V, "$cvs_prefix{$subsys}.$subsys.$module/project/package.summary"; - $package_summary = join ("", ); - close V; - chomp $package_summary; - $package_summary =~ s/\n/\\n/g; - $package_summary = "package.summary = $package_summary\n"; - } - else { - print STDERR "package.summary not found for $subsys.$module!\n"; } - - my %cmd; - @cmd{qw/configure compile test install packaging clean/} = ('None') x 6; - $cmd{clean} = 'make clean'; - - if ($subsys eq 'gridsite') { - if ($module eq 'core') { - my $flags = 'RELEASE_VERSION=${age}.${platformFamily} prefix=${prefix} libdir=${libdir} GSOAPDIR=${gsoap.location} OPENSSL_GLOBUS_FLAGS=-I${globus.location}/include/${globus.dbg.nothr.flavor} OPENSSL_GLOBUS_LIBS=-L${globus.location}/${libdir}/ FLAVOR_GLOBUS_EXT=_${globus.dbg.nothr.flavor} HTTPD_FLAGS="-I${httpd-devel.location}/include/httpd -I${httpd-devel.location}/include/apache2 -I${httpd-devel.location}/include/apr-${aprSuffix} -I${httpd-devel.location}/include/pcre"'; - - $cmd{compile} = "make $flags build"; - $cmd{install} = "make $flags install"; - $cmd{packaging} = "make $flags rpm"; - } - else { - $cmd{packaging} = "echo building nothing, org.gridsite.core make rpm step will create this"; - } - } - else { - $cmd{configure} = "cd $confdir && /usr/bin/perl \${moduleName}/configure --thrflavour=\${globus.thr.flavor} --nothrflavour=\${globus.nothr.flavor} --prefix=\${prefix} --stage=\${stageDir} --libdir=\${libdir} --module $subsys.$module @copts"; - $cmd{compile} = 'make'; - $cmd{test} = 'make check'; - $cmd{install} = 'make install'; - } - - my $defprops = ''; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{default}}) { - $defprops .= $p . ' = ' . $platform_properties{"$subsys.$module"}->{default}->{$p} . "\n"; - } - - my $checkoutcmd; - if ($conftag eq 'HEAD') { - $checkoutcmd = "cvs -d \${vcsroot} co -A \${moduleName}"; - } else { - $checkoutcmd = "cvs -d \${vcsroot} co -r \${tag} \${moduleName}"; - } - - print STDERR "Writing $file\n"; - print C qq{ -[Configuration-$conf] -profile = None -moduleName = $cvs_prefix{$subsys}.$subsys.$module -displayName = $conf -description = $cvs_prefix{$subsys}.$subsys.$module -projectName = org.glite -age = $age -deploymentType = None -tag = $conftag -version = $major.$minor.$rev -$dwpath -[Platform-default:VcsCommand] -displayName = None -description = None -tag = cvs -d \${vcsroot} tag -R \${tag} \${moduleName} -branch = None -commit = None -checkout = $checkoutcmd - -[Platform-default:BuildCommand] -postpublish = None -packaging = $cmd{packaging} -displayName = None -description = None -doc = None -prepublish = None -publish = None -compile = $cmd{compile} -init = None -install = $cmd{install} -clean = $cmd{clean} -test = $cmd{test} -configure = $cmd{configure} -checkstyle = None - -[Platform-default:Property] -$buildroot -aprSuffix = 0 -package.RPMSLocation = \${moduleDir}/RPMTMP/RPMS -package.SRPMSLocation = \${moduleDir}/RPMTMP/SRPMS -package.preserve.libtool = false -$package_description$package_summary$defprops}; - - for (@{$obsoletes{"$subsys.$module"}}) { - print C "package.obsoletes = $_\n"; - print C "package.replaces = $_\n"; - } - - for my $pp (keys %{$platform_properties{"$subsys.$module"}}) { - next if $pp eq 'default'; - print C "[Platform-$pp:Property]\n$buildroot\n"; - - for my $p (keys %{$platform_properties{"$subsys.$module"}->{$pp}}) { - print C $p . ' = ' . $platform_properties{"$subsys.$module"}->{$pp}->{$p} . "\n"; - } - print C q{package.RPMSLocation = ${moduleDir}/RPMTMP/RPMS -package.SRPMSLocation = ${moduleDir}/RPMTMP/SRPMS -}; - print C "$package_description$package_summary\n"; - } - - print C qq{ -[Platform-default:DynamicDependency] -}; - for (@{$need_externs{"$subsys.$module"}},@{$need_jars{"$subsys.$module"}}) { - my $eext = $etics_externs{$_} ? $etics_externs{$_} : $_; - - my $proj = 'externals'; - for my $p (keys %etics_projects) { - for $m (@{$etics_projects{$p}}) { - $proj = $p if $m eq $_; - } - } - - my $type = $need_externs_type{"$subsys.$module"}->{$_}; - print C "$proj|$eext = $type\n"; - } - - for (@{$deps{"$subsys.$module"}}) { - my $type = $deps_type{"$subsys.$module"}->{$_}; - print C "org.glite|org.glite.$_ = $type\n"; - } - - close C; -} - -sub gsoap_version { - local $_; - my $gsoap_version; - open S,"$extern_prefix{gsoap}/bin/soapcpp2 -v 2>&1 |" or die "$extern_prefix{gsoap}/bin/soapcpp2: $!\n"; - - while ($_ = ) { - chomp; - - $gsoap_version = $1 if /The gSOAP Stub and Skeleton Compiler for C and C\+\+ ([.[:digit:][:alpha:]]+)$/; - } - close S; - return $gsoap_version; -} - -sub getlibdir { - if ( -e "/etc/debian_version") { # We are on Debian - $lib64="lib"; - $lib32="lib32"; } - else { # Another distribution - $lib64="lib64"; - $lib32="lib"; } - $libdir=$lib32; - - open INP, "uname -s | "; # Check kernel name - $kname= ; - chomp($kname); - close INP; - - if ( $kname == "Linux") { - $arch = ("x86_64\npowerpc\nppc64\n"); - - open INP, "uname -p | "; # Check processor type - $procname= ; - chomp($procname); - close INP; - - if ($arch =~/^$procname\n/) { - return ($lib64); } - - open INP, "uname -m | "; # Check machine hardware - $machname= ; - chomp($machname); - close INP; - - if ($arch =~/^$machname\n/) { - return ($lib64); } - - # special cases (hyperlink lib64, Debian) - if (-l "/usr/lib64") { - $libdir=$lib32; } - - # if /usr/lib64 doesn't exist at all (AIX) - unless ( -e "/usr/lib64" ) { - $libdir=$lib32; } - } - - if ( $kname == "SunOS") { - if (-e "/usr/lib/64") { - $libdir="lib/64"; } - } - - return $libdir; -} - -sub usage { - my @ext = keys %extern_prefix; - my @myjars, keys %jar; - - print STDERR qq{ -usage: $0 options - -General options (defaults in []): - --prefix=PREFIX destination directory [./stage] - --staged=module,module,... what is already in PREFIX (specify without org.glite.) - --thrflavour=flavour - --nothrflavour=flavour threaded and non-treaded flavours [gcc64dbgpthr,gcc64dbg] - --listmodules=subsys list modules of a subsystem - --version=maj.min.rev-age specify version here instead of reading version.properties - --branch=branch CVS branch/etics name suffix (HEAD, branch_2_1, ...) - --libdir=libdir typically [lib,lib64] postfix - --emi generate configurations with emi flavor in mode 'etics' - -Mode of operation: - --mode={checkout|build|etics} what to do [build] - -What to build: - --module=module build this module only (mostly in-Etics operation) - --enable-NODE build this "node" (set of modules) only. Available nodes are - @{$lbmodules{lb}},@{$lbmodules{security}} - --disable-NODE don't build this node - --lb-tag=tag checkout LB modules with specific tag - --jp-tag=tag checkout JP modules with specific tag - --lbjp-common-tag=tag checkout lbjp-common modules with specific tag - --security-tag=tag checkout security modules with specific tag - --jobid-tag=tag checkout jobid modules with specific tag - -Dependencies: - --with-EXTERNAL=PATH where to look for an external. Required externals - (not all for all modules) are: - @ext - --with-JAR=JAR where to look for jars. Required jars are: - @myjars - Summary of what will be used is always printed - -}; - -} diff --git a/org.glite.security.gss/interface/glite_gss.h b/org.glite.security.gss/interface/glite_gss.h deleted file mode 100644 index 5a1e3fc..0000000 --- a/org.glite.security.gss/interface/glite_gss.h +++ /dev/null @@ -1,193 +0,0 @@ -#ifndef __EDG_WORKLOAD_LOGGING_COMMON_LB_GSS_H__ -#define __EDG_WORKLOAD_LOGGING_COMMON_LB_GSS_H__ - -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -enum { - EDG_WLL_GSS_OK = 0, /* no GSS errors */ - EDG_WLL_GSS_ERROR_GSS = -1, /* GSS specific error, call edg_wll_get_gss_error() for details */ - EDG_WLL_GSS_ERROR_TIMEOUT = -2, /* Timeout */ - EDG_WLL_GSS_ERROR_EOF = -3, /* EOF occured */ - EDG_WLL_GSS_ERROR_ERRNO = -4, /* System error. See errno */ - EDG_WLL_GSS_ERROR_HERRNO = -5 /* Resolver error. See h_errno */ -}; - -enum { - EDG_WLL_GSS_FLAG_DELEG = 1, - EDG_WLL_GSS_FLAG_CONF = 16, - EDG_WLL_GSS_FLAG_INTEG = 32, - EDG_WLL_GSS_FLAG_ANON = 64, -}; - -typedef void * edg_wll_GssCtx; - -typedef struct _edg_wll_GssConnection { - edg_wll_GssCtx context; - int sock; - char *buffer; - size_t bufsize; -} edg_wll_GssConnection; - -typedef struct _edg_wll_GssStatus { - unsigned int major_status; - unsigned int minor_status; -} edg_wll_GssStatus; - -typedef struct _edg_wll_GssPrincipal_data { - char *name; - unsigned int flags; - char **fqans; -#if 0 - char **voms_groups; /* needed for legacy LB server authZ mechanism */ - edg_wll_GssOid authn_mech; -#endif -} edg_wll_GssPrincipal_data; -typedef struct _edg_wll_GssPrincipal_data *edg_wll_GssPrincipal; - -typedef struct _edg_wll_GssCred_data { - void *gss_cred; - time_t lifetime; - char *name; -} _edg_wll_GssCred_data; -typedef struct _edg_wll_GssCred_data *edg_wll_GssCred; - -int -edg_wll_gss_initialize(void); - -void -edg_wll_gss_finalize(void); - -int -edg_wll_gss_acquire_cred_gsi(const char *cert_file, - const char *key_file, - edg_wll_GssCred *cred, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_release_cred(edg_wll_GssCred *cred, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_connect(edg_wll_GssCred cred, - char const *hostname, - int port, - struct timeval *timeout, - edg_wll_GssConnection *connection, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_accept(edg_wll_GssCred cred, - int sock, - struct timeval *timeout, - edg_wll_GssConnection *connection, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_read(edg_wll_GssConnection *connection, - void *buf, - size_t bufsize, - struct timeval *timeout, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_write(edg_wll_GssConnection *connection, - const void *buf, - size_t bufsize, - struct timeval *timeout, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_read_full(edg_wll_GssConnection *connection, - void *buf, - size_t bufsize, - struct timeval *timeout, - size_t *total, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_write_full(edg_wll_GssConnection *connection, - const void *buf, - size_t bufsize, - struct timeval *timeout, - size_t *total, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_watch_creds(const char * proxy_file, - time_t * proxy_mtime); - -int -edg_wll_gss_get_error(edg_wll_GssStatus* gss_code, - const char *prefix, - char **errmsg); - -int -edg_wll_gss_close(edg_wll_GssConnection *connection, - struct timeval *timeout); - -int -edg_wll_gss_reject(int sock); - -int -edg_wll_gss_get_client_conn(edg_wll_GssConnection *connection, - edg_wll_GssPrincipal *principal, - edg_wll_GssStatus* gss_code); - -int -edg_wll_gss_get_client_pem(edg_wll_GssConnection *connection, - const char *my_cert_file, const char *my_key_file, - char **pem_string); - -void -edg_wll_gss_free_princ(edg_wll_GssPrincipal principal); - -int -edg_wll_gss_gethostname(char *name, int len); - -char * -edg_wll_gss_normalize_subj(char *in, - int replace_in); - -int -edg_wll_gss_equal_subj(const char *a, - const char *b); - -int -edg_wll_gss_unread(edg_wll_GssConnection *connection, - void *data, - size_t len); - - -int -edg_wll_gss_set_signal_handler(int signum, - void (*handler_func)(int)); - -#ifdef __cplusplus -} -#endif - -#endif /* __EDG_WORKLOAD_LOGGING_COMMON_LB_GSS_H__ */ diff --git a/org.glite.security.gss/project/ChangeLog b/org.glite.security.gss/project/ChangeLog deleted file mode 100644 index 774ccb8..0000000 --- a/org.glite.security.gss/project/ChangeLog +++ /dev/null @@ -1,39 +0,0 @@ -2.0.0-1 -- LB 2.0 release - -2.0.0-2 -- proper reference to cppunit - -2.0.0-3 -- globus flavors added to configure - -2.0.0-4 -- Module repacked. - -2.0.0-5 -- New age to fix an erroneous lock - -2.0.0-6 -- install libraries into $libdir - -2.0.1-1 -- Memleak fixes -- Working with c-ares >= 1.5.0 -- Added edg_wll_gss_unread() -- Consider arch libdir when linking c-ares - -2.1.0-1 -- IPv6 fixes - -2.1.1-1 -- Fixed making target 'check' - -2.1.2-1 -- Fixed target 'clean' in the Makefile to handle debian builds - -2.1.3-1 -- c-ares function call adjusted to new/old c-ares version - -2.1.4-1 -- Support IPv6 literal adresses. - diff --git a/org.glite.security.gss/project/package.description b/org.glite.security.gss/project/package.description deleted file mode 100644 index 3fc8dce..0000000 --- a/org.glite.security.gss/project/package.description +++ /dev/null @@ -1 +0,0 @@ -glite-security-gss wraps GSS functions (and several non-GSS Globus calls) to a secure network communication library with strict timing control (via timeout arguments) of all remote operations. diff --git a/org.glite.security.gss/project/package.summary b/org.glite.security.gss/project/package.summary deleted file mode 100644 index 4b2ef0e..0000000 --- a/org.glite.security.gss/project/package.summary +++ /dev/null @@ -1 +0,0 @@ -Wrapper of Globus GSS/SSL implementation used by gLite LB and JP diff --git a/org.glite.security.gss/project/version.properties b/org.glite.security.gss/project/version.properties deleted file mode 100644 index 6e8c734..0000000 --- a/org.glite.security.gss/project/version.properties +++ /dev/null @@ -1,3 +0,0 @@ -# $Header$ -module.version=2.1.4 -module.age=1 diff --git a/org.glite.security.gss/src/glite_gss.c b/org.glite.security.gss/src/glite_gss.c deleted file mode 100644 index d034d41..0000000 --- a/org.glite.security.gss/src/glite_gss.c +++ /dev/null @@ -1,1578 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "glite_gss.h" - -#define tv_sub(a,b) {\ - (a).tv_usec -= (b).tv_usec;\ - (a).tv_sec -= (b).tv_sec;\ - if ((a).tv_usec < 0) {\ - (a).tv_sec--;\ - (a).tv_usec += 1000000;\ - }\ -} - -struct asyn_result { - struct hostent *ent; - int err; -}; - -static int globus_common_activated = 0; - -static int decrement_timeout(struct timeval *timeout, struct timeval before, struct timeval after) -{ - (*timeout).tv_sec = (*timeout).tv_sec - (after.tv_sec - before.tv_sec); - (*timeout).tv_usec = (*timeout).tv_usec - (after.tv_usec - before.tv_usec); - while ( (*timeout).tv_usec < 0) { - (*timeout).tv_sec--; - (*timeout).tv_usec += 1000000; - } - if ( ((*timeout).tv_sec < 0) || (((*timeout).tv_sec == 0) && ((*timeout).tv_usec == 0)) ) return(1); - else return(0); -} - -/* ares callback handler for ares_gethostbyname() */ -#if ARES_VERSION >= 0x010500 -static void callback_ares_gethostbyname(void *arg, int status, int timeouts, struct hostent *h) -#else -static void callback_ares_gethostbyname(void *arg, int status, struct hostent *h) -#endif -{ - struct asyn_result *arp = (struct asyn_result *) arg; - - switch (status) { - case ARES_SUCCESS: - if (h && h->h_addr_list[0]) { - arp->ent->h_addr_list = - (char **) malloc(2 * sizeof(char *)); - if (arp->ent->h_addr_list == NULL) { - arp->err = NETDB_INTERNAL; - break; - } - arp->ent->h_addr_list[0] = - malloc(h->h_length); - if (arp->ent->h_addr_list[0] == NULL) { - free(arp->ent->h_addr_list); - arp->err = NETDB_INTERNAL; - break; - } - memcpy(arp->ent->h_addr_list[0], h->h_addr_list[0], - h->h_length); - arp->ent->h_addr_list[1] = NULL; - arp->ent->h_addrtype = h->h_addrtype; - arp->err = NETDB_SUCCESS; - } else { - arp->err = NO_DATA; - } - break; - case ARES_EBADNAME: - case ARES_ENOTFOUND: - arp->err = HOST_NOT_FOUND; - break; - case ARES_ENOTIMP: - arp->err = NO_RECOVERY; - break; - case ARES_ENOMEM: - case ARES_EDESTRUCTION: - default: - arp->err = NETDB_INTERNAL; - break; - } -} - -static void free_hostent(struct hostent *h){ - int i; - - if (h) { - if (h->h_name) free(h->h_name); - if (h->h_aliases) { - for (i=0; h->h_aliases[i]; i++) free(h->h_aliases[i]); - free(h->h_aliases); - } - if (h->h_addr_list) { - for (i=0; h->h_addr_list[i]; i++) free(h->h_addr_list[i]); - free(h->h_addr_list); - } - free(h); - } -} - -static int asyn_getservbyname2(int af, struct sockaddr_storage *addrOut, socklen_t *a_len,char const *name, int port, struct timeval *timeout) { - struct asyn_result ar; - ares_channel channel; - int nfds; - fd_set readers, writers; - struct timeval tv, *tvp; - struct timeval start_time,check_time; - int err = NETDB_INTERNAL; - char *name2, *p; - size_t namelen; - - name2 = name; - namelen = strlen(name); - if (name[0]=='[' && name[namelen-1]==']') { - /* IPv6 literal, strip brackets */ - name2 = strdup(name); - if (!name2) return NETDB_INTERNAL; - name2[namelen-1] = '\0'; - name2++; - /* Ignore scope identifier, not supported by c-ares */ - p = strchr(name2, '%'); - if (p) *p = '\0'; - } - -/* start timer */ - gettimeofday(&start_time,0); - -/* ares init */ - if ( ares_init(&channel) != ARES_SUCCESS ) return(NETDB_INTERNAL); - ar.ent = (struct hostent *) calloc (sizeof(*ar.ent),1); - -/* query DNS server asynchronously */ - ares_gethostbyname(channel, name2, af, callback_ares_gethostbyname, - (void *) &ar); - -/* wait for result */ - while (1) { - FD_ZERO(&readers); - FD_ZERO(&writers); - nfds = ares_fds(channel, &readers, &writers); - if (nfds == 0) - break; - - gettimeofday(&check_time,0); - if (timeout && decrement_timeout(timeout, start_time, check_time)) { - ares_destroy(channel); - free_hostent(ar.ent); - return(TRY_AGAIN); - } - start_time = check_time; - - tvp = ares_timeout(channel, timeout, &tv); - - switch ( select(nfds, &readers, &writers, NULL, tvp) ) { - case -1: if (errno != EINTR) { - ares_destroy(channel); - free_hostent(ar.ent); - return NETDB_INTERNAL; - } else - continue; - case 0: - FD_ZERO(&readers); - FD_ZERO(&writers); - /* fallthrough */ - default: ares_process(channel, &readers, &writers); - } - } - - if (ar.err == NETDB_SUCCESS) { - struct sockaddr_in *p4 = (struct sockaddr_in *)addrOut; - struct sockaddr_in6 *p6 = (struct sockaddr_in6 *)addrOut; - - memset(addrOut, 0, sizeof *addrOut); - addrOut->ss_family = ar.ent->h_addrtype; - switch (ar.ent->h_addrtype) { - case AF_INET: - memcpy(&p4->sin_addr,ar.ent->h_addr_list[0], sizeof(struct in_addr)); - p4->sin_port = htons(port); - *a_len = sizeof (struct sockaddr_in); - break; - case AF_INET6: - memcpy(&p6->sin6_addr,ar.ent->h_addr_list[0], sizeof(struct in6_addr)); - p6->sin6_port = htons(port); - *a_len = sizeof (struct sockaddr_in6); - break; - default: - return NETDB_INTERNAL; - break; - } - } - free_hostent(ar.ent); ar.ent = NULL; - err = ar.err; - - /* literal conversion should always succeed */ - if (name2 != name) free(name2-1); - - ares_destroy(channel); - - return err; -} - -static int asyn_getservbyname(struct sockaddr_storage *addrOut, socklen_t *a_len,char const *name, int port, struct timeval *timeout) { - int res; - - res = asyn_getservbyname2(AF_INET6, addrOut, a_len, name, port, timeout); - if (res != HOST_NOT_FOUND) return res; - res = asyn_getservbyname2(AF_INET, addrOut, a_len, name, port, timeout); - return res; -} - -static int -do_connect(int *s, char const *hostname, int port, struct timeval *timeout) -{ - int sock; - struct timeval before,after,to; - struct sockaddr_storage a; - socklen_t a_len; - int sock_err; - socklen_t err_len; - int h_errno; - int opt; - - /* XXX todo: try multiple addresses */ - switch (h_errno = asyn_getservbyname(&a, &a_len, hostname, port, timeout)) { - case NETDB_SUCCESS: - break; - case TRY_AGAIN: - close(sock); - return EDG_WLL_GSS_ERROR_TIMEOUT; - case NETDB_INTERNAL: - /* fall through */ - default: - close(sock); - /* h_errno may be thread safe with Linux pthread libs, - * but such an assumption is not portable - */ - errno = h_errno; - return EDG_WLL_GSS_ERROR_HERRNO; - } - - sock = socket(a.ss_family, SOCK_STREAM, 0); - if (sock < 0) return EDG_WLL_GSS_ERROR_ERRNO; - - opt = 1; - setsockopt(sock,IPPROTO_TCP,TCP_NODELAY,&opt,sizeof opt); - - if (timeout) { - int flags = fcntl(sock, F_GETFL, 0); - if (fcntl(sock, F_SETFL, flags | O_NONBLOCK) < 0) - return EDG_WLL_GSS_ERROR_ERRNO; - gettimeofday(&before,NULL); - } - - if (connect(sock,(struct sockaddr *) &a, a_len) < 0) { - if (timeout && errno == EINPROGRESS) { - fd_set fds; - FD_ZERO(&fds); - FD_SET(sock,&fds); - memcpy(&to,timeout,sizeof to); - gettimeofday(&before,NULL); - switch (select(sock+1,NULL,&fds,NULL,&to)) { - case -1: close(sock); - return EDG_WLL_GSS_ERROR_ERRNO; - case 0: close(sock); - return EDG_WLL_GSS_ERROR_TIMEOUT; - } - gettimeofday(&after,NULL); - tv_sub(after,before); - tv_sub(*timeout,after); - - err_len = sizeof sock_err; - if (getsockopt(sock,SOL_SOCKET,SO_ERROR,&sock_err,&err_len)) { - close(sock); - return EDG_WLL_GSS_ERROR_ERRNO; - } - if (sock_err) { - close(sock); - errno = sock_err; - return EDG_WLL_GSS_ERROR_ERRNO; - } - } - else { - close(sock); - return EDG_WLL_GSS_ERROR_ERRNO; - } - } - - *s = sock; - return 0; -} - -static int -send_token(int sock, void *token, size_t token_length, struct timeval *to) -{ - size_t num_written = 0; - ssize_t count; - fd_set fds; - struct timeval timeout,before,after; - int ret; - - if (to) { - memcpy(&timeout,to,sizeof(timeout)); - gettimeofday(&before,NULL); - } - - - ret = 0; - while(num_written < token_length) { - FD_ZERO(&fds); - FD_SET(sock,&fds); - switch (select(sock+1, NULL, &fds, NULL, to ? &timeout : NULL)) { - case 0: ret = EDG_WLL_GSS_ERROR_TIMEOUT; - goto end; - break; - case -1: ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - break; - } - - count = write(sock, ((char *)token) + num_written, - token_length - num_written); - if(count < 0) { - if(errno == EINTR) - continue; - else { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - } - num_written += count; - } - -end: - if (to) { - gettimeofday(&after,NULL); - tv_sub(after,before); - tv_sub(*to,after); - if (to->tv_sec < 0) { - to->tv_sec = 0; - to->tv_usec = 0; - } - } - - return ret; -} - -static int -recv_token(int sock, void **token, size_t *token_length, struct timeval *to) -{ - ssize_t count; - char buf[4098]; - char *t = NULL; - char *tmp; - size_t tl = 0; - fd_set fds; - struct timeval timeout,before,after; - int ret; - - if (to) { - memcpy(&timeout,to,sizeof(timeout)); - gettimeofday(&before,NULL); - } - - ret = 0; - do { - FD_ZERO(&fds); - FD_SET(sock,&fds); - switch (select(sock+1, &fds, NULL, NULL, to ? &timeout : NULL)) { - case 0: - ret = EDG_WLL_GSS_ERROR_TIMEOUT; - goto end; - break; - case -1: - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - break; - } - - count = read(sock, buf, sizeof(buf)); - if (count < 0) { - if (errno == EINTR) - continue; - else { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - } - - if (count==0) { - if (tl==0) { - free(t); - return EDG_WLL_GSS_ERROR_EOF; - } else goto end; - } - tmp=realloc(t, tl + count); - if (tmp == NULL) { - errno = ENOMEM; - free(t); - return EDG_WLL_GSS_ERROR_ERRNO; - } - t = tmp; - memcpy(t + tl, buf, count); - tl += count; - - } while (count < 0); /* restart on EINTR */ - -end: - if (to) { - gettimeofday(&after,NULL); - tv_sub(after,before); - tv_sub(*to,after); - if (to->tv_sec < 0) { - to->tv_sec = 0; - to->tv_usec = 0; - } - } - - if (ret == 0) { - *token = t; - *token_length = tl; - } else - free(t); - - return ret; -} - -static int -create_proxy(const char *cert_file, const char *key_file, char **proxy_file) -{ - char buf[4096]; - int in, out; - char *name = NULL; - int ret, len; - - *proxy_file = NULL; - - asprintf(&name, "%s/%d.lb.XXXXXX", P_tmpdir, getpid()); - - out = mkstemp(name); - if (out < 0) - return EDG_WLL_GSS_ERROR_ERRNO; - - in = open(cert_file, O_RDONLY); - if (in < 0) { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - while ((ret = read(in, buf, sizeof(buf))) > 0) { - len = write(out, buf, ret); - if (len != ret) { - ret = -1; - break; - } - } - close(in); - if (ret < 0) { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - - len = write(out, "\n", 1); - if (len != 1) { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - - in = open(key_file, O_RDONLY); - if (in < 0) { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - while ((ret = read(in, buf, sizeof(buf))) > 0) { - len = write(out, buf, ret); - if (len != ret) { - ret = -1; - break; - } - } - close(in); - if (ret < 0) { - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - - ret = 0; - *proxy_file = name; - -end: - close(out); - if (ret) { - unlink(name); - free(name); - } - - return ret; -} - -static int -destroy_proxy(char *proxy_file) -{ - /* XXX we should erase the contents safely (i.e. overwrite with 0's) */ - unlink(proxy_file); - return 0; -} - -int -edg_wll_gss_acquire_cred_gsi(const char *cert_file, const char *key_file, edg_wll_GssCred *cred, - edg_wll_GssStatus* gss_code) -{ - OM_uint32 major_status = 0, minor_status, minor_status2; - gss_cred_id_t gss_cred = GSS_C_NO_CREDENTIAL; - gss_buffer_desc buffer = GSS_C_EMPTY_BUFFER; - gss_name_t gss_name = GSS_C_NO_NAME; - OM_uint32 lifetime; - char *proxy_file = NULL; - char *name = NULL; - int ret; - - if ((cert_file == NULL && key_file != NULL) || - (cert_file != NULL && key_file == NULL)) - return EINVAL; - - if (cert_file == NULL) { - major_status = gss_acquire_cred(&minor_status, GSS_C_NO_NAME, 0, - GSS_C_NO_OID_SET, GSS_C_BOTH, - &gss_cred, NULL, NULL); - if (GSS_ERROR(major_status)) { - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - } else { - proxy_file = (char *)cert_file; - if (strcmp(cert_file, key_file) != 0 && - (ret = create_proxy(cert_file, key_file, &proxy_file))) { - proxy_file = NULL; - goto end; - } - - asprintf((char**)&buffer.value, "X509_USER_PROXY=%s", proxy_file); - if (buffer.value == NULL) { - errno = ENOMEM; - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - buffer.length = strlen(proxy_file); - - major_status = gss_import_cred(&minor_status, &gss_cred, GSS_C_NO_OID, 1, - &buffer, 0, NULL); - free(buffer.value); - if (GSS_ERROR(major_status)) { - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - } - - /* gss_import_cred() doesn't check validity of credential loaded, so let's - * verify it now */ - major_status = gss_inquire_cred(&minor_status, gss_cred, &gss_name, - &lifetime, NULL, NULL); - if (GSS_ERROR(major_status)) { - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - - /* Must cast to time_t since OM_uint32 is unsinged and hence we couldn't - * detect negative values. */ - if ((time_t) lifetime <= 0) { - major_status = GSS_S_CREDENTIALS_EXPIRED; - minor_status = 0; /* XXX */ - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - - major_status = gss_display_name(&minor_status, gss_name, &buffer, NULL); - if (GSS_ERROR(major_status)) { - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - name = buffer.value; - memset(&buffer, 0, sizeof(buffer)); - - *cred = calloc(1, sizeof(**cred)); - if (*cred == NULL) { - ret = EDG_WLL_GSS_ERROR_ERRNO; - free(name); - goto end; - } - - (*cred)->gss_cred = gss_cred; - gss_cred = GSS_C_NO_CREDENTIAL; - (*cred)->lifetime = lifetime; - (*cred)->name = name; - - ret = 0; - -end: - if (cert_file && key_file && proxy_file && strcmp(cert_file, key_file) != 0) { - destroy_proxy(proxy_file); - free(proxy_file); - } - - if (gss_name != GSS_C_NO_NAME) - gss_release_name(&minor_status2, &gss_name); - - if (gss_cred != GSS_C_NO_CREDENTIAL) - gss_release_cred(&minor_status2, &gss_cred); - - if (GSS_ERROR(major_status)) { - if (gss_code) { - gss_code->major_status = major_status; - gss_code->minor_status = minor_status; - } - ret = EDG_WLL_GSS_ERROR_GSS; - } - - return ret; -} - -/* XXX XXX This is black magic. "Sometimes" server refuses the client with SSL - * * alert "certificate expired" even if it is not true. In this case the server - * * slave terminates (which helps, usually), and we can reconnect transparently. - * */ - -/* This string appears in the error message in this case */ -#define _EXPIRED_ALERT_MESSAGE "function SSL3_READ_BYTES: sslv3 alert certificate expired" -#define _EXPIRED_ALERT_RETRY_COUNT 10 /* default number of slaves, hope that not all - are in the bad state */ -#define _EXPIRED_ALERT_RETRY_DELAY 10 /* ms */ - -/* XXX XXX This is black magic. "Sometimes" server refuses the client with SSL - * * alert "certificate expired" even if it is not true. In this case the server - * * slave terminates (which helps, usually), and we can reconnect transparently. - * */ - -/* This string appears in the error message in this case */ -#define _EXPIRED_ALERT_MESSAGE "function SSL3_READ_BYTES: sslv3 alert certificate expired" -#define _EXPIRED_ALERT_RETRY_COUNT 10 /* default number of slaves, hope that not all - are in the bad state */ -#define _EXPIRED_ALERT_RETRY_DELAY 10 /* ms */ - -int -edg_wll_gss_connect(edg_wll_GssCred cred, char const *hostname, int port, - struct timeval *timeout, edg_wll_GssConnection *connection, - edg_wll_GssStatus* gss_code) -{ - int sock, ret; - OM_uint32 maj_stat, min_stat, min_stat2, req_flags; - int context_established = 0; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - gss_name_t server = GSS_C_NO_NAME; - gss_ctx_id_t context = GSS_C_NO_CONTEXT; - char *servername = NULL; - int retry = _EXPIRED_ALERT_RETRY_COUNT; - - maj_stat = min_stat = min_stat2 = req_flags = 0; - memset(connection, 0, sizeof(*connection)); - - /* GSI specific */ - req_flags = GSS_C_GLOBUS_SSL_COMPATIBLE; - - ret = do_connect(&sock, hostname, port, timeout); - if (ret) - return ret; - - /* XXX find appropriate fqdn */ - asprintf (&servername, "host@%s", hostname); - if (servername == NULL) { - errno = ENOMEM; - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - input_token.value = servername; - input_token.length = strlen(servername) + 1; - - maj_stat = gss_import_name(&min_stat, &input_token, - GSS_C_NT_HOSTBASED_SERVICE, &server); - if (GSS_ERROR(maj_stat)) { - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - - free(servername); - memset(&input_token, 0, sizeof(input_token)); - - /* XXX if cred == GSS_C_NO_CREDENTIAL set the ANONYMOUS flag */ - - do { /* XXX: the black magic above */ - - /* XXX prepsat na do {} while (maj_stat == CONT) a osetrit chyby*/ - while (!context_established) { - /* XXX verify ret_flags match what was requested */ - maj_stat = gss_init_sec_context(&min_stat, cred->gss_cred, &context, - GSS_C_NO_NAME, GSS_C_NO_OID, - req_flags | GSS_C_MUTUAL_FLAG | GSS_C_CONF_FLAG, - 0, GSS_C_NO_CHANNEL_BINDINGS, - &input_token, NULL, &output_token, - NULL, NULL); - if (input_token.length > 0) { - free(input_token.value); - input_token.length = 0; - } - - if (output_token.length != 0) { - ret = send_token(sock, output_token.value, output_token.length, timeout); - gss_release_buffer(&min_stat2, &output_token); - if (ret) - goto end; - } - - if (GSS_ERROR(maj_stat)) { - if (context != GSS_C_NO_CONTEXT) { - gss_delete_sec_context(&min_stat2, &context, &output_token); - context = GSS_C_NO_CONTEXT; - if (output_token.length) { - send_token(sock, output_token.value, output_token.length, timeout); - gss_release_buffer(&min_stat2, &output_token); - } - } - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - - if(maj_stat & GSS_S_CONTINUE_NEEDED) { - ret = recv_token(sock, &input_token.value, &input_token.length, timeout); - if (ret) - goto end; - } else - context_established = 1; - } - - /* XXX check ret_flags matches to what was requested */ - - /* retry on false "certificate expired" */ - if (ret == EDG_WLL_GSS_ERROR_GSS) { - edg_wll_GssStatus gss_stat; - char *msg = NULL; - - gss_stat.major_status = maj_stat; - gss_stat.minor_status = min_stat; - edg_wll_gss_get_error(&gss_stat,"",&msg); - - if (strstr(msg,_EXPIRED_ALERT_MESSAGE)) { - usleep(_EXPIRED_ALERT_RETRY_DELAY); - retry--; - } - else retry = 0; - - free(msg); - } - else retry = 0; - - } while (retry); - - connection->sock = sock; - connection->context = context; - servername = NULL; - ret = 0; - -end: - if (ret == EDG_WLL_GSS_ERROR_GSS && gss_code) { - gss_code->major_status = maj_stat; - gss_code->minor_status = min_stat; - } - if (server != GSS_C_NO_NAME) - gss_release_name(&min_stat2, &server); - if (servername == NULL) - free(servername); - if (ret) - close(sock); - - return ret; -} - -int -edg_wll_gss_accept(edg_wll_GssCred cred, int sock, struct timeval *timeout, - edg_wll_GssConnection *connection, edg_wll_GssStatus* gss_code) -{ - OM_uint32 maj_stat, min_stat, min_stat2; - OM_uint32 ret_flags = 0; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - gss_name_t client_name = GSS_C_NO_NAME; - gss_ctx_id_t context = GSS_C_NO_CONTEXT; - int ret; - - maj_stat = min_stat = min_stat2 = 0; - memset(connection, 0, sizeof(*connection)); - - /* GSI specific */ - ret_flags = GSS_C_GLOBUS_SSL_COMPATIBLE; - - do { - ret = recv_token(sock, &input_token.value, &input_token.length, timeout); - if (ret) - goto end; - - if (client_name != GSS_C_NO_NAME) - gss_release_name(&min_stat2, &client_name); - - maj_stat = gss_accept_sec_context(&min_stat, &context, - cred->gss_cred, &input_token, - GSS_C_NO_CHANNEL_BINDINGS, - &client_name, NULL, &output_token, - &ret_flags, NULL, NULL); - if (input_token.length > 0) { - free(input_token.value); - input_token.length = 0; - } - - if (output_token.length) { - ret = send_token(sock, output_token.value, output_token.length, timeout); - gss_release_buffer(&min_stat2, &output_token); - if (ret) - goto end; - } - } while(maj_stat & GSS_S_CONTINUE_NEEDED); - - if (GSS_ERROR(maj_stat)) { - if (context != GSS_C_NO_CONTEXT) { - gss_delete_sec_context(&min_stat2, &context, &output_token); - context = GSS_C_NO_CONTEXT; - if (output_token.length) { - send_token(sock, output_token.value, output_token.length, timeout); - gss_release_buffer(&min_stat2, &output_token); - } - } - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - -#if 0 - maj_stat = gss_display_name(&min_stat, client_name, &output_token, NULL); - gss_release_buffer(&min_stat2, &output_token); - if (GSS_ERROR(maj_stat)) { - /* XXX close context ??? */ - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } -#endif - - connection->sock = sock; - connection->context = context; - ret = 0; - -end: - if (ret == EDG_WLL_GSS_ERROR_GSS && gss_code) { - gss_code->major_status = maj_stat; - gss_code->minor_status = min_stat; - } - if (client_name != GSS_C_NO_NAME) - gss_release_name(&min_stat2, &client_name); - - return ret; -} - -int -edg_wll_gss_write(edg_wll_GssConnection *connection, const void *buf, size_t bufsize, - struct timeval *timeout, edg_wll_GssStatus* gss_code) -{ - OM_uint32 maj_stat, min_stat; - gss_buffer_desc input_token; - gss_buffer_desc output_token; - int ret; - - input_token.value = (void*)buf; - input_token.length = bufsize; - - maj_stat = gss_wrap (&min_stat, connection->context, 1, GSS_C_QOP_DEFAULT, - &input_token, NULL, &output_token); - if (GSS_ERROR(maj_stat)) { - if (gss_code) { - gss_code->minor_status = min_stat; - gss_code->major_status = maj_stat; - } - - return EDG_WLL_GSS_ERROR_GSS; - } - - ret = send_token(connection->sock, output_token.value, output_token.length, - timeout); - gss_release_buffer(&min_stat, &output_token); - - return ret; -} - - -int -edg_wll_gss_read(edg_wll_GssConnection *connection, void *buf, size_t bufsize, - struct timeval *timeout, edg_wll_GssStatus* gss_code) -{ - OM_uint32 maj_stat, min_stat, min_stat2; - gss_buffer_desc input_token; - gss_buffer_desc output_token; - size_t i, len; - int ret; - - if (connection->bufsize > 0) { - len = (connection->bufsize < bufsize) ? connection->bufsize : bufsize; - memcpy(buf, connection->buffer, len); - if (connection->bufsize - len == 0) { - free(connection->buffer); - connection->buffer = NULL; - } else { - for (i = 0; i < connection->bufsize - len; i++) - connection->buffer[i] = connection->buffer[i+len]; - } - connection->bufsize -= len; - - return len; - } - - do { - ret = recv_token(connection->sock, &input_token.value, &input_token.length, - timeout); - if (ret) - return ret; - - ERR_clear_error(); - maj_stat = gss_unwrap(&min_stat, connection->context, &input_token, - &output_token, NULL, NULL); - gss_release_buffer(&min_stat2, &input_token); - if (GSS_ERROR(maj_stat)) { - if (gss_code) { - gss_code->minor_status = min_stat; - gss_code->major_status = maj_stat; - } - return EDG_WLL_GSS_ERROR_GSS; - } - } while (maj_stat == 0 && output_token.length == 0 && output_token.value == NULL); - - if (output_token.length > bufsize) { - connection->bufsize = output_token.length - bufsize; - connection->buffer = malloc(connection->bufsize); - if (connection->buffer == NULL) { - connection->bufsize = 0; - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - memcpy(connection->buffer, output_token.value + bufsize, connection->bufsize); - output_token.length = bufsize; - } - - memcpy(buf, output_token.value, output_token.length); - ret = output_token.length; - -end: - gss_release_buffer(&min_stat, &output_token); - - return ret; -} - -int -edg_wll_gss_read_full(edg_wll_GssConnection *connection, void *buf, - size_t bufsize, struct timeval *timeout, size_t *total, - edg_wll_GssStatus* gss_code) -{ - size_t len, i; - *total = 0; - - if (connection->bufsize > 0) { - len = (connection->bufsize < bufsize) ? connection->bufsize : bufsize; - memcpy(buf, connection->buffer, len); - if (connection->bufsize - len == 0) { - free(connection->buffer); - connection->buffer = NULL; - } else { - for (i = 0; i < connection->bufsize - len; i++) - connection->buffer[i] = connection->buffer[i+len]; - } - connection->bufsize -= len; - *total = len; - } - - while (*total < bufsize) { - int len; - - len = edg_wll_gss_read(connection, buf+*total, bufsize-*total, - timeout, gss_code); - if (len < 0) return len; - *total += len; - } - - return 0; -} - -int -edg_wll_gss_write_full(edg_wll_GssConnection *connection, const void *buf, - size_t bufsize, struct timeval *timeout, size_t *total, - edg_wll_GssStatus* gss_code) -{ - return edg_wll_gss_write(connection, buf, bufsize, timeout, gss_code); -} - -/* Request credential reload each 60 seconds in order to work around - * Globus bug (not reloading expired CRLs) - */ -#define GSS_CRED_WATCH_LIMIT 60 -int -edg_wll_gss_watch_creds(const char *proxy_file, time_t *last_time) -{ - struct stat pstat; - time_t now; - - now = time(NULL); - - if ( now >= (*last_time+GSS_CRED_WATCH_LIMIT) ) { - *last_time = now; - return 1; - } - - if (!proxy_file) return 0; - if (stat(proxy_file,&pstat)) return -1; - - if ( pstat.st_mtime >= *last_time ) { - *last_time = now + 1; - return 1; - } - - return 0; -} - -int -edg_wll_gss_close(edg_wll_GssConnection *con, struct timeval *timeout) -{ - OM_uint32 min_stat; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - struct timeval def_timeout = { 0, 100000}; - - if (con->context != GSS_C_NO_CONTEXT) { - gss_delete_sec_context(&min_stat, (gss_ctx_id_t *)&con->context, &output_token); - -#if 0 - /* XXX: commented out till timeout handling in caller is fixed */ - - /* send the buffer (if any) to the peer. GSSAPI specs doesn't - * recommend sending it, but we want SSL compatibility */ - if (output_token.length && con->sock>=0) { - send_token(con->sock, output_token.value, output_token.length, - timeout ? timeout : &def_timeout); - } -#endif - gss_release_buffer(&min_stat, &output_token); - - /* XXX can socket be open even if context == GSS_C_NO_CONTEXT) ? */ - /* XXX ensure that edg_wll_GssConnection is created with sock set to -1 */ - if (con->sock >= 0) - close(con->sock); - } - if (con->buffer) - free(con->buffer); - memset(con, 0, sizeof(*con)); - con->context = GSS_C_NO_CONTEXT; - con->sock = -1; - return 0; -} - -int -edg_wll_gss_get_error(edg_wll_GssStatus *gss_err, const char *prefix, char **msg) -{ - OM_uint32 maj_stat, min_stat; - OM_uint32 msg_ctx = 0; - gss_buffer_desc maj_status_string = GSS_C_EMPTY_BUFFER; - gss_buffer_desc min_status_string = GSS_C_EMPTY_BUFFER; - char *str = NULL; - char *line, *tmp; - - str = strdup(prefix); - do { - maj_stat = gss_display_status(&min_stat, gss_err->major_status, - GSS_C_GSS_CODE, GSS_C_NO_OID, - &msg_ctx, &maj_status_string); - if (GSS_ERROR(maj_stat)) - break; - maj_stat = gss_display_status(&min_stat, gss_err->minor_status, - GSS_C_MECH_CODE, GSS_C_NULL_OID, - &msg_ctx, &min_status_string); - if (GSS_ERROR(maj_stat)) { - gss_release_buffer(&min_stat, &maj_status_string); - break; - } - - asprintf(&line, ": %s (%s)", (char *)maj_status_string.value, - (char *)min_status_string.value); - gss_release_buffer(&min_stat, &maj_status_string); - gss_release_buffer(&min_stat, &min_status_string); - - tmp = realloc(str, strlen(str) + strlen(line) + 1); - if (tmp == NULL) { - /* abort() ? */ - free(line); - free(str); - str = "WARNING: Not enough memory to produce error message"; - break; - } - str = tmp; - strcat(str, line); - free(line); - } while (!GSS_ERROR(maj_stat) && msg_ctx != 0); - - *msg = str; - return 0; -} - -int -edg_wll_gss_oid_equal(const gss_OID a, const gss_OID b) -{ - if (a == b) - return 1; - else { - if (a == GSS_C_NO_OID || b == GSS_C_NO_OID || a->length != b->length) - return 0; - else - return (memcmp(a->elements, b->elements, a->length) == 0); - } -} - -int -edg_wll_gss_reject(int sock) -{ - /* XXX is it possible to cut & paste edg_wll_ssl_reject() ? */ - return 0; -} - - -int -edg_wll_gss_initialize(void) -{ - int ret = 0; - - if (globus_module_activate(GLOBUS_GSI_GSSAPI_MODULE) != GLOBUS_SUCCESS) { - errno = EINVAL; - ret = EDG_WLL_GSS_ERROR_ERRNO; - } - - if (globus_module_activate(GLOBUS_COMMON_MODULE) == GLOBUS_SUCCESS) - globus_common_activated = 1; - - return ret; -} - - -void -edg_wll_gss_finalize(void) -{ - globus_module_deactivate(GLOBUS_GSI_GSSAPI_MODULE); - if (globus_common_activated) { - globus_module_deactivate(GLOBUS_COMMON_MODULE); - globus_common_activated = 0; - } -} - - -int -edg_wll_gss_release_cred(edg_wll_GssCred *cred, edg_wll_GssStatus* gss_code) -{ - OM_uint32 maj_stat, min_stat; - int ret = 0; - - if (gss_code) - gss_code->major_status = gss_code->minor_status = 0; - - if (cred == NULL || *cred == NULL) - return ret; - - if ((*cred)->gss_cred) { - maj_stat = gss_release_cred(&min_stat, (gss_cred_id_t*)&(*cred)->gss_cred); - if (GSS_ERROR(maj_stat)) { - ret = EDG_WLL_GSS_ERROR_GSS; - if (gss_code) { - gss_code->major_status = maj_stat; - gss_code->minor_status = min_stat; - } - } - } - - if ((*cred)->name) - free((*cred)->name); - - free(*cred); - *cred = NULL; - - return ret; -} - -int -edg_wll_gss_get_client_conn(edg_wll_GssConnection *connection, - edg_wll_GssPrincipal *principal, - edg_wll_GssStatus* gss_code) -{ - gss_buffer_desc token = GSS_C_EMPTY_BUFFER; - OM_uint32 maj_stat, min_stat, ctx_flags; - gss_name_t client_name = GSS_C_NO_NAME; - edg_wll_GssPrincipal p; - int ret; - - maj_stat = gss_inquire_context(&min_stat, connection->context, &client_name, - NULL, NULL, NULL, &ctx_flags, NULL, NULL); - if (GSS_ERROR(maj_stat)) - goto end; - - maj_stat = gss_display_name(&min_stat, client_name, &token, NULL); - if (GSS_ERROR(maj_stat)) - goto end; - - p = calloc(1, sizeof(*p)); - if (p == NULL) { - errno = ENOMEM; - ret = EDG_WLL_GSS_ERROR_ERRNO; - goto end; - } - - p->name = strdup(token.value); - p->flags = ctx_flags; - - *principal = p; - ret = 0; - -end: - if (GSS_ERROR(maj_stat)) { - ret = EDG_WLL_GSS_ERROR_GSS; - if (gss_code) { - gss_code->major_status = maj_stat; - gss_code->minor_status = min_stat; - } - } - - if (token.length) - gss_release_buffer(&min_stat, &token); - if (client_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &client_name); - - return ret; -} - -/* Beware, this call manipulates with environment variables and is not - thread-safe */ -static int -get_peer_cred(edg_wll_GssConnection *gss, const char *my_cert_file, - const char *my_key_file, STACK_OF(X509) **chain, - edg_wll_GssStatus* gss_code) -{ - OM_uint32 maj_stat, min_stat; - gss_buffer_desc buffer = GSS_C_EMPTY_BUFFER; - BIO *bio = NULL; - SSL_SESSION *session = NULL; - unsigned char int_buffer[4]; - long length; - int ret, index; - STACK_OF(X509) *cert_chain = NULL; - X509 *p_cert; - char *orig_cert = NULL, *orig_key = NULL; - - maj_stat = gss_export_sec_context(&min_stat, (gss_ctx_id_t *) &gss->context, - &buffer); - if (GSS_ERROR(maj_stat)) { - if (gss_code) { - gss_code->major_status = maj_stat; - gss_code->minor_status = min_stat; - } - return EDG_WLL_GSS_ERROR_GSS; - } - - /* The GSSAPI specs requires gss_export_sec_context() to destroy the - * context after exporting. So we have to resurrect the context here by - * importing from just generated buffer. gss_import_sec_context() must be - * able to read valid credential before it loads the exported context - * so we set the environment temporarily to point to the ones used by - * the server. - * */ - - orig_cert = getenv("X509_USER_CERT"); - orig_key = getenv("X509_USER_KEY"); - - if (my_cert_file) - setenv("X509_USER_CERT", my_cert_file, 1); - if (my_key_file) - setenv("X509_USER_KEY", my_key_file, 1); - - maj_stat = gss_import_sec_context(&min_stat, &buffer, - (gss_ctx_id_t *)&gss->context); - - if (orig_cert) - setenv("X509_USER_CERT", orig_cert, 1); - else - unsetenv("X509_USER_CERT"); - - if (orig_key) - setenv("X509_USER_KEY", orig_key, 1); - else - unsetenv("X509_USER_KEY"); - - if (GSS_ERROR(maj_stat)) { - if (gss_code) { - gss_code->major_status = maj_stat; - gss_code->minor_status = min_stat; - } - ret = EDG_WLL_GSS_ERROR_GSS; - goto end; - } - - bio = BIO_new(BIO_s_mem()); - if (bio == NULL) { - ret = ENOMEM; - goto end; - } - - /* Store exported context to memory, skipping the version number and and cred_usage fields */ - BIO_write(bio, buffer.value + 8 , buffer.length - 8); - - /* decode the session data in order to skip at the start of the cert chain */ - session = d2i_SSL_SESSION_bio(bio, NULL); - if (session == NULL) { - ret = EINVAL; - goto end; - } - SSL_SESSION_free(session); - - cert_chain = sk_X509_new_null(); - - BIO_read(bio, (char *) int_buffer, 4); - length = (((size_t) int_buffer[0]) << 24) & 0xffff; - length |= (((size_t) int_buffer[1]) << 16) & 0xffff; - length |= (((size_t) int_buffer[2]) << 8) & 0xffff; - length |= (((size_t) int_buffer[3]) ) & 0xffff; - - if (length == 0) { - ret = EINVAL; - goto end; - } - - for(index = 0; index < length; index++) { - p_cert = d2i_X509_bio(bio, NULL); - if (p_cert == NULL) { - ret = EINVAL; - sk_X509_pop_free(cert_chain, X509_free); - goto end; - } - - sk_X509_push(cert_chain, p_cert); - } - - *chain = cert_chain; - ret = 0; - -end: - gss_release_buffer(&min_stat, &buffer); - - return ret; -} - -int -edg_wll_gss_get_client_pem(edg_wll_GssConnection *connection, - const char *my_cert_file, const char *my_key_file, - char **pem_string) -{ - char *tmp = NULL; - STACK_OF(X509) *chain = NULL; - BIO *bio = NULL; - int ret, i; - size_t total_len, l; - - ret = get_peer_cred(connection, my_cert_file, my_key_file, &chain, NULL); - if (ret) - return ret; - - bio = BIO_new(BIO_s_mem()); - if (bio == NULL) { - ret = ENOMEM; - goto end; - } - - for (i = 0; i < sk_X509_num(chain); i++) { - ret = PEM_write_bio_X509(bio, sk_X509_value(chain, i)); - if (ret <= 0) { - ret = EINVAL; - goto end; - } - } - - total_len = BIO_pending(bio); - if (total_len <= 0) { - ret = EINVAL; - goto end; - } - - tmp = malloc(total_len + 1); - if (tmp == NULL) { - ret = ENOMEM; - goto end; - } - - l = 0; - while (l < total_len) { - ret = BIO_read(bio, tmp+l, total_len-l); - if (ret <= 0) { - ret = EINVAL; - goto end; - } - l += ret; - } - - tmp[total_len] = '\0'; - *pem_string = tmp; - tmp = NULL; - - ret = 0; - -end: - sk_X509_pop_free(chain, X509_free); - if (bio) - BIO_free(bio); - if (tmp) - free(tmp); - - return ret; -} - -void -edg_wll_gss_free_princ(edg_wll_GssPrincipal principal) -{ - if (principal == NULL) - return; - - if (principal->name) - free(principal->name); - - free(principal); -} - -int -edg_wll_gss_gethostname(char *name, int len) -{ - int ret; - - if (globus_common_activated) - ret = globus_libc_gethostname(name, len); - else - ret = gethostname(name, len); - - return ret; -} - -char * -edg_wll_gss_normalize_subj(char *in, int replace_in) -{ - char *new, *ptr; - size_t len; - - if (in == NULL) return NULL; - if (replace_in) - new = in; - else - new = strdup(in); - - while ((ptr = strstr(new, "/emailAddress="))) { - memcpy(ptr, "/Email=",7); - memmove(ptr+7, ptr+14, strlen(ptr+14)+1); - } - - len = strlen(new); - while (len > 9 && !strcmp(new+len-9, "/CN=proxy")) { - *(new+len-9) = '\0'; - len -= 9; - } - - return new; -} - -int -edg_wll_gss_equal_subj(const char *a, const char *b) -{ - char *an,*bn; - int res; - - an = edg_wll_gss_normalize_subj((char*)a, 0); - bn = edg_wll_gss_normalize_subj((char*)b, 0); - - if (!an || !bn) - res = 0; - else - res = !strcmp(an,bn); - - free(an); free(bn); - return res; -} - -int -edg_wll_gss_unread(edg_wll_GssConnection *con, void *data, size_t len) -{ - char *tmp; - - if (len == 0) - return 0; - - tmp = malloc(len + con->bufsize); - if (tmp == NULL) - return ENOMEM; - - memcpy(tmp, data, len); - if (con->bufsize > 0) - memcpy(tmp + len, con->buffer, con->bufsize); - - free(con->buffer); - con->buffer = tmp; - con->bufsize += len; - - return 0; -} - - -int -edg_wll_gss_set_signal_handler(int signum, - void (*handler_func)(int)) -{ - int ret; - - ret = globus_module_activate(GLOBUS_COMMON_MODULE); - if (ret != GLOBUS_SUCCESS) { - struct sigaction sa,osa; - - memset(&sa, 0, sizeof(sa)); - sigemptyset(&sa.sa_mask); - sa.sa_handler = handler_func; - ret = sigaction(signum, &sa, &osa); - return ret; - } - ret = globus_callback_space_register_signal_handler(signum, - GLOBUS_TRUE, - (globus_callback_func_t)handler_func, - (void *)signum, - GLOBUS_CALLBACK_GLOBAL_SPACE); - - globus_module_deactivate(GLOBUS_COMMON_MODULE); - - return ret; -} diff --git a/org.glite.security.gss/test/test_gss.cpp b/org.glite.security.gss/test/test_gss.cpp deleted file mode 100644 index 5eafe78..0000000 --- a/org.glite.security.gss/test/test_gss.cpp +++ /dev/null @@ -1,237 +0,0 @@ -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "glite_gss.h" - -class GSSTest: public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(GSSTest); - CPPUNIT_TEST(echo); - CPPUNIT_TEST(echo); - CPPUNIT_TEST(bigecho); - CPPUNIT_TEST(errorTest); - CPPUNIT_TEST_SUITE_END(); - -public: - void echo(); - void bigecho(); - void errorTest(); - - void setUp(); - void tearDown(); - -private: - edg_wll_GssCred my_cred; - int sock, port; - struct timeval timeout; - - void replier(); -}; - - -void GSSTest::replier() { - edg_wll_GssConnection conn; - edg_wll_GssStatus stat; - struct sockaddr_storage a; - socklen_t alen = sizeof(a); - int s, len; - char buf[8*BUFSIZ]; - - std::cerr << "replier " << getpid() << std::endl; - - if ( (s = accept(sock, (struct sockaddr *) &a, &alen)) < 0 ) exit(1); - - if ( edg_wll_gss_accept(my_cred, s, &timeout, &conn, &stat) ) exit(1); - - while ( (len = edg_wll_gss_read(&conn, buf, sizeof(buf), &timeout, &stat)) >= 0 ) { - if ( edg_wll_gss_write(&conn, buf, len, &timeout, &stat) ) exit(1); - } - - edg_wll_gss_close(&conn, &timeout); - - exit(0); -} - - -void GSSTest::setUp(void) { - pid_t pid; - edg_wll_GssStatus stat; - struct sockaddr_storage a; - socklen_t alen = sizeof(a); - char * cred_file = NULL; - char * key_file = NULL; - char * to = getenv("GSS_TEST_TIMEOUT"); - struct addrinfo *ai; - struct addrinfo hints; - char servname[16]; - int ret; - - - timeout.tv_sec = to ? atoi(to) : 10 ; - timeout.tv_usec = 0; - my_cred = NULL; - - key_file = cred_file = getenv("X509_USER_PROXY"); - CPPUNIT_ASSERT_MESSAGE("credential file", cred_file); - - if (edg_wll_gss_acquire_cred_gsi(cred_file, key_file, &my_cred, &stat)) - CPPUNIT_ASSERT_MESSAGE("gss_acquire_cred", 0); - - memset (&hints, '\0', sizeof (hints)); - hints.ai_flags = AI_NUMERICSERV | AI_PASSIVE | AI_ADDRCONFIG; - hints.ai_socktype = SOCK_STREAM; - - snprintf(servname, sizeof servname, "%d", port); - ret = getaddrinfo (NULL, servname, &hints, &ai); - CPPUNIT_ASSERT_MESSAGE("getaddrinfo()", ret == 0 && ai != NULL); - - sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); - CPPUNIT_ASSERT_MESSAGE("socket()", sock >= 0); - - ret = bind(sock, ai->ai_addr, ai->ai_addrlen); - CPPUNIT_ASSERT_MESSAGE("bind()", ret == 0); - - ret = listen(sock, 1); - CPPUNIT_ASSERT_MESSAGE("listen()", ret == 0); - - getsockname(sock,(struct sockaddr *) &a,&alen); - ret = getnameinfo ((struct sockaddr *) &a, alen, - NULL, 0, servname, sizeof(servname), NI_NUMERICSERV); - CPPUNIT_ASSERT_MESSAGE("getnameinfo()", ret == 0); - - port = atoi(servname); - - if ( !(pid = fork()) ) replier(); - else close(sock); -} - - -void GSSTest::tearDown(void) { - edg_wll_gss_release_cred(&my_cred, NULL); -} - - -void GSSTest::echo() -{ - edg_wll_GssConnection conn; - edg_wll_GssStatus stat; - size_t total; - int err; - char buf[] = "f843fejwfanczn nc4*&686%$$&^(*)*#$@WSH"; - char buf2[100]; - - std::cerr << "echo " << getpid() << std::endl; - - err = edg_wll_gss_connect(my_cred, "localhost", port, &timeout, &conn, &stat); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_connect()", !err); - - err = edg_wll_gss_write(&conn, buf, strlen(buf)+1, &timeout, &stat); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_write()", !err); - - err = edg_wll_gss_read_full(&conn, buf2, strlen(buf)+1, &timeout, &total, &stat); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_read_full()", !err); - - CPPUNIT_ASSERT(strlen(buf)+1 == total && !strcmp(buf,buf2) ); - - edg_wll_gss_close(&conn, &timeout); - -} - -void GSSTest::bigecho() -{ - edg_wll_GssConnection conn; - edg_wll_GssStatus stat; - size_t total; - int err; - char buf[7*BUFSIZ]; - char buf2[7*BUFSIZ]; - - std::cerr << "bigecho " << getpid() << std::endl; - - err = edg_wll_gss_connect(my_cred, "localhost", port, &timeout, &conn, &stat); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_connect()", !err); - - err = edg_wll_gss_write(&conn, buf, sizeof buf, &timeout, &stat); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_write()", !err); - - err = edg_wll_gss_read_full(&conn, buf2, sizeof buf2, &timeout, &total, &stat); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_read_full()", !err); - - CPPUNIT_ASSERT(sizeof buf == total && !memcmp(buf,buf2,sizeof buf) ); - - edg_wll_gss_close(&conn, &timeout); - -} - - -void GSSTest::errorTest() -{ - edg_wll_GssConnection conn; - edg_wll_GssStatus stat; - int err; - char * msg = NULL; - - - err = edg_wll_gss_connect(my_cred, "xxx.example.net", port, &timeout, &conn, &stat); - if (err) edg_wll_gss_get_error(&stat, "gss_connect()", &msg); - CPPUNIT_ASSERT_MESSAGE("edg_wll_gss_get_error()", msg); -} - - -CPPUNIT_TEST_SUITE_REGISTRATION( GSSTest ); - -int main (int ac,const char *av[]) -{ - assert(ac == 2); - std::ofstream xml(av[1]); - - CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); - CppUnit::TestRunner runner; - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - runner.addTest(suite); - runner.run(controller); - - - CppUnit::XmlOutputter xout( &result, xml ); - CppUnit::CompilerOutputter tout( &result, std::cout); - xout.write(); - tout.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} diff --git a/org.glite.security.proxyrenewal/.cvsignore b/org.glite.security.proxyrenewal/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.security.proxyrenewal/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.security.proxyrenewal/LICENSE b/org.glite.security.proxyrenewal/LICENSE deleted file mode 100644 index 01b973b..0000000 --- a/org.glite.security.proxyrenewal/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.security.proxyrenewal/Makefile b/org.glite.security.proxyrenewal/Makefile deleted file mode 100644 index 24252c7..0000000 --- a/org.glite.security.proxyrenewal/Makefile +++ /dev/null @@ -1,167 +0,0 @@ -# -# Copyright (c) 2004 on behalf of the EU EGEE Project: -# The European Organization for Nuclear Research (CERN), -# Istituto Nazionale di Fisica Nucleare (INFN), Italy -# Datamat Spa, Italy -# Centre National de la Recherche Scientifique (CNRS), France -# CS Systeme d'Information (CSSI), France -# Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -# Universiteit van Amsterdam (UvA), Netherlands -# University of Helsinki (UH.HIP), Finland -# University of Bergen (UiB), Norway -# Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom -# -# Top Makefile file for the GLite Security Proxyrenewal module -# -# Authors: Ales Krenek -# Version info: $Id$ -# Release: $Name$ -# -# Revision history: -# $Log -# - -# defaults -top_srcdir=. -builddir=build -top_builddir=${top_srcdir}/${builddir} -stagedir=. -distdir=. -globalprefix=glite -lbprefix=lb -package=glite-security-proxyrenewal -version=0.0.0 -PREFIX=/opt/glite - -glite_location=$PREFIX -globus_prefix=/opt/globus -nothrflavour=gcc32 -thrflavour=gcc32pthr -myproxy_prefix=$globus_prefix - --include Makefile.inc - -VPATH:=${top_srcdir}/src:${top_srcdir}/examples - -GLOBUSINC:= -I${globus_prefix}/include/${nothrflavour} \ - -I${globus_prefix}/include/${nothrflavour}/openssl - -GLOBUSTHRINC:= -I${globus_prefix}/include/${thrflavour} \ - -I${globus_prefix}/include/${thrflavour}/openssl - -MYPROXYINC:= -I${myproxy_prefix}/include/${nothrflavour} -MYPROXYTHRINC:= -I${myproxy_prefix}/include/${thrflavour} - -DEBUG:=-g -O0 - -CFLAGS:= ${DEBUG} \ - ${MYPROXYINC} \ - -I${top_srcdir}/src -I${top_srcdir}/interface \ - -I${glite_location}/include - -GLOBUS_LIBS:=-L${globus_prefix}/lib \ - -lglobus_common_${nothrflavour} \ - -lssl_${nothrflavour} - -MYPROXY_LIB_NOTHR :=-L${myproxy_prefix}/lib -lmyproxy_${nothrflavour} -MYPROXY_LIB_THR:=-L${myproxy_prefix}/lib -lmyproxy_${thrflavour} - -offset=1 -version_info:=-version-info ${shell \ - perl -e '$$,=":"; @F=split "\\.","${version}"; print $$F[0]+$$F[1]+${offset},$$F[2],$$F[1]' } - -COMPILE:=libtool --mode=compile ${CC} ${CFLAGS} -LINK:=libtool --mode=link ${CC} ${LDFLAGS} -INSTALL:=libtool --mode=install install - -DAEMONOBJ:=renewd.o renew.o common.o commands.o api.o voms.o -LIBOBJ:=api.o common.o -LIB_CORE_OBJS := renewal_core.o voms.o -CLIENTOBJ:=client.o - -THRLIBOBJ:=${LIBOBJ:.o=.thr.o} -LIBLOBJ:=${LIBOBJ:.o=.lo} -THRLIBLOBJ:=${LIBOBJ:.o=.thr.lo} - -LIB_CORE_NOTHR_OBJS := ${LIB_CORE_OBJS} -LIB_CORE_NOTHR_LOBJS := ${LIB_CORE_OBJS:.o=.lo} -LIB_CORE_THR_OBJS := ${LIB_CORE_OBJS:.o=.thr.o} -LIB_CORE_THR_LOBJS := ${LIB_CORE_OBJS:.o=.thr.lo} - -LIB:=libglite_security_proxyrenewal_${nothrflavour}.la -THRLIB:=libglite_security_proxyrenewal_${thrflavour}.la -LIB_CORE_NOTHR := libglite_security_proxyrenewal_core_${nothrflavour}.la -LIB_CORE_THR := libglite_security_proxyrenewal_core_${thrflavour}.la - -VOMS_LIB_NOTHR := -L${glite_location}/lib -lvomsc_${nothrflavour} -VOMS_LIB_THR := -L${glite_location}/lib -lvomsc_${thrflavour} - -DAEMON:=glite-proxy-renewd -CLIENT:=glite-proxy-renew -EXAMPLES := renew_core - -default: all -compile all: ${LIB} ${THRLIB} ${LIB_CORE_NOTHR} ${DAEMON} ${CLIENT} - -${LIB}: ${LIBOBJ} - ${LINK} ${version_info} -o $@ ${LIBLOBJ} -rpath ${glite_location}/lib - -${THRLIB}: ${THRLIBOBJ} - ${LINK} ${version_info} -o $@ ${THRLIBLOBJ} -rpath ${glite_location}/lib - -${LIB_CORE_NOTHR}: ${LIB_CORE_NOTHR_OBJS} - ${LINK} ${version_info} -o $@ ${LIB_CORE_NOTHR_LOBJS} -rpath ${glite_location}/lib ${MYPROXY_LIB_NOTHR} ${VOMS_LIB_NOTHR} - -${LIB_CORE_THR}: ${LIB_CORE_THR_OBJS} - ${LINK} ${version_info} -o $@ ${LIB_CORE_THR_LOBJS} -rpath ${glite_location}/lib ${MYPROXY_LIB_THR} ${VOMS_LIB_THR} - -${DAEMON}: ${DAEMONOBJ} ${LIB_CORE_NOTHR} - ${LINK} -o $@ ${DAEMONOBJ} ${LIB_CORE_NOTHR} - -${CLIENT}: ${CLIENTOBJ} ${LIB} - ${LINK} -o $@ ${CLIENTOBJ} ${LIB} ${GLOBUS_LIBS} - -${THRLIBOBJ} ${LIB_CORE_THR_OBJS}: %.thr.o: %.c - ${COMPILE} ${GLOBUSTHRINC} -o $@ -c $< - -%.o: %.c - ${COMPILE} ${GLOBUSINC} -c $< - -${EXAMPLES}: %: %.o - ${LINK} -o $@ $< ${LIB_CORE_NOTHR} - -stage: compile - $(MAKE) install PREFIX=${stagedir} - -check: - echo No unit tests - -examples: ${EXAMPLES} - -dist: distsrc distbin - -distsrc: - mkdir -p ${top_srcdir}/${package}-${version} - cd ${top_srcdir} && GLOBIGNORE="${package}-${version}" && cp -Rf * ${package}-${version} - cd ${top_srcdir} && tar -czf ${distdir}/${package}-${version}_src.tar.gz --exclude-from=project/tar_exclude ${package}-${version} - rm -rf ${top_srcdir}/${package}-${version} - -distbin: - $(MAKE) install PREFIX=`pwd`/tmpbuilddir - cd tmpbuilddir && tar -czf ../${top_srcdir}/${distdir}/${package}-${version}_bin.tar.gz * - rm -rf tmpbuilddir - -install: - -mkdir -p ${PREFIX}/bin ${PREFIX}/lib ${PREFIX}/include/glite/security/proxyrenewal ${PREFIX}/share/doc/${package}-${version} ${PREFIX}/etc/init.d - ${INSTALL} -m 644 ${LIB} ${THRLIB} ${LIB_CORE_NOTHR} ${PREFIX}/lib - ${INSTALL} -m 755 ${DAEMON} ${CLIENT} ${PREFIX}/bin - ${INSTALL} -m 644 ${top_srcdir}/LICENSE ${PREFIX}/share/doc/${package}-${version} - cd ${top_srcdir}/interface && ${INSTALL} -m 644 renewal.h renewal_core.h ${PREFIX}/include/glite/security/proxyrenewal - - ${INSTALL} -m 755 ${top_srcdir}/config/startup ${PREFIX}/etc/init.d/glite-proxy-renewald - - -clean: - $(RM) $(LIB) ${THRLIB} ${LIB_CORE_NOTHR} ${LIB_CORE_THR} $(DAEMON) $(CLIENT) $(EXAMPLES) *.o *.lo core - -.PHONY: default all compile examples check stage dist distsrc distbin install clean diff --git a/org.glite.security.proxyrenewal/build.xml b/org.glite.security.proxyrenewal/build.xml deleted file mode 100755 index 2ddf1c0..0000000 --- a/org.glite.security.proxyrenewal/build.xml +++ /dev/null @@ -1,128 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.security.proxyrenewal/config/startup b/org.glite.security.proxyrenewal/config/startup deleted file mode 100755 index 26ba757..0000000 --- a/org.glite.security.proxyrenewal/config/startup +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/sh - -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/opt/glite/var} - -[ -f /etc/glite.conf ] && . /etc/glite.conf -[ -f $GLITE_LOCATION/etc/glite-wms.conf ] && . $GLITE_LOCATION/etc/glite-wms.conf -[ -f $HOME/.glite.conf ] && . $HOME/.glite.conf - -PROXY_REPOSITORY="$GLITE_LOCATION_VAR/spool/glite-renewd" - -unset creds - -start() -{ - if test -z "$GLITE_USER" ;then - echo 'Error: GLITE_USER is not set' - echo FAILED - return 1 - fi - - [ -n "$GLITE_HOST_CERT" -a -n "$GLITE_HOST_KEY" ] && - creds="-t $GLITE_HOST_CERT -k $GLITE_HOST_KEY" - - if test -z "$creds"; then - if su - $GLITE_USER -c "test -r /etc/grid-security/hostkey.pem -a -r /etc/grid-security/hostcert.pem"; then - echo "$0: WARNING: /etc/grid-security/hostkey.pem readable by $GLITE_USER" - creds="-t /etc/grid-security/hostcert.pem -k /etc/grid-security/hostkey.pem" - fi - fi - - [ -z "$creds" ] && - echo $0: WARNING: No credentials specified. Using default lookup which is dangerous. >&2 - - # workaround for VOMS_FindByVO that seems to always require user's own VOMS config file (bug #7511) - user_voms_config=$HOME/.glite/vomses - if [ ! -f "$user_voms_config" ]; then - rm -f /tmp/renewal_vomses - su - $GLITE_USER -c "touch /tmp/renewal_vomses && chmod 644 /tmp/renewal_vomses" - user_voms_config=/tmp/renewal_vomses - fi - - echo -n Starting ProxyRenewal Daemon: glite-proxy-renewd ... - - if [ ! -d "$PROXY_REPOSITORY" ]; then - mkdir -p $PROXY_REPOSITORY || exit 1 - chown $GLITE_USER $PROXY_REPOSITORY - chmod 0700 $PROXY_REPOSITORY - fi - - su - $GLITE_USER -c "VOMS_USERCONF=$user_voms_config \ - $GLITE_LOCATION/bin/glite-proxy-renewd \ - -r $PROXY_REPOSITORY $creds -A" && echo " done" -} - -stop() -{ - echo -n "Stopping ProxyRenewal Daemon: glite-proxy-renewd ..." - killall glite-proxy-renewd - echo " done" -} - -status() -{ - if netstat -an --unix | grep "^unix .* LISTEN.* /tmp/dgpr_renew_" >/dev/null 2>&1 ;then - echo glite-proxy-renewd running - else - echo glite-proxy-renewd not running - return 1 - fi -} - -case x$1 in - xstart) start;; - xstop) stop;; - xrestart) stop; start;; - xstatus) status;; - x*) echo usage: $0 start,stop,restart,status >&2 - exit 1;; -esac diff --git a/org.glite.security.proxyrenewal/examples/renew_core.c b/org.glite.security.proxyrenewal/examples/renew_core.c deleted file mode 100644 index 69518ea..0000000 --- a/org.glite.security.proxyrenewal/examples/renew_core.c +++ /dev/null @@ -1,63 +0,0 @@ -#include -#include -#include -#include - -static struct option const long_options[] = { - { "server", required_argument, 0, 's' }, - { "proxy", required_argument, 0, 'p' }, - { "help", no_argument, 0, 'h' }, - { NULL, 0, NULL, 0} -}; - -static char short_options[] = "s:p:h"; - -int -main(int argc, char *argv[]) -{ - char *server = NULL; - char *proxy = NULL; - char *new_proxy = NULL; - extern int optind; - char arg; - glite_renewal_core_context ctx = NULL; - int ret; - - while ((arg = getopt_long(argc, argv, short_options, long_options, NULL)) != EOF) { - switch(arg) { - case 's': - server = optarg; break; - case 'p': - proxy = optarg; break; - case 'h': - fprintf(stdout, "Usage: %s --server --proxy \n", argv[0]); - exit(1); - } - } - - if (server == NULL || proxy == NULL) { - fprintf(stderr, "both server and proxy parameters must be given\n"); - exit(1); - } - - ret = glite_renewal_core_init_ctx(&ctx); - if (ret) { - fprintf(stderr, "glite_renewal_core_init_ctx() failed\n"); - exit(1); - } - - ctx->log_dst = GLITE_RENEWAL_LOG_NONE; - - ret = glite_renewal_core_renew(ctx, server, 0, proxy, &new_proxy); - if (ret) { - fprintf(stderr, "%s: glite_renewal_core_renew() failed: %s", - argv[0], ctx->err_message); - exit(1); - } - - ret = glite_renewal_core_destroy_ctx(ctx); - - printf("%s\n", new_proxy); - - return 0; -} diff --git a/org.glite.security.proxyrenewal/interface/renewal.h b/org.glite.security.proxyrenewal/interface/renewal.h deleted file mode 100644 index e07a89f..0000000 --- a/org.glite.security.proxyrenewal/interface/renewal.h +++ /dev/null @@ -1,175 +0,0 @@ -/** - * \file proxyrenewal/renewal.h - * \author Daniel Kouril - * \author Miroslav Ruda - * \brief API for proxy renewal. - * \version 2.0 - * - * General rules: - * - functions return 0 on success, nonzero on error, errror details can - * be found via edg_wlpr_GetErrorText() - */ - -#ifndef RENEWAL_H -#define RENEWAL_H - -#ident "$Header$" - -#ifdef RENEWAL_HAVE_JOBID -#include "glite/wmsutils/jobid/cjobid.h" -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -#define EDG_WLPR_FLAG_UNIQUE 1 -#define EDG_WLPR_FLAG_UPDATE 2 - -typedef enum _edg_wlpr_ErrorCode { -/** - * Base for proxy renewal specific code. - * Start sufficently high not to collide with standard errno. */ - /* XXX see common/exception_codes.h */ - EDG_WLPR_ERROR_BASE = 1900, - EDG_WLPR_ERROR_UNEXPECTED_EOF, - EDG_WLPR_ERROR_GENERIC, - EDG_WLPR_ERROR_PROTO_PARSE_ERROR, - EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND, - EDG_WLPR_ERROR_UNKNOWN_COMMAND, - EDG_WLPR_ERROR_SSL, - EDG_WLPR_ERROR_MYPROXY, - EDG_WLPR_PROXY_NOT_REGISTERED, - EDG_WLPR_PROXY_EXPIRED, - EDG_WLPR_ERROR_VOMS, - EDG_WLPR_ERROR_TIMEOUT, - EDG_WLPR_ERROR_ERRNO, -} edg_wlpr_ErrorCode; - -/** - * Return a human readable string containg description of the errorcode - * \retval char* pointer to a error description - */ -const char * -edg_wlpr_GetErrorText(int err_code); - -/** - * This function contacts the renewal daemon and registers the specified proxy - * for periodic renewal. - * \param filename IN: specification of the proxy to register. - * \param jdl IN: JDL of the job owing the proxy. The JDL is looked for a - * myproxy server contact. - * \param flags IN: one of EDG_WLPR_FLAG_UNIQUE or EDG_WLPR_FLAG_UPDATE, or - * their bitwise OR. - * \param repository_filename OUT: filename of registered proxy in repository. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -int -edg_wlpr_RegisterProxy( - const char * filename, - const char *jdl, - int flags, - char ** repository_filename -); - -/** - * The same function as edg_wlpr_RegisterProxy() but information about the - * myproxy server and jobid are passed as parameters instead of in JDL. - */ -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_RegisterProxyExt( - const char * filename, - const char * server, - unsigned int port, - edg_wlc_JobId jobid, - int flags, - char ** repository_filename -); -#endif - -int -glite_renewal_RegisterProxy( - const char * filename, - const char * server, - unsigned int port, - const char *jobid, - int flags, - char ** repository_filename -); - -/** - * Unregister proxy from the renewal daemon. - * \param jobid IN: specification of job whose proxy shall be unregistered - * \param filename IN: (optional) specification of the proxy to unregister. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_UnregisterProxy( - edg_wlc_JobId jobid, - const char * repository_filename -); -#endif - -int -glite_renewal_UnregisterProxy( - const char * jobid, - const char * repository_filename -); - -/** - * Get a list of registered proxies maintained by the renewal daemon. - * \param count OUT: number of proxies - * \param list OUT: a list of filenames separated by '\n' - * specifying the registered proxies. - * \warning The caller is responsible for freeing the data. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -int -edg_wlpr_GetList(int *count, char **list); - -/** - * Get a status message about a proxy. - * The function contacts the renewal daemon and retrieve information it - * maintains about the proxy. - * \param filename IN: specification of the proxy to query - * \param info OUT: status message. - * \warning The caller is responsible for freeing the data. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -int -edg_wlpr_GetStatus(const char *repository_filename, char **info); - -/** - * For given jobid return registered proxy filename from repository - * \param jobid IN: specification of jobid - * \param repository_filename OUT: proxy regitered for given jobid - * \warning The caller is responsible for freeing the data. - * \retval 0 success - * \retval nonzero on error. Human readable form of the error can be get via - * edg_wlpr_GetErrorText(). - */ -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_GetProxy(edg_wlc_JobId jobid, char **repository_filename); -#endif - -int -glite_renewal_GetProxy( - const char * jobid, - char **repository_filename); - -#ifdef __cplusplus -} -#endif - -#endif /* RENEWAL_H */ diff --git a/org.glite.security.proxyrenewal/interface/renewal_core.h b/org.glite.security.proxyrenewal/interface/renewal_core.h deleted file mode 100644 index 8348963..0000000 --- a/org.glite.security.proxyrenewal/interface/renewal_core.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef RENEWAL_CORE_H -#define RENEWAL_CORE_H - -#ident "$Id$" - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -typedef enum { - GLITE_RENEWAL_LOG_NONE, - GLITE_RENEWAL_LOG_STDOUT, - GLITE_RENEWAL_LOG_SYSLOG, -} glite_renewal_log_dst; - -typedef struct glite_renewal_core_context_data { - int log_level; - glite_renewal_log_dst log_dst; - char *err_message; - char *voms_conf; -} glite_renewal_core_context_data; - -typedef struct glite_renewal_core_context_data *glite_renewal_core_context; - -/** - * This cal initializes the context and sets default values - */ -int -glite_renewal_core_init_ctx(glite_renewal_core_context *context); - -/** - * This call frees the context and all memory used by the context - */ -int -glite_renewal_core_destroy_ctx(glite_renewal_core_context context); - -/** - * This call tries to renew the proxy certificate using the MyProxy - * repository. If VOMS attributes are present in the proxy they are renewed - * as well. - * \param context IN: context with authentication information - * \param myproxy_server IN: hostname of the myproxy repository - * \param myproxy_port IN: TCP port of the myproxy repository, if 0 the - * default value will be used - * \param current_proxy IN: filename with the proxy to renew - * \param new_proxy OUT: filename with the renewed proxy, the caller is - * responsible for removing the file when it's not needed. - */ -int -glite_renewal_core_renew(glite_renewal_core_context context, - const char *myproxy_server, - unsigned int myproxy_port, - const char *current_proxy, - char **new_proxy); - -#ifdef __cplusplus -} -#endif - -#endif /* RENEWAL_CORE_H */ diff --git a/org.glite.security.proxyrenewal/project/build.number b/org.glite.security.proxyrenewal/project/build.number deleted file mode 100644 index 1936771..0000000 --- a/org.glite.security.proxyrenewal/project/build.number +++ /dev/null @@ -1 +0,0 @@ -module.build=137 diff --git a/org.glite.security.proxyrenewal/project/build.properties b/org.glite.security.proxyrenewal/project/build.properties deleted file mode 100644 index e69de29..0000000 diff --git a/org.glite.security.proxyrenewal/project/configure.properties.xml b/org.glite.security.proxyrenewal/project/configure.properties.xml deleted file mode 100644 index 3d6914b..0000000 --- a/org.glite.security.proxyrenewal/project/configure.properties.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - -top_srcdir=.. -builddir=build -stagedir=${stage.abs.dir} -distdir=${dist.dir} -globalprefix=${global.prefix} -package=${module.package.name} -PREFIX=${install.dir} -version=${module.version} -glite_location=${with.glite.location} -globus_prefix=${with.globus.prefix} -thrflavour=${with.globus.thr.flavor} -nothrflavour=${with.globus.nothr.flavor} -myproxy_prefix=${with.myproxy.prefix} - - - diff --git a/org.glite.security.proxyrenewal/project/properties.xml b/org.glite.security.proxyrenewal/project/properties.xml deleted file mode 100755 index f1e51dd..0000000 --- a/org.glite.security.proxyrenewal/project/properties.xml +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.security.proxyrenewal/project/tar_exclude b/org.glite.security.proxyrenewal/project/tar_exclude deleted file mode 100644 index e1fcd1a..0000000 --- a/org.glite.security.proxyrenewal/project/tar_exclude +++ /dev/null @@ -1,10 +0,0 @@ -tar_exclude -CVS -build.xml -build -build.properties -properties.xml -configure.properties.xml -.cvsignore -.project -.cdtproject diff --git a/org.glite.security.proxyrenewal/project/taskdefs.xml b/org.glite.security.proxyrenewal/project/taskdefs.xml deleted file mode 100755 index 13e894e..0000000 --- a/org.glite.security.proxyrenewal/project/taskdefs.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/org.glite.security.proxyrenewal/project/version.properties b/org.glite.security.proxyrenewal/project/version.properties deleted file mode 100644 index 1441742..0000000 --- a/org.glite.security.proxyrenewal/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=1.3.0 -module.age=1 diff --git a/org.glite.security.proxyrenewal/src/api.c b/org.glite.security.proxyrenewal/src/api.c deleted file mode 100644 index a72d692..0000000 --- a/org.glite.security.proxyrenewal/src/api.c +++ /dev/null @@ -1,550 +0,0 @@ -#include "renewal.h" -#include "renewal_locl.h" - -#ident "$Header$" - -#define SEPARATORS "\n" - -/* prototypes of static routines */ -static int -encode_request(edg_wlpr_Request *request, char **msg); - -static int -decode_response(const char *msg, const size_t msg_len, edg_wlpr_Response *response); - -static int -do_connect(char *socket_name, struct timeval *timeout, int *sock); - -static int -send_request(int sock, struct timeval *timeout, edg_wlpr_Request *request, edg_wlpr_Response *response); - -static int -encode_request(edg_wlpr_Request *request, char **msg) -{ - char *buf; - size_t buf_len; - int ret; - - buf_len = EDG_WLPR_BUF_SIZE; - buf = malloc(buf_len); - if (buf == NULL) - return ENOMEM; - buf[0] = '\0'; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_VERSION, - EDG_WLPR_VERSION, SEPARATORS); - if (ret) - goto err; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_COMMAND, - edg_wlpr_EncodeInt(request->command), - SEPARATORS); - if (ret) - goto err; - - if (request->myproxy_server) { - char host[1024]; - -#if 0 - snprintf(host, sizeof(host), "%s:%d", request->myproxy_server, - (request->myproxy_port) ? request->myproxy_port : EDG_WLPR_MYPROXY_PORT); /* XXX let server decide ? */ -#else - snprintf(host, sizeof(host), "%s", request->myproxy_server); -#endif - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - host, SEPARATORS); - if (ret) - goto err; - } - - if (request->proxy_filename) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_PROXY, - request->proxy_filename, SEPARATORS); - if (ret) - goto err; - } - - if (request->jobid) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_JOBID, - request->jobid, SEPARATORS); - if (ret) - goto err; - } - - if (request->entries) { - char **p = request->entries; - while (*p) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_ENTRY, - *p, SEPARATORS); - if (ret) - goto err; - p++; - } - } - - buf[strlen(buf)] = '\0'; - *msg = buf; - return 0; - -err: - free(buf); - *msg = NULL; - return ret; -} - -static int -decode_response(const char *msg, const size_t msg_len, edg_wlpr_Response *response) -{ - int ret; - char *value = NULL; - /* char *p; */ - int i; - int current_size = 0; - - /* XXX add an ending zero '\0' */ - - assert(msg != NULL); - assert(response != NULL); - - memset(response, 0, sizeof(*response)); - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_VERSION, SEPARATORS, - 0, &response->version); - if (ret) - goto err; - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_RESPONSE, SEPARATORS, - 0, &value); - if (ret) - goto err; - - ret = edg_wlpr_DecodeInt(value, (int *)(&response->response_code)); - free(value); - if (ret) - goto err; - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - SEPARATORS, 0, &response->myproxy_server); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - -#if 0 - response->myproxy_port = EDG_WLPR_MYPROXY_PORT; /* ??? */ - if (response->myproxy_server && (p = strchr(response->myproxy_server, ':'))) { - int port; - *p = '\0'; - port = atol(p+1); /* XXX */ - response->myproxy_port = port; - } -#endif - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_START_TIME, SEPARATORS, - 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (ret == 0) { - ret = edg_wlpr_DecodeInt(value, (int *)(&response->start_time)); - free(value); - if (ret) - goto err; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_END_TIME, SEPARATORS, - 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (ret == 0) { - ret = edg_wlpr_DecodeInt(value, (int *)(&response->end_time)); - free(value); - if (ret) - goto err; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_RENEWAL_TIME, - SEPARATORS, 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (ret == 0) { - ret = edg_wlpr_DecodeInt(value, (int *)(&response->next_renewal_time)); - free(value); - if (ret) - goto err; - } - - /* XXX Counter */ - - i = 0; - while ((ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_PROXY, - SEPARATORS, i, &value)) == 0) { - if (i >= current_size) { - char **tmp; - - tmp = realloc(response->filenames, - (current_size + 16 + 1) * sizeof(*tmp)); - if (tmp == NULL) { - ret = ENOMEM; - goto err; - } - response->filenames = tmp; - current_size += 16; - } - response->filenames[i] = value; - i++; - } - if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (response->filenames) - response->filenames[i] = NULL; - - return 0; - -err: - edg_wlpr_CleanResponse(response); - - return ret; -} - -static int -do_connect(char *socket_name, struct timeval *timeout, int *sock) -{ - struct sockaddr_un my_addr; - int s; - int ret; - struct timeval before,after; - int sock_err; - socklen_t err_len; - - assert(sock != NULL); - memset(&my_addr, 0, sizeof(my_addr)); - - s = socket(AF_UNIX, SOCK_STREAM, 0); - if (s == -1) { - return errno; - } - - if (timeout) { - int flags = fcntl(s, F_GETFL, 0); - if (fcntl(s, F_SETFL, flags | O_NONBLOCK) < 0) - return errno; - } - - my_addr.sun_family = AF_UNIX; - strncpy(my_addr.sun_path, socket_name, sizeof(my_addr.sun_path)); - - ret = connect(s, (struct sockaddr *) &my_addr, sizeof(my_addr)); - if (ret == -1) { - if (errno == EINPROGRESS) { - struct pollfd pollfds[1]; - - pollfds[0].fd = s; - pollfds[0].events = POLLOUT; - - gettimeofday(&before,NULL); - switch (poll(pollfds, 1, timeout->tv_sec*1000+timeout->tv_usec/1000)) { - case -1: close(s); - return errno; - case 0: close(s); - return EDG_WLPR_ERROR_TIMEOUT; - } - gettimeofday(&after,NULL); - if (edg_wlpr_DecrementTimeout(timeout, before, after)) { - close (s); - return EDG_WLPR_ERROR_TIMEOUT; - } - - err_len = sizeof sock_err; - if (getsockopt(s,SOL_SOCKET,SO_ERROR,&sock_err,&err_len)) { - close(s); - return errno; - } - if (sock_err) { - close(s); - errno = sock_err; - return errno; - } - } else { - close(s); - return errno; - } - } - - *sock = s; - return 0; -} - -static int -send_request(int sock, struct timeval *timeout, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - int ret; - char *buf = NULL; - size_t buf_len; - - /* timeouts ?? */ - - ret = encode_request(request, &buf); - if (ret) - return ret; - - ret = edg_wlpr_Write(sock, timeout, buf, strlen(buf) + 1); - free(buf); - if (ret) - return ret; - - ret = edg_wlpr_Read(sock, timeout, &buf, &buf_len); - if (ret) - return ret; - - ret = decode_response(buf, buf_len, response); - free(buf); - if (ret) - return ret; - - return 0; -} - -int -edg_wlpr_RequestSend(edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - char sockname[1024]; - int ret; - int sock; - struct timeval timeout; - const char *s = NULL; - double d; - - s = getenv("GLITE_PR_TIMEOUT"); - d = s ? atof(s) : GLITE_PR_TIMEOUT_DEFAULT; - timeout.tv_sec = (long) d; - timeout.tv_usec = (long) ((d-timeout.tv_sec) * 1e6); - - snprintf(sockname, sizeof(sockname), "%s%d", - DGPR_REG_SOCKET_NAME_ROOT, getuid()); - ret = do_connect(sockname, &timeout, &sock); - if (ret) - return ret; - - ret = send_request(sock, &timeout, request, response); - - close(sock); - return ret; -} - -int -glite_renewal_RegisterProxy(const char *filename, const char * server, - unsigned int port, - const char *jobid, int flags, - char **repository_filename) -{ - edg_wlpr_Request request; - edg_wlpr_Response response; - int ret; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - if (jobid == NULL) - return EINVAL; - - request.command = EDG_WLPR_COMMAND_REG; - request.myproxy_server = server; - request.proxy_filename = filename; - request.jobid = strdup(jobid); - if (request.jobid == NULL) - return ENOMEM; - - ret = edg_wlpr_RequestSend(&request, &response); - free(request.jobid); - if (ret == 0 && response.response_code == 0 && repository_filename && - response.filenames && response.filenames[0] ) - *repository_filename = strdup(response.filenames[0]); - - if (ret == 0) - ret = response.response_code; - - edg_wlpr_CleanResponse(&response); - - return ret; -} - -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_RegisterProxyExt(const char *filename, const char * server, - unsigned int port, - edg_wlc_JobId jobid, int flags, - char **repository_filename) -{ - char *ji; - int ret; - - ji = edg_wlc_JobIdUnparse(jobid); - if (ji == NULL) - return EINVAL; - - ret = glite_renewal_RegisterProxy(filename, server, port, ji, flags, - repository_filename); - free(ji); - return ret; -} -#endif /* RENEWAL_HAVE_JOBID */ - -#if 0 -int -edg_wlpr_RegisterProxy(const char *filename, const char *jdl, - int flags, char **repository_filename) -{ - char server[1024]; - size_t server_len; - unsigned int port = 0; - char *p, *q; - - memset(server, 0, sizeof(server)); - - /* parse JDL and find information about myproxy server */ - p = strstr(jdl, JDL_MYPROXY); - if (p == NULL) - return 0; /* XXX */ - q = strchr(p, '\n'); /* XXX */ - if (q) - server_len = q - p; - else - server_len = jdl + strlen(jdl) - p; - if (server_len >= sizeof(server)) - return EINVAL; /* XXX */ - strncmp(server, p, sizeof(server)); - - return (edg_wlpr_RegisterProxyExt(filename, server, port, NULL, flags, - repository_filename)); -} -#endif - -int -glite_renewal_UnregisterProxy(const char *jobid, const char *repository_filename) -{ - edg_wlpr_Request request; - edg_wlpr_Response response; - int ret; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - if (jobid == NULL) - return EINVAL; - - request.command = EDG_WLPR_COMMAND_UNREG; - request.proxy_filename = repository_filename; - request.jobid = strdup(jobid); - if (request.jobid == NULL) - return ENOMEM; - - ret = edg_wlpr_RequestSend(&request, &response); - free(request.jobid); - - if (ret == 0) - ret = response.response_code; - edg_wlpr_CleanResponse(&response); - - return ret; -} - -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_UnregisterProxy(edg_wlc_JobId jobid, const char *repository_filename) -{ - char *ji; - int ret; - - ji = edg_wlc_JobIdUnparse(jobid); - if (ji == NULL) - return EINVAL; - ret = glite_renewal_UnregisterProxy(ji, repository_filename); - free(ji); - return ret; -} -#endif /* RENEWAL_HAVE_JOBID */ - -int -edg_wlpr_GetList(int *count, char **list) -{ - return ENOSYS; /* XXX */ -} - -int -edg_wlpr_GetStatus(const char *filename, char **info) -{ - return ENOSYS; /* XXX */ -} - -static const char* const errTexts[] = { - "Unexpected EOF from peer", - "Generic error", - "Protocol parse error", - "Compulsory element not found in message", - "Unknown protocol command", - "SSL error", - "Error from Myproxy server", - "Proxy not registered", - "Proxy expired", - "VOMS error", - "Operation timed out", - "System error" -}; - -const char * -edg_wlpr_GetErrorText(int code) -{ - return code ? - (code <= EDG_WLPR_ERROR_BASE ? - strerror(code) : - errTexts[code - EDG_WLPR_ERROR_BASE - 1] - ) : - NULL; -} - -int -glite_renewal_GetProxy(const char *jobid, char **repository_filename) -{ - edg_wlpr_Request request; - edg_wlpr_Response response; - int ret; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - if (jobid == NULL) - return EINVAL; - - request.command = EDG_WLPR_COMMAND_GET; - request.jobid = strdup(jobid); - if (request.jobid == NULL) - return ENOMEM; - - ret = edg_wlpr_RequestSend(&request, &response); - free(request.jobid); - - if (ret == 0 && response.response_code == 0 && repository_filename && - response.filenames && response.filenames[0] ) - *repository_filename = strdup(response.filenames[0]); - - if (ret == 0) - ret = response.response_code; - edg_wlpr_CleanResponse(&response); - - return ret; -} - -#ifdef RENEWAL_HAVE_JOBID -int -edg_wlpr_GetProxy(edg_wlc_JobId jobid, char **repository_filename) -{ - char *ji; - int ret; - - ji = edg_wlc_JobIdUnparse(jobid); - if (ji == NULL) - return EINVAL; - - ret = glite_renewal_GetProxy(ji, repository_filename); - free(ji); - return ret; -} -#endif /* RENEWAL_HAVE_JOBID */ diff --git a/org.glite.security.proxyrenewal/src/client.c b/org.glite.security.proxyrenewal/src/client.c deleted file mode 100644 index 87efd78..0000000 --- a/org.glite.security.proxyrenewal/src/client.c +++ /dev/null @@ -1,111 +0,0 @@ -#include -#include -#include -#include -#include "renewal.h" - -static const char rcsid[] = "$Header$"; - -static struct option const long_options[] = { - { "help", no_argument, 0, 'h' }, - { "version", no_argument, 0, 'v' }, - { "server", required_argument, 0, 's' }, - { "port", required_argument, 0, 'p' }, - { "file", required_argument, 0, 'f' }, - { "jobid", required_argument, 0, 'j' }, - { NULL, 0, NULL, 0} -}; - -static char short_options[] = "hvs:p:f:j:"; - -static void -usage(exit_code) -{ - fprintf(stdout, "Usage: edg-wl-renew [option] operation\n" - "\t-s myproxy_server [-p port] -f filename -j jobid start |\n" - "\t-j jobid [-f filename] stop |\n" - "\t-j jobid get\n" - "-h, --help display this help and exit\n" - "-v, --version output version information and exit\n" - "-s, --server address of myproxy server\n" - "-p, --port port of myproxy server\n" - "-f, --file filename with proxy\n" - "-j, --jobid datagrid jobid\n"); - exit(exit_code); -} - -int -main(int argc, char *argv[]) -{ - char *server = NULL; - int port = 0; - char *proxyfile = NULL; - char *jobid_str = NULL; - char *repository_filename = NULL; - int ret; - int arg; - extern int optind; - - while ((arg = getopt_long(argc, argv, - short_options, long_options, (int *) 0)) != EOF) - switch(arg) { - case 'h': - usage(0); break; - case 'v': - fprintf(stdout, "%s:\t%s\n", argv[0], rcsid); exit(0); - case 's': - server = strdup(optarg); break; - case 'p': - port = atoi(optarg); break; - case 'f': - proxyfile = strdup(optarg); break; - case 'j': - jobid_str = strdup(optarg); break; - default: - usage(1); break; - } - - if (optind >= argc) - usage(1); - - if (strcmp(argv[optind], "start") == 0) { - if (proxyfile == NULL || server == NULL || jobid_str == NULL) - usage(1); - ret = glite_renewal_RegisterProxy(proxyfile, server, port, jobid_str, 0, - &repository_filename); - if (ret) { - fprintf(stderr, "Registering proxy failed: %s\n", - edg_wlpr_GetErrorText(ret)); - exit(1); - } - printf("%s\n", repository_filename); - free(repository_filename); - exit(0); - } - else if (strcmp(argv[optind], "stop") == 0) { - if (jobid_str == NULL) - usage(1); - ret = glite_renewal_UnregisterProxy(jobid_str, proxyfile); - if (ret) { - fprintf(stderr, "Unregistering proxy failed: %s\n", - edg_wlpr_GetErrorText(ret)); - exit(1); - } - } - else if (strcmp(argv[optind], "get") == 0) { - if (jobid_str == NULL) - usage(1); - ret = glite_renewal_GetProxy(jobid_str, &proxyfile); - if (ret) { - fprintf(stderr, "GET request failed: %s\n", - edg_wlpr_GetErrorText(ret)); - exit(1); - } - printf("%s\n", proxyfile); - free(proxyfile); - } - else - usage(1); - - return 0; -} diff --git a/org.glite.security.proxyrenewal/src/commands.c b/org.glite.security.proxyrenewal/src/commands.c deleted file mode 100644 index abc4809..0000000 --- a/org.glite.security.proxyrenewal/src/commands.c +++ /dev/null @@ -1,1256 +0,0 @@ -#include "renewal_locl.h" -#include "renewd_locl.h" - -#include "glite/security/voms/voms_apic.h" - -#ident "$Header$" - -#define SEPARATORS ",\n" -#define RENEWAL_START_FRACTION 0.75 /* XXX */ -#define RENEWAL_MIN_LIFETIME (15 * 60) - -extern char *repository; -extern time_t condor_limit; -extern char *cadir; -extern char *vomsdir; -extern int voms_enabled; - -static char * -strmd5(glite_renewal_core_context ctx, const char *s, unsigned char *digest); - -static int -get_record_ext(glite_renewal_core_context ctx, FILE *fd, proxy_record *record, int *last_used_suffix); - -static int -get_record(glite_renewal_core_context ctx, FILE *fd, proxy_record *record); - -static int -store_record(glite_renewal_core_context ctx, char *basename, proxy_record *record); - -static int -copy_file_content(glite_renewal_core_context ctx, FILE *in, FILE *out); - -static int -copy_file(glite_renewal_core_context ctx, char *src, char *dst); - -static int -get_base_filename(glite_renewal_core_context ctx, char *proxy_file, char **basefilename); - -int -decode_record(glite_renewal_core_context ctx, char *line, proxy_record *record); - -int -encode_record(glite_renewal_core_context ctx, proxy_record *record, char **line); - -static int -open_metafile(glite_renewal_core_context ctx, char *proxy_file, FILE **fd); - -void -free_record(glite_renewal_core_context ctx, proxy_record *record); - -static int -realloc_prd_list(glite_renewal_core_context ctx, prd_list *list); - -/* make public: */ -static int -edg_wlpr_GetTokenInt(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, int *value); - -static void -record_to_response(glite_renewal_core_context ctx, int status_code, proxy_record *record, - edg_wlpr_Response *response); - -static int -filename_to_response(glite_renewal_core_context ctx, char *filename, edg_wlpr_Response *response); - - - - -static char * -strmd5(glite_renewal_core_context ctx, const char *s, unsigned char *digest) -{ - MD5_CTX md5; - unsigned char d[16]; - int i; - static char mbuf[33]; - - MD5_Init(&md5); - MD5_Update(&md5,s,strlen(s)); - MD5_Final(d,&md5); - - if (digest) - memcpy(digest,d,sizeof(d)); - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - mbuf[32] = 0; - return mbuf; -} - -static int -get_base_filename(glite_renewal_core_context ctx, char *proxy_file, char **basefilename) -{ - char *subject = NULL; - char file[FILENAME_MAX]; - int ret; - - assert(basefilename != NULL); - - ret = glite_renewal_get_proxy_base_name(ctx, proxy_file, &subject); - if (ret) - goto end; - - snprintf(file, sizeof(file), "%s/%s", repository, strmd5(ctx, subject, NULL)); - *basefilename = strdup(file); /* XXX test ENOMEM */ - ret = 0; - -end: - if (subject) - free(subject); - return ret; -} - -static int -copy_file_content(glite_renewal_core_context ctx, FILE *in, FILE *out) -{ - char buf[1024]; - size_t num; - int ret; - - while (1) { - num = fread(buf, sizeof(*buf), sizeof(buf), in); - if ((ret = ferror(in))) { - glite_renewal_log(ctx, LOG_ERR, "Reading failed: %s", strerror(errno)); - return ret; - } - num = fwrite(buf, sizeof(*buf), num, out); - if ((ret = ferror(in))) { - glite_renewal_log(ctx, LOG_ERR, "Writing failed: %s", strerror(errno)); - return ret; - } - if (feof(in)) - return 0; - } -} - -/* return the time interval, after which the renewal should be started */ -static time_t -get_delta(glite_renewal_core_context ctx, time_t current_time, time_t start_time, time_t end_time) -{ - time_t remaining_life; - time_t life_to_lose; - time_t limit; - time_t delta; - - if (RENEWAL_MIN_LIFETIME > condor_limit) { - limit = RENEWAL_MIN_LIFETIME; - } else { - limit = condor_limit; - } - - limit += RENEWAL_CLOCK_SKEW; - - if (current_time + limit >= end_time) { - /* if the proxy is too short, renew it as soon as possible */ - - if (current_time + condor_limit > end_time ) { - glite_renewal_log(ctx, LOG_ERR, "Remaining proxy lifetime fell below the value of the Condor limit!"); - } - - return 0; - } - - remaining_life = end_time - current_time; - - /* renewal should gain the jobs an extra lifetime of - RENEWAL_START_FRACTION (default 3/4) of the new proxy's - lifetime. If the time remaining on the current proxy is already - small then the jobs may gain an extra lifetime of more than that. - - In any case, a renewal will be scheduled to happen before the - lifetime limit. - - 'life_to_lose' is the lifetime that will be lost, ie the time that - will still remain on the current proxy when it is renewed - */ - - life_to_lose = (1.0-RENEWAL_START_FRACTION)*60*60*DGPR_RETRIEVE_DEFAULT_HOURS; - - if (life_to_lose < limit) { - life_to_lose = limit; - } - - delta = life_to_lose - limit; - - while( remaining_life < (limit + delta) ) { - delta *= (1.0-RENEWAL_START_FRACTION); - } - - life_to_lose = limit + delta; - - return (remaining_life - life_to_lose); -} - -int -get_times(glite_renewal_core_context ctx, char *proxy_file, proxy_record *record) -{ - FILE *fd; - X509 *cert = NULL; - ASN1_UTCTIME *asn1_time = NULL; - int ret; - time_t current_time, start_time, end_time; - - assert(record != NULL); - assert(proxy_file != NULL); - - fd = fopen(proxy_file, "r"); - if (fd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Opening proxy file %s failed: %s", - proxy_file, strerror(errno)); - return errno; - } - - cert = PEM_read_X509(fd, NULL, NULL, NULL); - if (cert == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot read X.509 certificate from %s", - proxy_file); - ret = -1; /* XXX SSL_ERROR */ - goto end; - } - - asn1_time = ASN1_UTCTIME_new(); - X509_gmtime_adj(asn1_time,0); - globus_gsi_cert_utils_make_time(X509_get_notAfter(cert), &end_time); - globus_gsi_cert_utils_make_time(X509_get_notBefore(cert), &start_time); - current_time = time(NULL); - ASN1_UTCTIME_free(asn1_time); - /* if (end_time - RENEWAL_CLOCK_SKEW < current_time) { Too short proxy } */ - if (end_time + RENEWAL_CLOCK_SKEW < current_time) { - glite_renewal_log(ctx, LOG_ERR, "Expired proxy in %s", proxy_file); - ret = EDG_WLPR_PROXY_EXPIRED; - goto end; - } - - /* Myproxy seems not to do check on expiration and return expired proxies - if credentials in repository are expired */ - X509_free(cert); - cert = NULL; - while (1) { - time_t tmp_end; - /* see http://www.openssl.org/docs/crypto/pem.html section BUGS */ - cert = PEM_read_X509(fd, NULL, NULL, NULL); - if (cert == NULL) { - if (ERR_GET_REASON(ERR_peek_error()) == PEM_R_NO_START_LINE) { - /* End of file reached. no error */ - ERR_clear_error(); - break; - } - glite_renewal_log(ctx, LOG_ERR, "Cannot read additional certificates from %s", - proxy_file); - ret = -1; /* XXX SSL_ERROR */ - goto end; - } - globus_gsi_cert_utils_make_time(X509_get_notAfter(cert), &tmp_end); - if (tmp_end + RENEWAL_CLOCK_SKEW < current_time) { - glite_renewal_log(ctx, LOG_ERR, "Expired proxy in %s", proxy_file); - ret = EDG_WLPR_PROXY_EXPIRED; - goto end; - } - X509_free(cert); - cert = NULL; - } - - record->next_renewal = current_time + get_delta(ctx, current_time, start_time, - end_time); - record->end_time = end_time; - ret = 0; - -end: - fclose(fd); - if (cert) - X509_free(cert); - - return ret; -} - -static int -copy_file(glite_renewal_core_context ctx, char *src, char *dst) -{ - FILE *from = NULL; - FILE *tmp_to = NULL; - int tmp_fd; - char tmpfile[FILENAME_MAX]; - int ret; - - if (strcmp(src, dst) == 0) - return 0; - - from = fopen(src, "r"); - if (from == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open file %s for reading (%s)", - src, strerror(errno)); - return errno; - } - - snprintf(tmpfile, sizeof(tmpfile), "%s.XXXXXX", dst); - tmp_fd = mkstemp(tmpfile); - if (tmp_fd == -1) { - glite_renewal_log(ctx, LOG_ERR, "Cannot create temporary file (%s)", - strerror(errno)); - ret = errno; - goto end; - } - - - tmp_to = fdopen(tmp_fd, "w"); - if (tmp_to == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot associate stream with temporary file (%s)", - strerror(errno)); - unlink(tmpfile); - ret = errno; - goto end; - } - - ret = copy_file_content(ctx, from, tmp_to); - fclose(tmp_to); - if (ret) { - goto end; - } - - ret = rename(tmpfile, dst); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Cannot replace repository file %s with temporary file (%s)", - strerror(errno)); - unlink(tmpfile); - ret = errno; - goto end; - } - tmp_to = NULL; - -end: - fclose(from); - close(tmp_fd); - unlink(tmpfile); - - return ret; -} - -void -free_record(glite_renewal_core_context ctx, proxy_record *record) -{ - int i; - - if (record == NULL) - return; - if (record->myproxy_server) - free(record->myproxy_server); - if (record->jobids.val) { - for (i = 0; i < record->jobids.len; i++) - free(record->jobids.val[i]); - free(record->jobids.val); - } - memset(record, 0, sizeof(*record)); -} - -static int -realloc_prd_list(glite_renewal_core_context ctx, prd_list *list) -{ - char **tmp; - - tmp = realloc(list->val, (list->len + 1) * sizeof(*list->val)); - if (tmp == NULL) - return ENOMEM; - list->val = tmp; - list->len++; - return 0; -} - -static int -get_jobids(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, proxy_record *record) -{ - int index = 0; - int ret; - char *value; - char **tmp; - - memset(&record->jobids, 0, sizeof(record->jobids)); - while ((ret = edg_wlpr_GetToken(msg, msg_len, "jobid=", SEPARATORS, - index, &value)) == 0) { - tmp = realloc(record->jobids.val, (record->jobids.len + 1) * sizeof(*tmp)); - if (tmp == NULL) { - ret = ENOMEM; - break; - } - record->jobids.val = tmp; - record->jobids.val[index] = value; - record->jobids.len++; - index++; - } - if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - if (record->jobids.len) - free(record->jobids.val); - record->jobids.len = 0; - record->jobids.val = NULL; - return ret; - } - - return 0; -} - -static int -edg_wlpr_GetTokenInt(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, int *value) -{ - int ret; - char *str_value = NULL; - - ret = edg_wlpr_GetToken(msg, msg_len, key, separators, req_index, &str_value); - if (ret) - return ret; - - ret = edg_wlpr_DecodeInt(str_value, value); - free(str_value); - return ret; -} - -int -decode_record(glite_renewal_core_context ctx, char *line, proxy_record *record) -{ - /* line must be ended with '\0' */ - int ret; - size_t len; - - assert(line != NULL); - assert(record != NULL); - - memset(record, 0, sizeof(*record)); - - len = strlen(line) + 1; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "suffix=", SEPARATORS, 0, - &record->suffix); - if (ret) - return ret; - -#if 0 - ret = edg_wlpr_GetTokenInt(ctx, line, len, "counter=", SEPARATORS, 0, - &record->counter); - if (ret) - goto end; -#endif - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "unique=", SEPARATORS, 0, - &record->unique); - if (ret) - goto end; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "voms_exts=", SEPARATORS, 0, - &record->voms_exts); - - ret = edg_wlpr_GetToken(line, len, "server=", SEPARATORS, 0, - &record->myproxy_server); - if (ret) - goto end; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "next_renewal=", SEPARATORS, 0, - (int *)&record->next_renewal); - if (ret) - goto end; - - ret = edg_wlpr_GetTokenInt(ctx, line, len, "end_time=", SEPARATORS, 0, - (int *)&record->end_time); - if (ret) - goto end; - - ret = get_jobids(ctx, line, len, record); - if (ret) - goto end; - -end: - if (ret) - free_record(ctx, record); - - return ret; -} - -int -encode_record(glite_renewal_core_context ctx, proxy_record *record, char **line) -{ - char tmp_line[1024]; - size_t jobids_len = 0; - int i; - - snprintf(tmp_line, sizeof(tmp_line), "suffix=%d, unique=%d, voms_exts=%d, server=%s, next_renewal=%ld, end_time=%ld", - record->suffix, record->unique, record->voms_exts, - (record->myproxy_server) ? record->myproxy_server : "", - record->next_renewal, record->end_time); - for (i = 0; i < record->jobids.len; i++) - /* alloc space for string ", jobid=" */ - jobids_len += 2 + strlen("jobid=") + strlen(record->jobids.val[i]); - - *line = calloc(1, strlen(tmp_line) + jobids_len + 1); - if (*line == NULL) - return ENOMEM; - - strcat(*line, tmp_line); - memset(tmp_line, 0, sizeof(tmp_line)); - - for (i = 0; i < record->jobids.len; i++) { - snprintf(tmp_line, sizeof(tmp_line), ", jobid=%s", record->jobids.val[i]); - strcat(*line, tmp_line); - } - - return 0; -} - -/* Get proxy record from the index file. If no suffix is defined return a free - record with the smallest index */ -static int -get_record_ext(glite_renewal_core_context ctx, FILE *fd, proxy_record *record, int *last_used_suffix) -{ - char line[1024]; - int last_suffix = -1; - int ret; - char *p; - proxy_record tmp_record; - time_t current_time; - int line_num = 0; - - assert(record != NULL); - memset(&tmp_record, 0, sizeof(tmp_record)); - - current_time = time(NULL); - while (fgets(line, sizeof(line), fd) != NULL) { - line_num++; - free_record(ctx, &tmp_record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, line, &tmp_record); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Skipping invalid entry at line %d", line_num); - continue; - } - if (record->suffix >= 0) { - if (record->suffix == tmp_record.suffix) { - record->suffix = tmp_record.suffix; - record->jobids.len = tmp_record.jobids.len; - record->jobids.val = tmp_record.jobids.val; - record->unique = tmp_record.unique; - record->voms_exts = tmp_record.voms_exts; - if (record->myproxy_server) - free(record->myproxy_server); - record->myproxy_server = tmp_record.myproxy_server; - record->end_time = tmp_record.end_time; - record->next_renewal = tmp_record.next_renewal; - return 0; - } else - continue; - } - if (tmp_record.suffix > last_suffix) - last_suffix = tmp_record.suffix; - - /* if no particular suffix was specified get the first free record - available */ - if (tmp_record.jobids.len >= MAX_PROXIES || tmp_record.unique || - tmp_record.voms_exts) - continue; - - if (tmp_record.jobids.len == 0) { - /* no jobs registered for this record, so use it initialized with the - * parameters (currently myproxy location) provided by user */ - record->suffix = tmp_record.suffix; - record->next_renewal = record->end_time = 0; - free_record(ctx, &tmp_record); - return 0; - } - - /* Proxies with VOMS attributes require a separate record, which is not - * shared with another proxies. The same applies it the unique flag was - * set by the caller */ - if (record->voms_exts || record->unique) - continue; - - if (tmp_record.jobids.len > 0 && record->myproxy_server && - strcmp(record->myproxy_server, tmp_record.myproxy_server) != 0) - continue; - - if (tmp_record.jobids.len > 0 && - current_time + condor_limit + RENEWAL_CLOCK_SKEW > tmp_record.end_time) { - - /* skip expired proxy (or ones that are going to expire soon), - leaving it untouched (it will be removed after next run of the - renewal process) */ - - continue; - } - - record->suffix = tmp_record.suffix; - record->jobids.len = tmp_record.jobids.len; - record->jobids.val = tmp_record.jobids.val; - record->unique = tmp_record.unique; - record->voms_exts = tmp_record.voms_exts; - if (record->myproxy_server) - free(record->myproxy_server); - record->myproxy_server = tmp_record.myproxy_server; - record->end_time = tmp_record.end_time; - record->next_renewal = tmp_record.next_renewal; - return 0; - } - - if (last_used_suffix) - *last_used_suffix = last_suffix; - - if (record->suffix >= 0) { - glite_renewal_log(ctx, LOG_DEBUG, "Requested suffix %d not found in meta file", - record->suffix); - } - - free_record(ctx, &tmp_record); - - return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND; -} - -static int -get_record(glite_renewal_core_context ctx, FILE *fd, proxy_record *record) -{ - return get_record_ext(ctx, fd, record, NULL); -} - -static int -store_record(glite_renewal_core_context ctx, char *basename, proxy_record *record) -{ - int stored = 0; - FILE *fd = NULL; - int temp; - char line[1024]; - char *new_line = NULL; - int ret, i; - char *p; - proxy_record tmp_record; - char tmp_file[FILENAME_MAX]; - char meta_file[FILENAME_MAX]; - int line_num = 0; - - assert (record != NULL); - - memset(&tmp_record, 0, sizeof(tmp_record)); - - snprintf(meta_file, sizeof(meta_file), "%s.data", basename); - snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", meta_file); - - temp = mkstemp(tmp_file); - if (temp < 0) - return errno; - - fd = fopen(meta_file, "r"); - if (fd == NULL) { - ret = errno; - goto end; - } - while (fgets(line, sizeof(line), fd) != NULL) { - line_num++; - free_record(ctx, &tmp_record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, line, &tmp_record); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Removing invalid entry at line %d in %s", line_num, basename); - continue; - } - if (record->suffix == tmp_record.suffix && - record->unique == tmp_record.unique) { - tmp_record.next_renewal = record->next_renewal; - tmp_record.end_time = record->end_time; - tmp_record.voms_exts = record->voms_exts; - if (tmp_record.myproxy_server != NULL) - free(tmp_record.myproxy_server); - tmp_record.myproxy_server = strdup(record->myproxy_server); - if (tmp_record.jobids.val) { - for (i = 0; i < tmp_record.jobids.len; i++) - free(tmp_record.jobids.val[i]); - free(tmp_record.jobids.val); - } - tmp_record.jobids.len = 0; - tmp_record.jobids.val = NULL; - for (i = 0; i < record->jobids.len; i++) { - realloc_prd_list(ctx, &tmp_record.jobids); - tmp_record.jobids.val[tmp_record.jobids.len - 1] = - strdup(record->jobids.val[i]); - } - stored = 1; - } - ret = encode_record(ctx, &tmp_record, &new_line); - if (ret) - goto end; - dprintf(temp, "%s\n", new_line); - free(new_line); - new_line = NULL; - } - if (! stored) { - ret = encode_record(ctx, record, &new_line); - if (ret) - goto end; - ret = dprintf(temp, "%s\n", new_line); - free(new_line); - new_line = NULL; - } - fclose(fd); fd = NULL; - close(temp); - - ret = rename(tmp_file, meta_file); - if (ret) - ret = errno; - -end: - free_record(ctx, &tmp_record); - if (fd) - fclose(fd); - close(temp); - return ret; -} - -static int -open_metafile(glite_renewal_core_context ctx, char *basename, FILE **fd) -{ - FILE *meta_fd; - char meta_filename[FILENAME_MAX]; - - snprintf(meta_filename, sizeof(meta_filename), "%s.data", basename); - meta_fd = fopen(meta_filename, "a+"); - if (meta_fd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Opening meta file %s failed (%s)", - meta_filename, strerror(errno)); - return errno; - } - rewind(meta_fd); - *fd = meta_fd; - glite_renewal_log(ctx, LOG_DEBUG, "Using meta file %s", meta_filename); - return 0; -} - -static int -filename_to_response(glite_renewal_core_context ctx, char *filename, edg_wlpr_Response *response) -{ - response->filenames = malloc(2 * sizeof(*response->filenames)); - if (response->filenames == NULL) { - glite_renewal_log(ctx, LOG_DEBUG, "Not enough memory"); - return errno; - } - response->filenames[0] = strdup(filename); - if (response->filenames[0] == NULL) { - glite_renewal_log(ctx, LOG_DEBUG, "Not enough memory"); - free(response->filenames); - return errno; - } - response->filenames[1] = NULL; - return 0; -} - -static void -record_to_response(glite_renewal_core_context ctx, int status_code, proxy_record *record, - edg_wlpr_Response *response) -{ - /* XXX Neni struktrura proxy_record zbytecna? Mohla by se pouzivat primo - edg_wlpr_Response? */ - response->response_code = status_code; /* XXX chyba parsovatelna pres API */ - if (status_code) - return; - - if (response->myproxy_server) { - response->myproxy_server = strdup(record->myproxy_server); - if (response->myproxy_server == NULL) { - response->response_code = ENOMEM; /* XXX */ - return; - } - } - response->end_time = record->end_time; - response->next_renewal_time = record->next_renewal; - /* XXX use jobid response->counter = record->counter; */ -} - -int -check_proxyname(glite_renewal_core_context ctx, char *datafile, char *jobid, char **filename) -{ - proxy_record record; - FILE *meta_fd = NULL; - char line[1024]; - char proxy[FILENAME_MAX]; - char *p; - int ret, i; - - memset(&record, 0, sizeof(record)); - - meta_fd = fopen(datafile, "r"); - if (meta_fd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - datafile, strerror(errno)); - return errno; - } - - while (fgets(line, sizeof(line), meta_fd) != NULL) { - free_record(ctx, &record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, line, &record); - if (ret) - continue; /* XXX exit? */ - for (i = 0; i < record.jobids.len; i++) { - if (strcmp(jobid, record.jobids.val[i]) == 0) { - snprintf(proxy, sizeof(proxy), "%s/%s", repository, datafile); - p = strrchr(proxy, '.'); - sprintf(p, ".%d", record.suffix); - *filename = strdup(proxy); - free_record(ctx, &record); - fclose(meta_fd); - return 0; - } - } - } - free_record(ctx, &record); - fclose(meta_fd); - return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND; -} - -int -find_proxyname(glite_renewal_core_context ctx, char *jobid, char **filename) -{ - DIR *dir = NULL; - struct dirent *file; - int ret; - - chdir(repository); - - dir = opendir(repository); - if (dir == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open repository directory %s (%s)", - repository, strerror(errno)); - return errno; - } - - while ((file = readdir(dir))) { - /* read files of format `md5sum`.data, where md5sum() is of fixed length - 32 chars */ - if (file->d_name == NULL || strlen(file->d_name) != 37 || - strcmp(file->d_name + 32, ".data") != 0) - continue; - ret = check_proxyname(ctx, file->d_name, jobid, filename); - if (ret == 0) { - closedir(dir); - return 0; - } - } - closedir(dir); - glite_renewal_log(ctx, LOG_ERR, "Requested proxy is not registered"); - return EDG_WLPR_PROXY_NOT_REGISTERED; -} - -#ifdef NOVOMS -int -find_voms_cert(glite_renewal_core_context ctx, char *file, int *present) -{ - *present = 0; - return 0; -} - -#else -int -find_voms_cert(glite_renewal_core_context ctx, char *file, int *present) -{ - struct vomsdata *voms_info = NULL; - STACK_OF(X509) *chain = NULL; - EVP_PKEY *privkey = NULL; - X509 *cert = NULL; - int ret, err; - - *present = 0; - - voms_info = VOMS_Init(vomsdir, cadir); - if (voms_info == NULL) { - glite_renewal_log(ctx, LOG_ERR, "check_voms_cert(): Cannot initialize VOMS context (VOMS_Init() failed, probably voms dir was not specified)"); - return EDG_WLPR_ERROR_VOMS; - } - - ret = glite_renewal_load_proxy(ctx, file, &cert, &privkey, &chain, NULL); - if (ret) { - VOMS_Destroy(voms_info); - return ret; - } - - ret = VOMS_Retrieve(cert, chain, RECURSE_CHAIN, voms_info, &err); - if (ret == 1) { - *present = 1; - } - - VOMS_Destroy(voms_info); - X509_free(cert); - EVP_PKEY_free(privkey); - sk_X509_pop_free(chain, X509_free); - return 0; -} -#endif - -void -register_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - proxy_record record; - int ret; - FILE *meta_fd = NULL; - int last_suffix; - char *basename = NULL; - char filename[FILENAME_MAX]; - - assert(request != NULL); - assert(response != NULL); - - memset(&record, 0, sizeof(record)); - memset(response, 0, sizeof(*response)); - glite_renewal_log(ctx, LOG_DEBUG, "Registration request for %s", request->proxy_filename); - - if (request->proxy_filename == NULL || request->jobid == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Registration request doesn't contain registration information"); - return; /* EINVAL; */ - } - umask(0177); - - ret = get_base_filename(ctx, request->proxy_filename, &basename); - if (ret) - goto end; - - ret = open_metafile(ctx, basename, &meta_fd); - if (ret) - goto end; - - if (voms_enabled) - ret = find_voms_cert(ctx, request->proxy_filename, &record.voms_exts); - /* ignore VOMS related error */ - - /* Find first free record */ - record.suffix = -1; - record.myproxy_server = strdup(request->myproxy_server); - ret = get_record_ext(ctx, meta_fd, &record, &last_suffix); - fclose(meta_fd); meta_fd = NULL; - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto end; - - if (ret == EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND || record.jobids.len == 0 || request->unique || record.voms_exts) { - /* create a new proxy file in the repository */ - int suffix; - - suffix = (record.jobids.len == 0 && record.suffix >= 0) ? - record.suffix : last_suffix + 1; - snprintf(filename, sizeof(filename), "%s.%d", basename, suffix); - ret = copy_file(ctx, request->proxy_filename, filename); - if (ret) - goto end; - ret = get_times(ctx, filename, &record); - if (ret) - goto end; - record.suffix = suffix; - ret = realloc_prd_list(ctx, &record.jobids); - if (ret) - goto end; - record.jobids.val[record.jobids.len - 1] = strdup(request->jobid); - record.unique = request->unique; - glite_renewal_log(ctx, LOG_DEBUG, "Created a new proxy file in repository (%s)", - filename); - } else { - ret = realloc_prd_list(ctx, &record.jobids); - if (ret) - goto end; - record.jobids.val[record.jobids.len - 1] = strdup(request->jobid); - snprintf(filename, sizeof(filename), "%s.%d", basename, record.suffix); - glite_renewal_log(ctx, LOG_DEBUG, "Inremented counter on %s", filename); - } - - ret = store_record(ctx, basename, &record); - -end: - if (meta_fd) { - fclose(meta_fd); - } - - if (basename) - free(basename); - - if (ret == 0) - ret = filename_to_response(ctx, filename, response); - record_to_response(ctx, ret, &record, response); - free_record(ctx, &record); -} - -void -unregister_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - proxy_record record; - int ret, i, index; - FILE *meta_fd = NULL; - char *basename = NULL; - char *p; - struct stat stat_buf; - - memset(&record, 0, sizeof(record)); - glite_renewal_log(ctx, LOG_DEBUG, "Unregistration request for %s", request->jobid); - - if (request->jobid == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Unregistration request doesn't contain needed information"); - ret = EINVAL; - goto end; - } - - if (request->proxy_filename == NULL) { - ret = find_proxyname(ctx, request->jobid, &request->proxy_filename); - if (ret) - goto end; - } - - ret = get_base_filename(ctx, request->proxy_filename, &basename); - if (ret) { - goto end; - } - - if (strncmp(request->proxy_filename, basename, strlen(basename) != 0)) { - glite_renewal_log(ctx, LOG_DEBUG, "Requested proxy %s is not from repository", - request->proxy_filename); - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - goto end; - } - - p = strrchr(request->proxy_filename, '.'); - if (p == NULL) { - glite_renewal_log(ctx, LOG_DEBUG, "Requested proxy %s is not from repository", - request->proxy_filename); - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - goto end; - } - - ret = edg_wlpr_DecodeInt(p+1, &record.suffix); - if (ret) { - glite_renewal_log(ctx, LOG_DEBUG, "Requested proxy %s is not from repository", - request->proxy_filename); - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - goto end; - } - - ret = open_metafile(ctx, basename, &meta_fd); - if (ret) { - /* fill in error response */ - return; - } - - ret = get_record(ctx, meta_fd, &record); - if (ret) - goto end; - - ret = EDG_WLPR_PROXY_NOT_REGISTERED; - for (i = 0; i < record.jobids.len; i++) - if (strcmp(request->jobid, record.jobids.val[i]) == 0) { - ret = 0; - break; - } - if (ret) { - glite_renewal_log(ctx, LOG_DEBUG, "Requested proxy %s is not registered", - request->proxy_filename); - goto end; - } - - /* remove jobid from the list */ - index = i; - free(record.jobids.val[i]); - record.jobids.len--; - for (i = index; i < record.jobids.len; i++) - record.jobids.val[i] = record.jobids.val[i+1]; - - if (record.jobids.len == 0) { - record.unique = 0; - record.voms_exts = 0; - record.end_time = 0; - record.next_renewal = 0; - } - - ret = stat(request->proxy_filename, &stat_buf); - if (ret) { - glite_renewal_log(ctx, LOG_DEBUG, "Cannot stat file %s: (%s)", - request->proxy_filename, strerror(errno)); - ret = errno; - goto end; - } - - ret = store_record(ctx, basename, &record); - if (ret) - goto end; - - if (record.jobids.len == 0) - unlink(request->proxy_filename); - -end: - if (meta_fd) { - fclose(meta_fd); - } - if (basename) - free(basename); - - if (ret == 0) - ret = filename_to_response(ctx, request->proxy_filename, response); - record_to_response(ctx, ret, &record, response); - free_record(ctx, &record); -} - -void -get_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - char *filename = NULL; - int ret; - - memset(response, 0, sizeof(*response)); - - glite_renewal_log(ctx, LOG_DEBUG, "GET request for %s", request->jobid); - - if (request->jobid == NULL) { - glite_renewal_log(ctx, LOG_ERR, "GET request doesn't contain jobid specification"); - ret = EINVAL; - goto end; - } - - ret = find_proxyname(ctx, request->jobid, &filename); - -end: - if (ret == 0) - ret = filename_to_response(ctx, filename, response); - if (filename) - free(filename); - response->response_code = ret; -} - -void -update_db(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response) -{ - FILE *fd = NULL; - int tmp_fd = -1; - int suffix = -1; - char tmp_file[FILENAME_MAX]; - char cur_proxy[FILENAME_MAX]; - char datafile[FILENAME_MAX]; - char line[1024]; - char *new_line = NULL; - char *basename, *proxy = NULL; - char **entry; - proxy_record record; - int ret; - char *p; - time_t current_time; - - memset(&record, 0, sizeof(record)); - - glite_renewal_log(ctx, LOG_DEBUG, "UPDATE_DB request for %s", request->proxy_filename); - - chdir(repository); - basename = request->proxy_filename; - - snprintf(datafile, sizeof(datafile), "%s.data", basename); - fd = fopen(datafile, "r"); - if (fd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - datafile, strerror(errno)); - ret = errno; - return; - } - - snprintf(tmp_file, sizeof(tmp_file), "%s.XXXXXX", datafile); - tmp_fd = mkstemp(tmp_file); - if (tmp_fd < 0) { - glite_renewal_log(ctx, LOG_ERR, "Cannot create temporary file (%s)", - strerror(errno)); - ret = errno; - goto end; - } - - entry = request->entries; - if (entry) { - p = strchr(*entry, ':'); - *p = '\0'; - suffix = atoi(*entry); - proxy = p+1; - } - - current_time = time(NULL); - - while (fgets(line, sizeof(line), fd) != NULL) { - free_record(ctx, &record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, line, &record); - if (ret) - goto end; - - if (record.suffix > suffix && entry && *entry) { - do { - entry++; - if (entry == NULL || *entry == NULL) { - suffix = -1; - break; - } - - p = strchr(*entry, ':'); - suffix = atoi(*entry); - proxy = p+1; - } while (record.suffix > suffix); - } - - if (record.suffix == suffix) { - snprintf(cur_proxy, sizeof(cur_proxy), "%s.%d", basename, suffix); - if (proxy == NULL || *proxy == '\0') { - /* if proxy isn't specified use file registered currently and - * reschedule renewal */ - if (record.end_time < current_time) { - char *server; - /* remove file with expired proxy and clean the record in db */ - unlink(cur_proxy); - server = strdup(record.myproxy_server); - free_record(ctx, &record); - record.suffix = suffix; - record.myproxy_server = server; - glite_renewal_log(ctx, LOG_WARNING, "Removed expired proxy %s", cur_proxy); - } else - get_times(ctx, cur_proxy, &record); - } else { - ret = get_times(ctx, proxy, &record); - (ret == 0) ? rename(proxy, cur_proxy) : unlink(proxy); - } - } - - ret = encode_record(ctx, &record, &new_line); - if (ret) - goto end; - - dprintf(tmp_fd, "%s\n", new_line); - free(new_line); - new_line = NULL; - } - free_record(ctx, &record); - - close(tmp_fd); - fclose(fd); - - rename(tmp_file, datafile); - - return; - -end: - if (fd) - fclose(fd); - unlink(tmp_file); - if (tmp_fd > 0) - close(tmp_fd); - free_record(ctx, &record); - - return; -} diff --git a/org.glite.security.proxyrenewal/src/common.c b/org.glite.security.proxyrenewal/src/common.c deleted file mode 100644 index 206bc2f..0000000 --- a/org.glite.security.proxyrenewal/src/common.c +++ /dev/null @@ -1,322 +0,0 @@ -#include "renewal_locl.h" - -#ident "$Header$" - -/* nread() and nwrite() never return partial data */ -static int -nread(int sock, struct timeval *to, char *buf, size_t buf_len, size_t *read_len) -{ - int count; - size_t remain = buf_len; - char *cbuf = buf; - struct pollfd pollfds[1]; - struct timeval before,after; - int ret; - - if (to) { - gettimeofday(&before,NULL); - } - - while (remain > 0) { - pollfds[0].fd = sock; - pollfds[0].events = POLLIN; - switch (poll(pollfds, 1, to ? (to->tv_sec*1000+to->tv_usec/1000) : INFTIM)) { - case 0: - ret = EDG_WLPR_ERROR_TIMEOUT; - goto end; - case -1: - ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - - count = read(sock, cbuf, remain); - if (count < 0) { - if (errno == EINTR) - continue; - else { - ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - } else - if (count == 0) { - *read_len = 0; - return 0; - } - cbuf += count; - remain -= count; - } - *read_len = buf_len; - ret = 0; - -end: - if (to) { - gettimeofday(&after,NULL); - edg_wlpr_DecrementTimeout(to, before, after); - if (to->tv_sec < 0) { - to->tv_sec = 0; - to->tv_usec = 0; - } - } - - return ret; -} - -static int -nwrite(int sock, struct timeval *to, const char *buf, size_t buf_len) -{ - const char *cbuf = buf; - int count; - size_t remain = buf_len; - struct pollfd pollfds[1]; - struct timeval before,after; - int ret; - - if (to) { - gettimeofday(&before,NULL); - } - - while (remain > 0) { - pollfds[0].fd = sock; - pollfds[0].events = POLLOUT; - switch (poll(pollfds, 1, to ? (to->tv_sec*1000+to->tv_usec/1000) : INFTIM)) { - case 0: ret = EDG_WLPR_ERROR_TIMEOUT; - goto end; - case -1: ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - - count = write(sock, cbuf, remain); - if (count < 0) { - if (errno == EINTR) - continue; - else { - ret = EDG_WLPR_ERROR_ERRNO; - goto end; - } - } - cbuf += count; - remain -= count; - } - ret = 0; - -end: - if (to) { - gettimeofday(&after,NULL); - edg_wlpr_DecrementTimeout(to, before, after); - if (to->tv_sec < 0) { - to->tv_sec = 0; - to->tv_usec = 0; - } - } - - return ret; -} - -int -edg_wlpr_Read(int sock, struct timeval *timeout, char **buf, size_t *buf_len) -{ - int ret; - unsigned char length[4]; - size_t len; - - ret = nread(sock, timeout, length, 4, &len); - if (ret) { - *buf_len = 0; - return ret; - } - if (len != 4) { - *buf_len = 0; - return EDG_WLPR_ERROR_UNEXPECTED_EOF; /* XXX vraci i kdyz peer spadne a zavre trubku */ - } - *buf_len = (length[0] << 24) | - (length[1] << 16) | - (length[2] << 8 ) | - (length[3] << 0); - - *buf = malloc(*buf_len); - if (*buf == NULL) - return ENOMEM; - - ret = nread(sock, timeout, *buf, *buf_len, &len); - if (ret) - return ret; - - if (len != *buf_len) { - free(*buf); - *buf_len = 0; - return EDG_WLPR_ERROR_UNEXPECTED_EOF; /* XXX */ - } - - return 0; -} - -int -edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len) -{ - unsigned char length[4]; - int ret; - - length[0] = (buf_len >> 24) & 0xFF; - length[1] = (buf_len >> 16) & 0xFF; - length[2] = (buf_len >> 8) & 0xFF; - length[3] = (buf_len >> 0) & 0xFF; - - if ((ret = nwrite(sock, timeout, length, 4)) != 0 || - (ret = nwrite(sock, timeout, buf, buf_len)) != 0) - return ret; - - return 0; -} - -int -edg_wlpr_GetToken(const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, char **value) -{ - char *p; - size_t len; - int index; - - assert(separators != NULL); - - /* Add ending zero ? */ - - index = 0; - p = (char *)msg; - while (p && (p = strstr(p, key))) { - if (index == req_index) - break; - index++; - p += strlen(key); - } - if (p == NULL) - return EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND; - - p = strchr(p, '='); - if (p == NULL) - return EDG_WLPR_ERROR_PROTO_PARSE_ERROR; - - len = strcspn(p+1, separators); - if (len == 0) - return EDG_WLPR_ERROR_PROTO_PARSE_ERROR; - - *value = malloc(len + 1); - if (*value == NULL) - return ENOMEM; - - memcpy(*value, p+1, len); - (*value)[len] = '\0'; - - return 0; -} - -int -edg_wlpr_StoreToken(char **buf, size_t *buf_len, char *command, - char *value, const char *separator) -{ - char line[2048]; - char *tmp; - - assert(buf != NULL); - assert(separator != NULL); - - if (strlen(command) + 1 + strlen(value) + 2 > sizeof(line)) - return ERANGE; /* XXX */ - - snprintf(line, sizeof(line), "%s%s%s", command, value, separator); - - while (strlen(*buf) + strlen(line) + 1 > *buf_len) { - tmp = realloc(*buf, *buf_len + EDG_WLPR_BUF_SIZE); - if (tmp == NULL) - return ENOMEM; - *buf = tmp; - *buf_len += EDG_WLPR_BUF_SIZE; - } - strcat(*buf, line); - - return 0; -} - -void -edg_wlpr_CleanRequest(edg_wlpr_Request *request) -{ - assert(request != NULL); - if (request->version) - free(request->version); - if (request->proxy_filename) - free(request->proxy_filename); - if (request->myproxy_server) - free(request->myproxy_server); - if (request->jobid) - free(request->jobid); - if (request->entries) { - char **p = request->entries; - char **next; - while (*p) { - next = p+1; - free(*p); - p = next; - } - free(request->entries); - } - - memset(request, 0, sizeof(request)); -} - -void -edg_wlpr_CleanResponse(edg_wlpr_Response *response) -{ - assert(response != NULL); - if (response->version) - free(response->version); - if (response->myproxy_server) - free(response->myproxy_server); - if (response->filenames) { - char **p = response->filenames; - char **next; - - while (*p) { - next = p+1; - free(*p); - p = next; - } - free(response->filenames); - } - memset(response, 0, sizeof(*response)); -} - -const char * -edg_wlpr_GetErrorString(int code) -{ - return (code == 0) ? "OK" : "Error"; -} - -char * -edg_wlpr_EncodeInt(int num) /* long? time */ -{ - static char ret[64]; - - snprintf(ret, sizeof(ret), "%d", num); - return ret; -} - -int -edg_wlpr_DecodeInt(char *str, int *num) -{ - *num = atol(str); /* XXX */ - return 0; -} - -int -edg_wlpr_DecrementTimeout(struct timeval *timeout, struct timeval before, struct timeval after) -{ - (*timeout).tv_sec = (*timeout).tv_sec - (after.tv_sec - before.tv_sec); - (*timeout).tv_usec = (*timeout).tv_usec - (after.tv_usec - before.tv_usec); - while ( (*timeout).tv_usec < 0) { - (*timeout).tv_sec--; - (*timeout).tv_usec += 1000000; - } - - if ( ((*timeout).tv_sec < 0) || (((*timeout).tv_sec == 0) && ((*timeout).tv_usec == 0)) ) return(1); - else return(0); -} diff --git a/org.glite.security.proxyrenewal/src/renew.c b/org.glite.security.proxyrenewal/src/renew.c deleted file mode 100644 index 29105d2..0000000 --- a/org.glite.security.proxyrenewal/src/renew.c +++ /dev/null @@ -1,256 +0,0 @@ -#include "renewal_locl.h" -#include "renewd_locl.h" - -#include "glite/security/voms/voms_apic.h" - -#ident "$Header$" - -#define RENEWAL_COUNTS_MAX 1000 /* the slave daemon exits after that many attemtps */ - -extern char *repository; -extern char *cadir; -extern char *vomsdir; -extern int voms_enabled; -static int received_signal = -1, die = 0; - -static void -check_renewal(glite_renewal_core_context ctx, char *datafile, int force_renew, int *num_renewed); - -static int -renew_proxy(glite_renewal_core_context ctx, proxy_record *record, char *basename, char **new_proxy); - -static void -register_signal(int signal); - -static void -register_signal(int signal) -{ - received_signal = signal; - switch ((received_signal = signal)) { - case SIGINT: - case SIGTERM: - case SIGQUIT: - die = signal; - break; - default: - break; - } -} - -static int -renew_proxy(glite_renewal_core_context ctx, proxy_record *record, char *basename, char **new_proxy) -{ - char repository_file[FILENAME_MAX]; - int ret = -1; - char *p = NULL; - char *server = NULL; - unsigned int port = 0; - - snprintf(repository_file, sizeof(repository_file),"%s.%d", - basename, record->suffix); - - if (record->myproxy_server) - server = strdup(record->myproxy_server); - - if (server && (p = strchr(server, ':'))) { - *p++ = '\0'; - ret = edg_wlpr_DecodeInt(p, &port); - } - - ret = glite_renewal_core_renew(ctx, server, port, repository_file, new_proxy); - if (ret) - goto end; - - ret = 0; - -end: - if (server) - free(server); - - return ret; -} - -static void -check_renewal(glite_renewal_core_context ctx, char *datafile, int force_renew, int *num_renewed) -{ - char line[1024]; - proxy_record record; - char *p; - int ret, i; - time_t current_time; - FILE *meta_fd = NULL; - char basename[FILENAME_MAX]; - edg_wlpr_Request request; - edg_wlpr_Response response; - char *new_proxy = NULL; - char *entry = NULL; - char **tmp; - int num = 0; - - assert(datafile != NULL); - - *num_renewed = 0; - - memset(&record, 0, sizeof(record)); - memset(basename, 0, sizeof(basename)); - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - strncpy(basename, datafile, sizeof(basename) - 1); - p = basename + strlen(basename) - strlen(".data"); - if (strcmp(p, ".data") != 0) { - glite_renewal_log(ctx, LOG_ERR, "Meta filename doesn't end with '.data'"); - return; - } - *p = '\0'; - - request.command = EDG_WLPR_COMMAND_UPDATE_DB; - request.proxy_filename = strdup(basename); - - meta_fd = fopen(datafile, "r"); - if (meta_fd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - datafile, strerror(errno)); - return; - } - - current_time = time(NULL); - glite_renewal_log(ctx, LOG_DEBUG, "Reading metafile %s", datafile); - - while (fgets(line, sizeof(line), meta_fd) != NULL) { - free_record(ctx, &record); - p = strchr(line, '\n'); - if (p) - *p = '\0'; - ret = decode_record(ctx, line, &record); - if (ret) - continue; /* XXX exit? */ - if (record.jobids.len == 0) /* no jobid registered for this proxy */ - continue; - if (current_time + RENEWAL_CLOCK_SKEW >= record.end_time || - record.next_renewal <= current_time || - force_renew) { - ret = EDG_WLPR_PROXY_EXPIRED; - if ( record.end_time + RENEWAL_CLOCK_SKEW >= current_time) { - /* only try renewal if the proxy hasn't already expired */ - ret = renew_proxy(ctx, &record, basename, &new_proxy); - } - - /* if the proxy wasn't renewed have the daemon planned another renewal */ - asprintf(&entry, "%d:%s", record.suffix, (ret == 0) ? new_proxy : ""); - if (new_proxy) { - free(new_proxy); new_proxy = NULL; - } - - tmp = realloc(request.entries, (num + 2) * sizeof(*tmp)); - if (tmp == NULL) { - free_record(ctx, &record); - return; - } - request.entries = tmp; - request.entries[num] = entry; - request.entries[num+1] = NULL; - num++; - } - } - free_record(ctx, &record); - - if (num > 0) { - ret = edg_wlpr_RequestSend(&request, &response); - if (ret != 0) - glite_renewal_log(ctx, LOG_ERR, - "Failed to send update request to master (%d)", ret); - else if (response.response_code != 0) - glite_renewal_log(ctx, LOG_ERR, - "Master failed to update database (%d)", response.response_code); - - /* delete all tmp proxy files which may survive */ - for (i = 0; i < num; i++) { - p = strchr(request.entries[i], ':'); - if (p+1) - unlink(p+1); - } - } - fclose(meta_fd); - - edg_wlpr_CleanResponse(&response); - edg_wlpr_CleanRequest(&request); - - *num_renewed = num; - - return; -} - -int renewal(glite_renewal_core_context ctx, int force_renew, int *num_renewed) -{ - DIR *dir = NULL; - struct dirent *file; - FILE *fd; - int num = 0; - - glite_renewal_log(ctx, LOG_DEBUG, "Starting renewal process"); - - *num_renewed = 0; - - if (chdir(repository)) { - glite_renewal_log(ctx, LOG_ERR, "Cannot access repository directory %s (%s)", - repository, strerror(errno)); - return errno; - } - - dir = opendir(repository); - if (dir == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open repository directory %s (%s)", - repository, strerror(errno)); - return errno; - } - - while ((file = readdir(dir))) { - /* read files of format `md5sum`.data, where md5sum() is of fixed length - 32 chars */ - if (file->d_name == NULL || strlen(file->d_name) != 37 || - strcmp(file->d_name + 32, ".data") != 0) - continue; - fd = fopen(file->d_name, "r"); - if (fd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Cannot open meta file %s (%s)", - file->d_name, strerror(errno)); - continue; - } - check_renewal(ctx, file->d_name, force_renew, &num); - *num_renewed += num; - fclose(fd); - } - closedir(dir); - glite_renewal_log(ctx, LOG_DEBUG, "Finishing renewal process"); - return 0; -} - -void -watchdog_start(glite_renewal_core_context ctx) -{ - struct sigaction sa; - int force_renewal; - int count = 0, num; - - memset(&sa,0,sizeof(sa)); - sa.sa_handler = register_signal; - sigaction(SIGUSR1, &sa, NULL); - sigaction(SIGINT,&sa,NULL); - sigaction(SIGQUIT,&sa,NULL); - sigaction(SIGTERM,&sa,NULL); - sigaction(SIGPIPE,&sa,NULL); - - while (count < RENEWAL_COUNTS_MAX && !die) { - received_signal = -1; - sleep(60 * 5); - force_renewal = (received_signal == SIGUSR1) ? 1 : 0; - if (die) - break; - /* XXX uninstall signal handler ? */ - renewal(ctx, force_renewal, &num); - count += num; - } - glite_renewal_log(ctx, LOG_DEBUG, "Terminating after %d renewal attempts", count); - exit(0); -} diff --git a/org.glite.security.proxyrenewal/src/renewal_core.c b/org.glite.security.proxyrenewal/src/renewal_core.c deleted file mode 100644 index 3bd2d1d..0000000 --- a/org.glite.security.proxyrenewal/src/renewal_core.c +++ /dev/null @@ -1,283 +0,0 @@ -#include -#include - -#include "renewal_core.h" -#include "renewal_locl.h" -#include "renewd_locl.h" - -static const char rcsid[] = "$Id$"; - -int -glite_renewal_load_proxy(glite_renewal_core_context ctx, const char *cur_file, X509 **cert, EVP_PKEY **priv_key, - STACK_OF(X509) **chain, globus_gsi_cred_handle_t *cur_proxy) -{ - globus_result_t result; - globus_gsi_cred_handle_t proxy = NULL; - int ret; - - result = globus_gsi_cred_handle_init(&proxy, NULL); - if (result) { - fprintf(stderr, "globus_gsi_cred_handle_init() failed\n"); - goto end; - } - - result = globus_gsi_cred_read_proxy(proxy, (char *) cur_file); - if (result) { - fprintf(stderr, "globus_gsi_cred_read_proxy() failed\n"); - goto end; - } - - if (cert) { - result = globus_gsi_cred_get_cert(proxy, cert); - if (result) { - fprintf(stderr, "globus_gsi_cred_get_cert() failed\n"); - goto end; - } - } - - if (priv_key) { - result = globus_gsi_cred_get_key(proxy, priv_key); - if (result) { - fprintf(stderr, "globus_gsi_cred_get_key() failed\n"); - goto end; - } - } - - if (chain) { - result = globus_gsi_cred_get_cert_chain(proxy, chain); - if (result) { - fprintf(stderr, "globus_gsi_cred_get_cert_chain() failed\n"); - goto end; - } - } - - if (cur_proxy) { - *cur_proxy = proxy; - proxy = NULL; - } - - ret = 0; - -end: - if (proxy) - globus_gsi_cred_handle_destroy(proxy); - if (result) - ret = EDG_WLPR_ERROR_GENERIC; - - return ret; -} - -int -glite_renewal_get_proxy_base_name(glite_renewal_core_context ctx, const char *file, char **name) -{ - X509 *cert = NULL; - EVP_PKEY *key = NULL; - STACK_OF(X509) *chain = NULL; - X509_NAME *subject = NULL; - int ret; - globus_result_t result; - - ret = glite_renewal_load_proxy(ctx, file, &cert, &key, &chain, NULL); - if (ret) - return ret; - - subject = X509_NAME_dup(X509_get_subject_name(cert)); - - sk_X509_insert(chain, cert, 0); - cert = NULL; - - result = globus_gsi_cert_utils_get_base_name(subject, chain); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "Cannot get subject name from proxy %s", file); - ret = EDG_WLPR_ERROR_SSL; /* XXX ??? */ - goto end; - } - - *name = X509_NAME_oneline(subject, NULL, 0); - ret = 0; - -end: - if (cert) - X509_free(cert); - if (key) - EVP_PKEY_free(key); - if (chain) - sk_X509_pop_free(chain, X509_free); - if (subject) - X509_NAME_free(subject); - - return ret; -} - -int -glite_renewal_core_renew(glite_renewal_core_context ctx, - const char * myproxy_server, - unsigned int myproxy_port, - const char *current_proxy, - char **new_proxy) -{ - char tmp_proxy[FILENAME_MAX]; - int tmp_fd; - int ret = -1; - char *p; - const char *server = NULL; - myproxy_socket_attrs_t *socket_attrs; - myproxy_request_t *client_request; - myproxy_response_t *server_response; - char *renewed_proxy; - int voms_exts; - - socket_attrs = malloc(sizeof(*socket_attrs)); - memset(socket_attrs, 0, sizeof(*socket_attrs)); - - client_request = malloc(sizeof(*client_request)); - memset(client_request, 0, sizeof(*client_request)); - - server_response = malloc(sizeof(*server_response)); - memset(server_response, 0, sizeof(*server_response)); - - myproxy_set_delegation_defaults(socket_attrs, client_request); - - glite_renewal_log(ctx, LOG_DEBUG, "Trying to renew proxy in %s", current_proxy); - - snprintf(tmp_proxy, sizeof(tmp_proxy), "%s.myproxy.XXXXXX", current_proxy); - tmp_fd = mkstemp(tmp_proxy); - if (tmp_fd == -1) { - glite_renewal_log(ctx, LOG_ERR, "Cannot create temporary file (%s)", - strerror(errno)); - return errno; - } - - ret = glite_renewal_get_proxy_base_name(ctx, current_proxy, &client_request->username); - if (ret) - goto end; - - voms_exts = glite_renewal_check_voms_attrs(ctx, current_proxy); - - client_request->proxy_lifetime = 60 * 60 * DGPR_RETRIEVE_DEFAULT_HOURS; - - server = (myproxy_server) ? myproxy_server : socket_attrs->pshost; - if (server == NULL) { - glite_renewal_log(ctx, LOG_ERR, "No myproxy server specified"); - ret = EINVAL; - goto end; - } - socket_attrs->pshost = strdup(server); - - socket_attrs->psport = (myproxy_port) ? myproxy_port : MYPROXY_SERVER_PORT; - - verror_clear(); - ret = myproxy_get_delegation(socket_attrs, client_request, (char *) current_proxy, - server_response, tmp_proxy); - if (ret == 1) { - ret = EDG_WLPR_ERROR_MYPROXY; - glite_renewal_log(ctx, LOG_ERR, "Error contacting MyProxy server for proxy %s: %s", - current_proxy, verror_get_string()); - verror_clear(); - goto end; - } - - renewed_proxy = tmp_proxy; - - if (voms_exts) { - char tmp_voms_proxy[FILENAME_MAX]; - int tmp_voms_fd; - - snprintf(tmp_voms_proxy, sizeof(tmp_voms_proxy), "%s.voms.XXXXXX", - current_proxy); - tmp_voms_fd = mkstemp(tmp_voms_proxy); - if (tmp_voms_fd == -1) { - glite_renewal_log(ctx, LOG_ERR, "Cannot create temporary file (%s)", - strerror(errno)); - ret = errno; - goto end; - } - - ret = glite_renewal_renew_voms_creds(ctx, current_proxy, renewed_proxy, tmp_voms_proxy); - close(tmp_voms_fd); - if (ret) { - unlink(tmp_voms_proxy); - goto end; - } - - renewed_proxy = tmp_voms_proxy; - unlink(tmp_proxy); - } - - if (new_proxy) - *new_proxy = strdup(renewed_proxy); - - ret = 0; - -end: - if (socket_attrs->socket_fd) - close(socket_attrs->socket_fd); - close(tmp_fd); - if (ret) - unlink(tmp_proxy); - myproxy_free(socket_attrs, client_request, server_response); - - return ret; -} - -int -glite_renewal_core_init_ctx(glite_renewal_core_context *context) -{ - glite_renewal_core_context p = NULL; - - *context = NULL; - - p = calloc(1, sizeof(*p)); - if (p == NULL) - return ENOMEM; - - p->log_level = LOG_ERR; - p->log_dst = GLITE_RENEWAL_LOG_SYSLOG; - - *context = p; - return 0; -} - -int -glite_renewal_core_destroy_ctx(glite_renewal_core_context context) -{ - if (context == NULL) - return 0; - if (context->err_message); - free(context->err_message); - free(context); - return 0; -} - -void -glite_renewal_log(glite_renewal_core_context context, int dbg_level, const char *format, ...) -{ - va_list ap; - - if (context->err_message) { - free(context->err_message); - context->err_message = NULL; - } - - /* cannot handle the %m format argument specific for syslog() */ - va_start(ap, format); - vasprintf(&context->err_message, format, ap); - va_end(ap); - - if (dbg_level > context->log_level) - return; - - switch (context->log_dst) { - case GLITE_RENEWAL_LOG_STDOUT: - printf("%s\n", context->err_message); - break; - case GLITE_RENEWAL_LOG_SYSLOG: - syslog(dbg_level, "%s", context->err_message); - break; - case GLITE_RENEWAL_LOG_NONE: - default: - break; - } - - return; -} diff --git a/org.glite.security.proxyrenewal/src/renewal_locl.h b/org.glite.security.proxyrenewal/src/renewal_locl.h deleted file mode 100644 index 256eb26..0000000 --- a/org.glite.security.proxyrenewal/src/renewal_locl.h +++ /dev/null @@ -1,148 +0,0 @@ -#ifndef RENEWAL_LOCL_H -#define RENEWAL_LOCL_H - -#ident "$Header$" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifndef INFTIM -#define INFTIM (-1) -#endif - -#include -#include -#include -#include - -#include "renewal.h" - -#define JDL_MYPROXY "Myproxy_server=" - -typedef enum { - EDG_WLPR_COMMAND_NONE = 0, - EDG_WLPR_COMMAND_REG = 1, - EDG_WLPR_COMMAND_UNREG, - EDG_WLPR_COMMAND_GET, - EDG_WLPR_COMMAND_LIST, - EDG_WLPR_COMMAND_STATUS, - EDG_WLPR_COMMAND_UPDATE_DB, -} edg_wlpr_Command; - -/* prefix neni nutny */ -#define EDG_WLPR_PROTO_VERSION "Version=" -#define EDG_WLPR_PROTO_COMMAND "Command=" -#define EDG_WLPR_PROTO_MYPROXY_SERVER "Myproxy_server=" -#define EDG_WLPR_PROTO_PROXY "Proxy_name=" -#define EDG_WLPR_PROTO_UNIQUE_PROXY "Unique=" /* XXX */ -#define EDG_WLPR_PROTO_JOBID "Jobid=" -#define EDG_WLPR_PROTO_ENTRY "Entry=" - -#define EDG_WLPR_PROTO_RESPONSE "Response=" /* XXX result ?? */ -#define EDG_WLPR_PROTO_START_TIME "Start_time=" -#define EDG_WLPR_PROTO_END_TIME "End_time=" -#define EDG_WLPR_PROTO_RENEWAL_TIME "Renewal_time=" /* XXX Next renewal ?? */ - -#define EDG_WLPR_MYPROXY_PORT 7512 - -#define EDG_WLPR_REPOSITORY_ROOT "/var/spool/edg-wl-renewd" - -#define EDG_WLPR_BUF_SIZE 4096 - -#define EDG_WLPR_VERSION "EDG Proxy Renewal 1.0" - -#define MAX_PROXIES 4 /* max. number of jobids sharing one proxy */ - -#define RENEWAL_CLOCK_SKEW (5 * 60) - -#define DGPR_RETRIEVE_DEFAULT_HOURS 10 - -#define GLITE_PR_TIMEOUT_DEFAULT 120 - -typedef struct { - char *version; - edg_wlpr_Command command; - char *myproxy_server; - char *proxy_filename; - int unique; - char *jobid; - char **entries; /* for updates from the renewal part (renew.c) */ -} edg_wlpr_Request; - -typedef struct { - char *version; - int response_code; - time_t start_time; - time_t end_time; - time_t next_renewal_time; - int counter; - char *myproxy_server; - char **filenames; -} edg_wlpr_Response; - -#define DGPR_REG_SOCKET_NAME_ROOT "/tmp/dgpr_renew_" - -#if 0 -/* Errors: */ -/* XXX enum */ -#define EDG_WLPR_ERROR_EOF 1 -#define EDG_WLPR_ERROR_PARSE_NOT_FOUND 2 -#define EDG_WLPR_ERROR_PARSE_ERROR 3 -#define EDG_WLPR_ERROR_UNKNOWN_COMMAND 4 -#define EDG_WLPR_ERROR_NOTFOUND 5 -#endif - -int -edg_wlpr_GetToken(const char *msg, const size_t msg_len, - const char *key, const char *separators, - int req_index, char **value); - -int -edg_wlpr_StoreToken(char **buf, size_t *buf_len, char *command, - char *value, const char *separator); - -int -edg_wlpr_Read(int sock, struct timeval *timeout, char **buf, size_t *buf_len); - -int -edg_wlpr_Write(int sock, struct timeval *timeout, char *buf, size_t buf_len); - -void -edg_wlpr_CleanRequest(edg_wlpr_Request *request); - -void -edg_wlpr_CleanResponse(edg_wlpr_Response *response); - -const char * -edg_wlpr_GetErrorString(int err); - -char * -edg_wlpr_EncodeInt(int num); /* long? time */ - -int -edg_wlpr_DecodeInt(char *str, int *num); - -int -edg_wlpr_RequestSend(edg_wlpr_Request *request, edg_wlpr_Response *response); - -int -edg_wlpr_DecrementTimeout(struct timeval *timeout, struct timeval before, struct timeval after); - -#endif /* RENEWAL_LOCL_H */ diff --git a/org.glite.security.proxyrenewal/src/renewd.c b/org.glite.security.proxyrenewal/src/renewd.c deleted file mode 100644 index 69a2ea0..0000000 --- a/org.glite.security.proxyrenewal/src/renewd.c +++ /dev/null @@ -1,606 +0,0 @@ -#include "renewal_locl.h" -#include "renewd_locl.h" - -static const char rcsid[] = "$Header$"; - -#define SEPARATORS "\n" -/* GRIDMANAGER_CHECKPROXY_INTERVAL + GRIDMANAGER_MINIMUM_PROXY_TIME */ -#define CONDOR_MINIMUM_PROXY_TIME (1800) - -int debug = 0; -char *repository = NULL; -time_t condor_limit = CONDOR_MINIMUM_PROXY_TIME; -char *cadir = NULL; -char *vomsdir = NULL; -int voms_enabled = 0; -char *cert = NULL; -char *key = NULL; -char *vomsconf = NULL; - -static volatile int die = 0, child_died = 0; -double default_timeout = 0; - -static struct option opts[] = { - { "help", no_argument, NULL, 'h' }, - { "version", no_argument, NULL, 'v' }, - { "debug", no_argument, NULL, 'd' }, - { "repository", required_argument, NULL, 'r' }, - { "condor-limit", required_argument, NULL, 'c' }, - { "CAdir", required_argument, NULL, 'C' }, - { "VOMSdir", required_argument, NULL, 'V' }, - { "enable-voms", no_argument, NULL, 'A' }, - { "voms-config", required_argument, NULL, 'G' }, - { "cert", required_argument, NULL, 't' }, - { "key", required_argument, NULL, 'k' }, - { NULL, 0, NULL, 0 } -}; - -typedef struct { - edg_wlpr_Command code; - void (*handler) (glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); -} command_table; - -static command_table commands[] = { - { EDG_WLPR_COMMAND_REG, register_proxy, }, - { EDG_WLPR_COMMAND_UNREG, unregister_proxy, }, - { EDG_WLPR_COMMAND_GET, get_proxy, }, -#if 0 - { EDG_WLPR_COMMAND_LIST, list_proxies, }, - { EDG_WLPR_COMMAND_STATUS, status_proxy, }, -#endif - { EDG_WLPR_COMMAND_UPDATE_DB, update_db, }, - { 0, NULL }, -}; - -/* static prototypes */ -static void -usage(glite_renewal_core_context ctx, char *progname); - -static int -do_listen(glite_renewal_core_context ctx, char *socket_name, int *sock); - -static int -encode_response(glite_renewal_core_context ctx, edg_wlpr_Response *response, char **msg); - -static command_table * -find_command(glite_renewal_core_context ctx, edg_wlpr_Command code); - -static int -proto(glite_renewal_core_context ctx, int sock); - -static int -doit(glite_renewal_core_context ctx, int sock); - -static int -decode_request(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, edg_wlpr_Request *request); - -int -start_watchdog(glite_renewal_core_context ctx, pid_t *pid); - -static void -catchsig(int sig) -{ - switch (sig) { - case SIGINT: - case SIGTERM: - case SIGQUIT: - die = sig; - break; - case SIGCHLD: - child_died = 1; - break; - default: - break; - } -} - -static command_table * -find_command(glite_renewal_core_context ctx, edg_wlpr_Command code) -{ - command_table *c; - - for (c = commands; c->code; c++) { - if (c->code == code) - return c; - } - return NULL; -} - -static int -proto(glite_renewal_core_context ctx, int sock) -{ - char *buf = NULL; - size_t buf_len; - int ret; - edg_wlpr_Response response; - edg_wlpr_Request request; - command_table *command; - struct timeval timeout; - - memset(&request, 0, sizeof(request)); - memset(&response, 0, sizeof(response)); - - timeout.tv_sec = (long) default_timeout; - timeout.tv_usec = (long) ((default_timeout - timeout.tv_sec) * 1e6); - - ret = edg_wlpr_Read(sock, &timeout, &buf, &buf_len); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Error reading from client: %s", - edg_wlpr_GetErrorString(ret)); - return ret; - } - - ret = decode_request(ctx, buf, buf_len, &request); - free(buf); - if (ret) - goto end; - - /* XXX check request (protocol version, ...) */ - - command = find_command(ctx, request.command); - if (command == NULL) { - ret = EDG_WLPR_ERROR_UNKNOWN_COMMAND; - glite_renewal_log(ctx, LOG_ERR, "Received unknown command (%d)", request.command); - goto end; - } - - glite_renewal_log(ctx, LOG_INFO, "Received command code %d for proxy %s and jobid %s", - request.command, - request.proxy_filename ? request.proxy_filename : "(unspecified)", - request.jobid ? request.jobid : "(unspecified)"); - - command->handler(ctx, &request, &response); - - ret = encode_response(ctx, &response, &buf); - if (ret) - goto end; - - ret = edg_wlpr_Write(sock, &timeout, buf, strlen(buf) + 1); - free(buf); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Error sending response to client: %s", - edg_wlpr_GetErrorString(ret)); - goto end; - } - -end: - edg_wlpr_CleanRequest(&request); - edg_wlpr_CleanResponse(&response); - - return ret; -} - -static int -doit(glite_renewal_core_context ctx, int sock) -{ - int newsock; - struct sockaddr_un client_addr; - int client_addr_len = sizeof(client_addr); - int flags; - - while (!die) { - - if (child_died) { - int pid, newpid, ret; - - while ((pid=waitpid(-1,NULL,WNOHANG))>0) - ; - ret = start_watchdog(ctx, &newpid); - if (ret) - return ret; - glite_renewal_log(ctx, LOG_DEBUG, "Renewal slave process re-started"); - child_died = 0; - continue; - } - - newsock = accept(sock, (struct sockaddr *) &client_addr, &client_addr_len); - if (newsock == -1) { - if (errno != EINTR) - glite_renewal_log(ctx, LOG_ERR, "accept() failed"); - continue; - } - glite_renewal_log(ctx, LOG_DEBUG, "Got connection"); - - flags = fcntl(newsock, F_GETFL, 0); - if (fcntl(newsock, F_SETFL, flags | O_NONBLOCK) < 0) { - glite_renewal_log(ctx, LOG_ERR, "Can't set O_NONBLOCK mode (%s), closing.\n", - strerror(errno)); - close(newsock); - continue; - } - - proto(ctx, newsock); - - glite_renewal_log(ctx, LOG_DEBUG, "Connection closed"); - close(newsock); - } - glite_renewal_log(ctx, LOG_DEBUG, "Terminating on signal %d\n",die); - return 0; -} - -static int -decode_request(glite_renewal_core_context ctx, const char *msg, const size_t msg_len, edg_wlpr_Request *request) -{ - char *value = NULL; -#if 0 - char *p; - int port; -#endif - int ret; - int index; - - /* XXX add an ending zero '\0' */ - - assert(msg != NULL); - assert(request != NULL); - - memset(request, 0, sizeof(*request)); - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_VERSION, SEPARATORS, - 0, &request->version); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Protocol error reading protocol specification: %s", - edg_wlpr_GetErrorString(ret)); - return ret; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_COMMAND, SEPARATORS, - 0, &value); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Protocol error reading command specification: %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - - ret = edg_wlpr_DecodeInt(value, (int *)(&request->command)); - if (ret) { - glite_renewal_log(ctx, LOG_ERR, "Received non-numeric command specification (%s)", - value); - free(value); - goto err; - } - free(value); - - if (find_command(ctx, request->command) == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Received unknown command (%d)", request->command); - ret = EDG_WLPR_ERROR_UNKNOWN_COMMAND; - goto err; - } - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - SEPARATORS, 0, &request->myproxy_server); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - glite_renewal_log(ctx, LOG_ERR, "Protocol error reading myproxy server specification: %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - -#if 0 - request->myproxy_port = EDG_WLPR_MYPROXY_PORT; /* ??? */ - if (request->myproxy_server && (p = strchr(request->myproxy_server, ':'))) { - *p = '\0'; - port = atol(p+1); /* XXX see myproxy for err check */ - request->myproxy_port = port; - } -#endif - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_PROXY, SEPARATORS, - 0, &request->proxy_filename); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - glite_renewal_log(ctx, LOG_ERR, "Protocol error reading proxy specification: %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - -#if 0 - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_UNIQUE_PROXY, - SEPARATORS, 0, &value); - if (ret && ret != EDG_WLPR_ERROR_PARSE_NOT_FOUND) - goto err; - if (ret == 0 && strcasecmp(value, "yes") == 0) - request->unique = 1; - free(value); -#endif - - ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_JOBID, SEPARATORS, - 0, &request->jobid); - if (ret && ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) { - glite_renewal_log(ctx, LOG_ERR, "Protocol error reading JobId : %s", - edg_wlpr_GetErrorString(ret)); - goto err; - } - - index = 0; - while ((ret = edg_wlpr_GetToken(msg, msg_len, EDG_WLPR_PROTO_ENTRY, - SEPARATORS, index, &value)) == 0) { - char **tmp; - - tmp = realloc(request->entries, (index + 2) * sizeof(*tmp)); - if (tmp == NULL) { - ret = ENOMEM; - goto err; - } - request->entries = tmp; - request->entries[index] = value; - index++; - } - if (ret != EDG_WLPR_ERROR_PROTO_PARSE_NOT_FOUND) - goto err; - if (request->entries) - request->entries[index] = NULL; - - return 0; - -err: - edg_wlpr_CleanRequest(request); - return ret; -} - -static int -encode_response(glite_renewal_core_context ctx, edg_wlpr_Response *response, char **msg) -{ - char *buf; - size_t buf_len; - int ret; - - buf_len = EDG_WLPR_BUF_SIZE; - buf = malloc(buf_len); - if (buf == NULL) - return ENOMEM; - buf[0] = '\0'; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_VERSION, - EDG_WLPR_VERSION, SEPARATORS); - if (ret) - goto err; - - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_RESPONSE, - edg_wlpr_EncodeInt(response->response_code), - SEPARATORS); - if (ret) - goto err; - - if (response->myproxy_server) { - char host[1024]; - -#if 0 - snprintf(host, sizeof(host), "%s:%d", response->myproxy_server, - (response->myproxy_port) ? response->myproxy_port : EDG_WLPR_MYPROXY_PORT); -#endif - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_MYPROXY_SERVER, - host, SEPARATORS); - if (ret) - goto err; - } - - if (response->start_time) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_START_TIME, - edg_wlpr_EncodeInt(response->start_time), - SEPARATORS); - if (ret) - goto err; - } - - if (response->end_time) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_END_TIME, - edg_wlpr_EncodeInt(response->end_time), - SEPARATORS); - if (ret) - goto err; - } - - if (response->next_renewal_time) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_RENEWAL_TIME, - edg_wlpr_EncodeInt(response->next_renewal_time), - SEPARATORS); - if (ret) - goto err; - } - - if (response->filenames) { - char **p = response->filenames; - while (*p) { - ret = edg_wlpr_StoreToken(&buf, &buf_len, EDG_WLPR_PROTO_PROXY, *p, - SEPARATORS); - if (ret) - goto err; - p++; - } - } - - buf[strlen(buf)] = '\0'; - *msg = buf; - return 0; - -err: - free(buf); - *msg = NULL; - return ret; -} - - -static void -usage(glite_renewal_core_context ctx, char *progname) -{ - fprintf(stderr,"usage: %s [option]\n" - "\t-h, --help display this help and exit\n" - "\t-v, --version output version information and exit\n" - "\t-d, --debug don't fork, print out debugging information\n" - "\t-r, --repository repository directory\n" - "\t-c, --condor-limit how long before expiration the proxy must be renewed\n" - "\t-C, --CAdir trusted certificates directory\n" - "\t-V, --VOMSdir trusted VOMS servers certificates directory\n" - "\t-A, --enable-voms renew also VOMS certificates in proxies\n" - "\t-G, --voms-config location of the vomses configuration file\n", - progname); -} - -static int -do_listen(glite_renewal_core_context ctx, char *socket_name, int *sock) -{ - struct sockaddr_un my_addr; - int s; - int ret; - - assert(sock != NULL); - - memset(&my_addr, 0, sizeof(my_addr)); - my_addr.sun_family = AF_UNIX; - strncpy(my_addr.sun_path, socket_name, sizeof(my_addr.sun_path)); - unlink(socket_name); - umask(0177); - - s = socket(AF_UNIX, SOCK_STREAM, 0); - if (s == -1) { - glite_renewal_log(ctx, LOG_ERR, "socket(): %s", strerror(errno)); - return errno; - } - - ret = bind(s, (struct sockaddr *)&my_addr, sizeof(my_addr)); - if (ret == -1) { - glite_renewal_log(ctx, LOG_ERR, "bind(): %s", strerror(errno)); - close(s); - return errno; - } - - ret = listen(s, 50); - if (ret == -1) { - glite_renewal_log(ctx, LOG_ERR, "listen(): %s", strerror(errno)); - close(s); - return errno; - } - - *sock = s; - return 0; -} - -int -start_watchdog(glite_renewal_core_context ctx, pid_t *pid) -{ - pid_t p; - - switch ((p = fork())) { - case -1: - glite_renewal_log(ctx, LOG_ERR, "fork() failed: %s", - strerror(errno)); - return errno; - case 0: - watchdog_start(ctx); - exit(0); - break; - default: - *pid = p; - return 0; - } - /* not reachable */ - exit(0); -} - -int main(int argc, char *argv[]) -{ - int sock; - char *progname; - int opt; - int fd; - char sockname[PATH_MAX]; - int ret; - pid_t pid; - struct sigaction sa; - const char *s = NULL; - glite_renewal_core_context ctx = NULL; - - progname = strrchr(argv[0],'/'); - if (progname) progname++; - else progname = argv[0]; - - repository = EDG_WLPR_REPOSITORY_ROOT; - debug = 0; - - while ((opt = getopt_long(argc, argv, "hvdr:c:C:V:AG:t:k:", opts, NULL)) != EOF) - switch (opt) { - case 'h': usage(ctx, progname); exit(0); - case 'v': fprintf(stdout, "%s:\t%s\n", progname, rcsid); exit(0); - case 'd': debug = 1; break; - case 'r': repository = optarg; break; - case 'c': condor_limit = atoi(optarg); break; - case 'C': cadir = optarg; break; - case 'V': vomsdir = optarg; break; - case 'A': voms_enabled = 1; break; - case 'G': vomsconf = optarg; break; - case 't': cert = optarg; break; - case 'k': key = optarg; break; - case '?': usage(ctx, progname); return 1; - } - - if (optind < argc) { - usage(ctx, progname); - exit(1); - } - - ret = glite_renewal_core_init_ctx(&ctx); - if (ret) { - fprintf(stderr, "Cannot initialize context\n"); - exit(1); - } - if (debug) { - ctx->log_level = LOG_DEBUG; - ctx->log_dst = GLITE_RENEWAL_LOG_STDOUT; - } - ctx->voms_conf = vomsconf; - - if (chdir(repository)) { - glite_renewal_log(ctx, LOG_ERR, "Cannot access repository directory %s (%s)", - repository, strerror(errno)); - exit(1); - } - - globus_module_activate(GLOBUS_GSI_CERT_UTILS_MODULE); - globus_module_activate(GLOBUS_GSI_PROXY_MODULE); - - if (!debug) { - /* chdir ? */ - if (daemon(1,0) == -1) { - perror("deamon()"); - exit(1); - } - openlog(progname, LOG_PID, LOG_DAEMON); - } - - if (cert) - setenv("X509_USER_CERT", cert, 1); - - if (key) - setenv("X509_USER_KEY", key, 1); - - if (cadir) - setenv("X509_CERT_DIR", cadir, 1); - - s = getenv("GLITE_PR_TIMEOUT"); - default_timeout = s ? atof(s) : GLITE_PR_TIMEOUT_DEFAULT; - - memset(&sa,0,sizeof(sa)); - sa.sa_handler = catchsig; - sigaction(SIGINT,&sa,NULL); - sigaction(SIGQUIT,&sa,NULL); - sigaction(SIGTERM,&sa,NULL); - sigaction(SIGCHLD,&sa,NULL); - sigaction(SIGPIPE,&sa,NULL); - - ret = start_watchdog(ctx, &pid); - if (ret) - return 1; - - umask(0177); - snprintf(sockname, sizeof(sockname), "%s%d", - DGPR_REG_SOCKET_NAME_ROOT, getuid()); - /* XXX check that the socket is not already active */ - ret = do_listen(ctx, sockname, &sock); - if (ret) - return 1; - glite_renewal_log(ctx, LOG_DEBUG, "Listening at %s", sockname); - - ret = doit(ctx, sock); - - close(sock); - return ret; -} diff --git a/org.glite.security.proxyrenewal/src/renewd_locl.h b/org.glite.security.proxyrenewal/src/renewd_locl.h deleted file mode 100644 index 489e909..0000000 --- a/org.glite.security.proxyrenewal/src/renewd_locl.h +++ /dev/null @@ -1,82 +0,0 @@ -#ifndef RENEWALD_LOCL_H -#define RENEWALD_LOCL_H - -#ident "$Header$" - -#include -#include -#include - -#include "renewal.h" -#include "renewal_core.h" - -#ifdef HAVE_DMALLOC_H -#include -#endif - -/* XXX */ -#if 0 -#define EDG_WLPR_ERROR_PARSE_NOT_FOUND EDG_WLPR_ERROR_PROTO_PARSE_ERROR -#define EDG_WLPR_ERROR_NOTFOUND EDG_WLPR_PROXY_NOT_REGISTERED -#endif - -typedef struct { - unsigned int len; - char **val; -} prd_list; - -typedef struct { - int suffix; - prd_list jobids; - int unique; - int voms_exts; - char *myproxy_server; - time_t end_time; - time_t next_renewal; -} proxy_record; - -/* commands */ -void -register_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -void -unregister_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -void -get_proxy(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -void -update_db(glite_renewal_core_context ctx, edg_wlpr_Request *request, edg_wlpr_Response *response); - -int -get_times(glite_renewal_core_context ctx, char *proxy_file, proxy_record *record); - -void -watchdog_start(glite_renewal_core_context ctx); - -void -glite_renewal_log(glite_renewal_core_context ctx, int dbg_level, const char *format, ...); - -int -decode_record(glite_renewal_core_context ctx, char *line, proxy_record *record); - -int -encode_record(glite_renewal_core_context ctx, proxy_record *record, char **line); - -void -free_record(glite_renewal_core_context ctx, proxy_record *record); - -int -glite_renewal_load_proxy(glite_renewal_core_context ctx, const char *filename, X509 **cert, EVP_PKEY **privkey, - STACK_OF(X509) **chain, globus_gsi_cred_handle_t *proxy); - -int -glite_renewal_get_proxy_base_name(glite_renewal_core_context ctx, const char *file, char **subject); - -int -glite_renewal_renew_voms_creds(glite_renewal_core_context ctx, const char *cur_file, const char *renewed_file, const char *new_file); - -int -glite_renewal_check_voms_attrs(glite_renewal_core_context ctx, const char *proxy); - -#endif /* RENEWALD_LOCL_H */ diff --git a/org.glite.security.proxyrenewal/src/voms.c b/org.glite.security.proxyrenewal/src/voms.c deleted file mode 100644 index 687d93b..0000000 --- a/org.glite.security.proxyrenewal/src/voms.c +++ /dev/null @@ -1,356 +0,0 @@ -#include "renewal_locl.h" -#include "renewd_locl.h" - -#include -#include - -#include "glite/security/voms/voms_apic.h" - -#include "glite/security/voms/newformat.h" - -char * Decode(const char *, int, int *); -char **listadd(char **, char *, int); - -static int -generate_proxy(glite_renewal_core_context ctx, globus_gsi_cred_handle_t cur_proxy, - X509_EXTENSION *voms_extension, const char *new_file) -{ - globus_result_t result; - globus_gsi_proxy_handle_t proxy_handle = NULL; - globus_gsi_cred_handle_t proxy = NULL; - EVP_PKEY *cur_proxy_priv_key = NULL; - X509 *new_cert = NULL; - X509 *voms_cert = NULL; - globus_gsi_cert_utils_cert_type_t proxy_type; - - result = globus_gsi_proxy_handle_init(&proxy_handle, NULL); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_proxy_handle_init() failed\n"); - goto end; - } - - result = globus_gsi_cred_get_key(cur_proxy, &cur_proxy_priv_key); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_cred_get_key() failed\n"); - goto end; - } - - /* Create and sign a new proxy */ - result = globus_gsi_cred_get_cert_type(cur_proxy, &proxy_type); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_cred_get_cert_type() failed\n"); - goto end; - } - - result = globus_gsi_proxy_handle_set_type(proxy_handle, proxy_type); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_proxy_handle_set_type() failed\n"); - goto end; - } - - result = globus_gsi_proxy_create_signed(proxy_handle, cur_proxy, &proxy); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_proxy_handle_init() failed\n"); - goto end; - } - - /* Get the new proxy */ - result = globus_gsi_cred_get_cert(proxy, &new_cert); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_cred_get_cert() failed\n"); - goto end; - } - - /* The Globus API doesn't allow to store custom X.509 extensions */ - voms_cert = X509_dup(new_cert); - if (voms_cert->cert_info->extensions == NULL) - voms_cert->cert_info->extensions = sk_X509_EXTENSION_new_null(); - sk_X509_EXTENSION_push(voms_cert->cert_info->extensions, voms_extension); - - /* Openssl ensures that memory containing old signature structures is unallocated */ -#if 0 - X509_sign(voms_cert, cur_proxy_priv_key, proxy_handle->attrs->signing_algorithm); -#else - X509_sign(voms_cert, cur_proxy_priv_key, EVP_md5()); -#endif - - /* And put the cert back, older one is unallocated by the function */ - result = globus_gsi_cred_set_cert(proxy, voms_cert); - if (result) { - glite_renewal_log(ctx, LOG_ERR, "globus_gsi_cred_set_cert() failed\n"); - goto end; - } - - result = globus_gsi_cred_write_proxy(proxy, (char *)new_file); - -end: - - return 0; -} - -static int -my_VOMS_Export(glite_renewal_core_context ctx, void *buf, int buf_len, X509_EXTENSION **extension) -{ - AC *ac = NULL; - unsigned char *p, *pp; - AC **voms_attrs = NULL; - - p = pp = buf; - ac = d2i_AC(NULL, &p, buf_len+1); - if (ac == NULL) { - glite_renewal_log(ctx, LOG_ERR, "d2i_AC() failed\n"); - return 1; - } - - voms_attrs = (AC **)listadd((char **)voms_attrs, (char *)ac, sizeof(AC *)); - - *extension = X509V3_EXT_conf_nid(NULL, NULL, OBJ_txt2nid("acseq"), - (char*)voms_attrs); - return 0; -} - -static int -create_voms_command(glite_renewal_core_context ctx, struct vomsdata *vd, struct voms **voms_cert, char **command) -{ - int voms_error, ret; - struct data **attribs; - -#if 0 - VOMS_ResetOrder(vd, &voms_error); - for (i = 2; i < argc; i++) { - ret = VOMS_Ordering(argv[i], vd, &voms_error); - if (ret == 0) { - glite_renewal_log(ctx, LOG_ERR, "VOMS_Ordering() failed\n"); - return 1; - } - } -#endif - - if (voms_cert == NULL || *voms_cert == NULL || (*voms_cert)->std == NULL) { - glite_renewal_log(ctx, LOG_ERR, "Invalid VOMS certificate\n"); - return 1; - } - - attribs = (*voms_cert)->std; - - if (strcmp (attribs[0]->role, "NULL") == 0 ) - ret = asprintf(command, "G%s", attribs[0]->group); - else - ret = asprintf(command, "B%s:%s", attribs[0]->group, attribs[0]->role); - -end: - - return 0; -} - -static int -renew_voms_cert(glite_renewal_core_context ctx, struct vomsdata *vd, struct voms **voms_cert, - char **buf, size_t *buf_len) -{ - int voms_error = 0, i, ret, voms_version; - struct contactdata **voms_contacts = NULL; - char *command = NULL; - - voms_contacts = VOMS_FindByVO(vd, (*voms_cert)->voname, ctx->voms_conf, NULL, &voms_error); - - if (voms_contacts == NULL) { - glite_renewal_log(ctx, LOG_ERR, "VOMS_FindByVO() failed\n"); - return 1; - } - - ret = create_voms_command(ctx, vd, voms_cert, &command); - - /* XXX the lifetime should be taken from the older proxy */ - ret = VOMS_SetLifetime(60*60*12, vd, &voms_error); - - /* XXX iterate over all servers on the list on errors */ - ret = VOMS_ContactRaw(voms_contacts[0]->host, voms_contacts[0]->port, - voms_contacts[0]->contact, command, - (void**) buf, buf_len, &voms_version, - vd, &voms_error); - if (ret == 0) { - glite_renewal_log(ctx, LOG_ERR, "VOMS_Contact() failed\n"); - return 1; - } - - VOMS_DeleteContacts(voms_contacts); - - if (command) - free(command); - - return 0; -} - -static int -renew_voms_certs(glite_renewal_core_context ctx, const char *cur_file, const char *renewed_file, const char *new_file) -{ - globus_gsi_cred_handle_t cur_proxy = NULL; - globus_gsi_cred_handle_t new_proxy = NULL; - struct vomsdata *vd = NULL; - struct voms **voms_cert = NULL; - int voms_err, ret; - X509 *cert = NULL; - STACK_OF(X509) *chain = NULL; - char *buf = NULL; - size_t buf_len = 0; - X509_EXTENSION *extension = NULL; - char *old_env_proxy = getenv("X509_USER_PROXY"); - char *old_env_cert = getenv("X509_USER_CERT"); - char *old_env_key = getenv("X509_USER_KEY"); - - setenv("X509_USER_PROXY", cur_file, 1); - setenv("X509_USER_CERT", renewed_file, 1); - setenv("X509_USER_KEY", renewed_file, 1); - - ret = glite_renewal_load_proxy(ctx, cur_file, &cert, NULL, &chain, &cur_proxy); - if (ret) - goto end; - - vd = VOMS_Init(NULL, NULL); - if (vd == NULL) { - glite_renewal_log(ctx, LOG_ERR, "VOMS_Init() failed\n"); - return 1; - } - - ret = VOMS_Retrieve(cert, chain, RECURSE_CHAIN, vd, &voms_err); - if (ret == 0) { - if (voms_err == VERR_NOEXT) { - /* no VOMS cred, no problem; continue */ - /* XXX this part shouldn't be reachable, this call is only called - * if the proxy does contain VOMS attributes */ - glite_renewal_log(ctx, LOG_ERR, "No VOMS attributes found in proxy %s\n", cur_file); - ret = 0; - goto end; - } else { - glite_renewal_log(ctx, LOG_ERR, "Cannot get VOMS certificate(s) from proxy"); - ret = 1; - goto end; - } - } - - /* XXX make sure this loop can really work for multiple voms certificates - * embedded in the proxy */ - for (voms_cert = vd->data; voms_cert && *voms_cert; voms_cert++) { - char *tmp, *ptr; - size_t tmp_len; - - ret = renew_voms_cert(ctx, vd, voms_cert, &tmp, &tmp_len); - if (ret) - goto end; - ptr = realloc(buf, buf_len + tmp_len); - if (ptr == NULL) { - ret = ENOMEM; - goto end; - } - buf = ptr; - memcpy(buf + buf_len, tmp, tmp_len); - buf_len += tmp_len; - } - - if (buf == NULL) { - /* no extension renewed, return */ - ret = 0; - goto end; - } - - ret = my_VOMS_Export(ctx, buf, buf_len, &extension); - if (ret) - goto end; - - ret = glite_renewal_load_proxy(ctx, renewed_file, NULL, NULL, NULL, &new_proxy); - if (ret) - goto end; - - ret = generate_proxy(ctx, new_proxy, extension, new_file); - -end: - (old_env_proxy) ? setenv("X509_USER_PROXY", old_env_proxy, 1) : - unsetenv("X509_USER_PROXY"); - (old_env_cert) ? setenv("X509_USER_CERT", old_env_cert, 1) : - unsetenv("X509_USER_CERT"); - (old_env_key) ? setenv("X509_USER_KEY", old_env_key, 1) : - unsetenv("X509_USER_KEY"); - - if (cert) - X509_free(cert); - if (chain) - sk_X509_pop_free(chain, X509_free); - if (vd) - VOMS_Destroy(vd); - if (cur_proxy) - globus_gsi_cred_handle_destroy(cur_proxy); - if (new_proxy) - globus_gsi_cred_handle_destroy(new_proxy); - if (buf) - free(buf); - - return ret; -} - -int -glite_renewal_renew_voms_creds(glite_renewal_core_context ctx, const char *cur_file, const char *renewed_file, const char *new_file) -{ - return renew_voms_certs(ctx, cur_file, renewed_file, new_file); -} - -int -glite_renewal_check_voms_attrs(glite_renewal_core_context ctx, const char *proxy) -{ - int ret, voms_err, present; - X509 *cert = NULL; - STACK_OF(X509) *chain = NULL; - struct vomsdata *vd = NULL; - - ret = glite_renewal_load_proxy(ctx, proxy, &cert, NULL, &chain, NULL); - if (ret) - return 0; - - vd = VOMS_Init(NULL, NULL); - if (vd == NULL) { - present = 0; - goto end; - } - - ret = VOMS_Retrieve(cert, chain, RECURSE_CHAIN, vd, &voms_err); - if (ret == 0) { - present = 0; - goto end; - } - - present = 1; - -end: - if (cert) - X509_free(cert); - if (chain) - sk_X509_pop_free(chain, X509_free); - if (vd) - VOMS_Destroy(vd); - - return present; -} - -#if 0 -int -main(int argc, char *argv[]) -{ - int ret; - const char *current_proxy = "/tmp/x509up_u11930"; - const char *renewed_proxy = "/tmp/proxy"; - - if (argc > 1) - current_proxy = argv[1]; - if (argc > 2) - renewed_proxy = argv[2]; - - if (globus_module_activate(GLOBUS_GSI_PROXY_MODULE) != GLOBUS_SUCCESS || - globus_module_activate(GLOBUS_GSI_CERT_UTILS_MODULE) != GLOBUS_SUCCESS) { - glite_renewal_log(ctx, LOG_ERR, "[%d]: Unable to initialize Globus modules\n", getpid()); - return 1; - } - - ret = renew_voms_certs(current_proxy, renewed_proxy); - - return 0; -} -#endif diff --git a/org.glite.testsuites.ctb/LB/LB-certconfig b/org.glite.testsuites.ctb/LB/LB-certconfig deleted file mode 100644 index 2cee273..0000000 --- a/org.glite.testsuites.ctb/LB/LB-certconfig +++ /dev/null @@ -1,10 +0,0 @@ -#Defining arguments for the test scripts - -#LB hostname -LB_HOST="lxbra2303.cern.ch" - -#address of the glite-lb-bkserver daemon host:port -export GLITE_WMS_QUERY_SERVER="lxbra2303.cern.ch:9000" - -#address of the glite-lb-logd daemon host:port -export GLITE_WMS_LOG_DESTINATION="lxbra2303.cern.ch:9002" diff --git a/org.glite.testsuites.ctb/LB/LB-certtest.sh b/org.glite.testsuites.ctb/LB/LB-certtest.sh deleted file mode 100755 index 837ee01..0000000 --- a/org.glite.testsuites.ctb/LB/LB-certtest.sh +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/sh -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# AUTHORS: Gianni Pucciani, CERN -# -############################################################################## - -showUsage () -{ - echo " " - echo "Usage: LB-certtest.sh " - echo " " -} - -exitFailure () -{ -echo "------------------------------------------------" -echo "END `date`" -echo "-TEST FAILED-" -exit -1 -} - -####################### -#Parsing the arguments# -####################### -if [ "$1" = "-h" ] || [ "$1" = "-help" ] || [ "$1" = "--help" ] || [ $# -gt 0 ]; then - showUsage - exit 2 -fi - -################################### -# Check for environment variables # -################################### - -if [ -e "LB-certconfig" ]; then - source ./LB-certconfig -else - echo "The file ./LB-certconfig must be sourced in order to run the tests" - exitFailure -fi - -if [ -z "$LB_HOST" ]; then - echo "You need to set LB_HOST in order to run the tests" - exitFailure -fi - -if [ -z "$GLITE_WMS_QUERY_SERVER" ]; then - echo "You need to set GLITE_WMS_QUERY_SERVER in order to run the tests" - exitFailure -fi -######### -# START # -######### - -echo "START `date` " -echo "------------------------------------------------" - -#################################### -# Checking if there is valid proxy # -#################################### - -#ProxyExist=`voms-proxy-info 2>/dev/null | grep timeleft | wc -l` - -#ProxyExpired=`voms-proxy-info 2>/dev/null | grep "timeleft : 0:00:00" | wc -l` - -#if [ $ProxyExist -gt 0 -a $ProxyExpired -eq 0 ]; then - #nop - : -#else -# echo "Valid proxy is needed for this test!" -# if [ $ProxyExpired -gt 0 ]; then -# echo "Proxy credential expired!" -# fi -# exitFailure -#fi - -######################## -# Launch all the tests # -######################## - -declare -a tests_failed -failed=no - -testdir=./tests -tests_list=( lb-test-server-remote.sh lb-test-logger-remote.sh \ -lb-test-normal-event-delivery-remote.sh lb-test-job-registration.sh ) - -pushd $testdir >> /dev/null -touch testfile 2> /dev/null -if [ $? -ne 0 ]; then - echo "LB test directory is not writable, if you are on AFS be sure to have a valid token" - exitFailure -fi - -for item in ${tests_list[*]} -do - rm -rf ${item}_result.txt testfile - echo "Executing $item" - if [ "$item" = "lb-test-server-remote.sh" -o "$item" = "lb-test-logger-remote.sh" ]; then - echo "./$item $LB_HOST" > ${item}_result.txt - ./$item $LB_HOST >> ${item}_result.txt - elif [ "$item" = "lb-test-normal-event-delivery-remote.sh" -o "$item" = "lb-test-job-registration.sh" ]; then - echo "./$item" > ${item}_result.txt - ./$item >> ${item}_result.txt 2>&1 - fi - res=$? - grep '\-TEST FAILED\-' ${item}_result.txt >> /dev/null - if [ "$?" = 0 -o "$res" != 0 ]; then - echo "$item FAILED" - failed=yes - tests_failed=( "${tests_failed[@]}" "$item" ) - else - echo "$item PASSED" - fi -done -popd >> /dev/null - -echo "------------------------------------------------" -echo "END `date`" - -######################### -# Analyse tests outcome # -######################### - -if [ $failed = "yes" ]; then - - echo "TEST_FAILED" - echo "The following tests failed:" - for item in ${tests_failed[*]} - do - echo "$item: results in tests/${item}_result.txt" - done -else - echo "TEST_PASSED" -fi - diff --git a/org.glite.testsuites.ctb/LB/Makefile b/org.glite.testsuites.ctb/LB/Makefile deleted file mode 100644 index b50f0ca..0000000 --- a/org.glite.testsuites.ctb/LB/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CC=gcc -CFLAGS= -EXEC=testSocket - -all: $(EXEC) - -testSocket: testSocket.c - $(CC) -o $@ $< $(CFLAGS) - rm -f tests - ln -fs . tests - -clean: - rm -rf *.o tests $(EXEC) *.tmp *.err - diff --git a/org.glite.testsuites.ctb/LB/manual/Readme.txt b/org.glite.testsuites.ctb/LB/manual/Readme.txt deleted file mode 100644 index 36fb213..0000000 --- a/org.glite.testsuites.ctb/LB/manual/Readme.txt +++ /dev/null @@ -1,147 +0,0 @@ -$Header$ - -Readme file for basic LB Integration tests - -Service ping tests: -=================== - -Prerequisities for all service ping tests: ------------------------------ -- the following environment variables set: - - GLITE_LOCATION - PATH to gLite software - SAME_SENSOR_HOME - PATH to sensors (might be set to "." for testSocket sensor) - -- one may also need to run make to build the testSocket binary - and create link tests -> . (to be used for local SAME_SENSOR_HOME) - - -lb-test-logger-remote.sh ------------------------- -Script for remote testing of LB logger - -Run ./lb-test-logger-remote.sh -h for test description and usage. - -Example: - -$ ./lb-test-logger-remote.sh sci.civ.zcu.cz -Aug 13 15:57:02 scientific lb-test-logger-remote.sh: start -Testing if all binaries are available done -Testing ping to LB logger sci.civ.zcu.cz done -Testing LB logger at sci.civ.zcu.cz:9002 (logging) done -Aug 13 15:57:04 scientific lb-test-logger-remote.sh: end - - - -lb-test-server-remote.sh ------------------------- -Script for remote testing of LB server - -Run ./lb-test-server-remote.sh -h for test description and usage. - -Example: - -$ ./lb-test-server-remote.sh sci.civ.zcu.cz -Aug 13 15:58:22 scientific lb-test-server-remote.sh: start -Testing if all binaries are available done -Testing ping to LB server sci.civ.zcu.cz done -Testing LB server at sci.civ.zcu.cz:9000 (logging) done -Testing LB server at sci.civ.zcu.cz:9001 (queries) done -Testing LB server at sci.civ.zcu.cz:9003 (web services) done -Aug 13 15:58:26 scientific lb-test-server-remote.sh: end - - - -lb-test-server-local.sh ------------------------ -Script for testing an LB server running locally - -Run ./lb-test-server-local.sh -h for test description and usage. - -Example: - -$ lb-test-server-local.sh -Oct 22 10:59:17 scientific lb-test-server-local.sh: start -Testing if all binaries are available done -Testing if mySQL is running done -Testing if mySQL is accessible done -Testing if LB Server is running done -Testing if LB Server is listening on port 9010 done -Testing if LB Server is listening on port 9011 done -Testing if LB Server is listening on port 9013 done -Testing if Interlogger is running done -Testing if interlogger is listening on socket /tmp/intelogger_sustr.sock done -Oct 22 10:59:17 scientific lb-test-server-local.sh: end - - - -lb-test-logger-local.sh ------------------------ -Testing a local logger and interlogger running on a local machine. - -Run ./lb-test-logger-local.sh -h for test description and usage. - -Example: - -$ lb-test-logger-local.sh -Oct 22 11:02:04 scientific lb-test-logger-local.sh: start -Testing if all binaries are available done -Testing if LB logger is running done -Testing if LB logger is listening on port 9012 done -Testing if Interlogger is running done -Testing if interlogger is listening on socket /tmp/intelogger_sustr.sock done -Oct 22 11:02:05 scientific lb-test-logger-local.sh: end - - -System Functionality Tests -========================== - -Prerequisities for all system functionality tests: ------------------------------ -- the following environment variables set: - - GLITE_WMS_QUERY_SERVER - LB server address:port - GLITE_LOCATION - PATH to gLite software - SAME_SENSOR_HOME - PATH to sensors (might be set to "." for testSocket sensor) - -- one may also need to run make to build the testSocket binary - and create link tests -> . (to be used for local SAME_SENSOR_HOME) - - -lb-test-job-registration.sh ---------------------------- -Tests if it is possible to register jobs and query for their states. - -Example: - -$ lb-test-job-registration.sh -Oct 22 11:32:18 scientific lb-test-job-registration.sh: start -Testing if all binaries are available done -Testing credentials done -Registering testing job done -Is the testing job (https://scientific.civ.zcu.cz:9010/jf1Mgogl4-FvdQdrPe0a4Q) in a correct state? Submitted done -Oct 22 11:32:19 scientific lb-test-job-registration.sh: end - - - -lb-test-event-delivery.sh -------------------------- -Tests jobs registration, event deliver and proper state modification. - -Example: - -$ lb-test-event-delivery.sh -Oct 22 14:14:43 scientific lb-test-event-delivery.sh: start -Testing if all binaries are available done -Testing credentials done -Registering testing job done -Registered job: https://scientific.civ.zcu.cz:9010/jiOm5Wy7w4Q34JcOqVv_jQ -Logging events resulting in READY state -Sleeping for 10 seconds (waiting for events to deliver)... -Is the testing job (https://scientific.civ.zcu.cz:9010/jiOm5Wy7w4Q34JcOqVv_jQ) in a correct state? Ready done -Logging events resulting in RUNNING state -Logging events resulting in DONE state -Sleeping for 10 seconds (waiting for events to deliver)... -Testing job (https://scientific.civ.zcu.cz:9010/jiOm5Wy7w4Q34JcOqVv_jQ) is in state: Done done -Oct 22 14:15:07 scientific lb-test-event-delivery.sh: end - diff --git a/org.glite.testsuites.ctb/LB/manual/Readme2.txt.old b/org.glite.testsuites.ctb/LB/manual/Readme2.txt.old deleted file mode 100644 index b32404f..0000000 --- a/org.glite.testsuites.ctb/LB/manual/Readme2.txt.old +++ /dev/null @@ -1,158 +0,0 @@ -Readme file for lb2 v1.0************************************* -Date: 19.03.2007 * -Author: * -************************************************************* - -lb-l2.sh -******** - -Normal event delivery and Normal Job States - -* Prerequisities: All services running (LBProxy not used), user must have a valid proxy on the UI - -* Test: -Registers jobs with glite-lb-job-reg preferably pointing to remote LB Server -Check of the job status -Logs sequences of events with glite-lb-..... sh scripts (ex: gite-lb-ready.sh) -Checks with glite-lb-job_log that the events got delivered aftewards -Checks with glite-lb-job_status that the status of the jobs are correct - -* Options: -echo " -h | --help Show this help message." -echo " -r | --retries Number of test retries (2 by default)" -echo " -n | --nbjobs Number of jobs (10 by default)" -echo " -m | --bkserver Host address of the BKServer ex:pc900.iihe.ac.be " -echo " -s | --states List of states in which could tested jobs fall." -echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." - - -* The name of the bkserver has to be specified everytime - -* The option -l 'size' addes random data to the messages send to the BKServer with glite-lb-logevent. - -* With the option -s you can specify the list of states that will be submitted randomly to the jobs created - -* When you specify a state, the script will send all the events the job has to pass trough. - - - -lb-l2Stat.sh -************ - -* This script is mainly the same than lb-l2.sh but it includes a mesure of time. - -* You can specify one more option - - echo " -t | --tags Number of user tags to load to each job." - - - - - -examples -******** - -./lb-l2.sh -n 4 -m gliterb.iihe.ac.be -s "Running Done" - -Registering 4 jobs.................... -https://pc900.iihe.ac.be:9000/3E8xyyH_FCb4z1rN5TymFw -https://pc900.iihe.ac.be:9000/aTLnW6Mmm_whpt_tbxHjPQ -https://pc900.iihe.ac.be:9000/TnuSJvVZCLcYDDv1GXdocw -https://pc900.iihe.ac.be:9000/WW-0FU8g4tID1TMMPZCEBg -Logging events to the 4 jobs.................................... - -Logging tags to the 4 jobs.................................... - -Checking the Events............................................. -Job 0 ....................[OK] -Job 1 ....................[OK] -Job 2 ....................[OK] -Job 3 ....................[OK] - -A detailed list of the sequence of events logged to each job has been printed to 1174296170.log - -Checking the Jobs Status........................................ - -Job: 0 ..Logged state:running-Recorded state : Running.......[OK] -Job: 1 ..Logged state:done-Recorded state : Done.......[OK] -Job: 2 ..Logged state:done-Recorded state : Done.......[OK] -Job: 3 ..Logged state:done-Recorded state : Done.......[OK] - -Final test result .........................................[OK] - - -1174296170.log (this file contains a detailed list of the sequence of events logged to each job during the test) - -... -Events Sent..... - 1 UserTag - 2 RegJob - 3 Accepted - 4 EnQueued - 5 DeQueued - 6 HelperCall - 7 Match - 8 HelperReturn - 9 EnQueued - 10 DeQueued - 11 Transfer - 12 Accepted - 13 Transfer - 14 Running - 15 Done -Events recorded in the LB server..... - 1 UserTag - 2 RegJob - 3 Accepted - 4 EnQueued - 5 DeQueued - 6 HelperCall - 7 Match - 8 HelperReturn - 9 EnQueued - 10 DeQueued - 11 Transfer - 12 Accepted - 13 Transfer - 14 Running - 15 Done -... - - - -./lb-l2Stat.sh -n 3 -m gliterb.iihe.ac.be -... -Sending events took for individual jobs the following time -https://pc900.iihe.ac.be:9000/QZUecSg86IXtZeMmU4Rd6Q 11.061101000 seconds -https://pc900.iihe.ac.be:9000/-R0CDDoicKdwqAZHEI32gA 9.438249000 seconds -https://pc900.iihe.ac.be:9000/x6qFebsaNOR1a31NlAhJIQ 3.167140000 seconds -Total time for 3 jobs: 23.666490000 -Average time for event: 7.888830000 -Average time for event and tags: .157776600 -Event throughput (events/sec): 6.338075481 -... - - -List of possible job Status -*************************** - -"Submitted Waiting Ready Cancelled Scheduled Aborted Running Done Cleared" - -* Submitted: The job has been submitted by the user but not yet processed by the Network Server - -* Waiting: The job has been accepted by the Network Server but not yet processed by the workload manager - -* Ready: The job has been assigned to a Computing Element but not yet transferred to it - -* Scheduled: The job is wainting in the CE's queue - -* Running: The job is running - -* Done: The job has finished - -* Aborted: The job has been aborted by the WMS (it was too long or the proxy certificate expired) - -* Cancelled: The job has been cancelled by the user - -* Cleared: The output sandbox has been transferred to the UserInterface - diff --git a/org.glite.testsuites.ctb/LB/tests/Makefile b/org.glite.testsuites.ctb/LB/tests/Makefile deleted file mode 100644 index b50f0ca..0000000 --- a/org.glite.testsuites.ctb/LB/tests/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CC=gcc -CFLAGS= -EXEC=testSocket - -all: $(EXEC) - -testSocket: testSocket.c - $(CC) -o $@ $< $(CFLAGS) - rm -f tests - ln -fs . tests - -clean: - rm -rf *.o tests $(EXEC) *.tmp *.err - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-common.sh b/org.glite.testsuites.ctb/LB/tests/lb-common.sh deleted file mode 100755 index a8a862d..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-common.sh +++ /dev/null @@ -1,281 +0,0 @@ -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ------------------------------------------------------------------------------ -# Definitions of functions and variables common to LB test scripts -# -# ping_host() - basic network ping -# check_binaries() - check for binary executables, calls check_exec() -# check_socket() - TCPecho to host:port -# -# ------------------------------------------------------------------------------ - -# read common definitions and functions -TEST_COMMON=test-common.sh -if [ ! -r ${TEST_COMMON} ]; then - printf "Common definitions '${TEST_COMMON}' not found!\n" - exit 2 -fi -source ${TEST_COMMON} - -ulimit -c unlimited - -# define variables -GLITE_LB_LOCATION=${GLITE_LB_LOCATION:-$GLITE_LOCATION} -GLITE_LOCATION=${GLITE_LOCATION:-'/opt/glite'} -SAME_SENSOR_HOME=${SAME_SENSOR_HOME:-.} -for dir in $GLITE_LOCATION $GLITE_LOCATION/lib64/glite-lb $GLITE_LOCATION/lib/glite-lb; do - if test -d "$dir/examples"; then PATH="$dir/examples:$PATH"; fi -done -PATH="$GLITE_LOCATION/bin:$PATH" -export PATH - -# LB binaries -LBLOGEVENT=glite-lb-logevent -LBJOBLOG=glite-lb-job_log -LBWSJOBLOG=glite-lb-ws_joblog -LBJOBREG=glite-lb-job_reg -LBUSERJOBS=glite-lb-user_jobs -LBJOBSTATUS=glite-lb-job_status -LBTHRJOBSTATUS=glite-lb-job_status_threaded -LBWSJOBSTATUS=glite-lb-ws_jobstat -LBWSGETVERSION=glite-lb-ws_getversion -LBPURGE=glite-lb-purge -LBCHANGEACL=glite-lb-change_acl -LBMON=glite-lb-lbmon -LBNOTIFY=glite-lb-notify -LBPURGE=glite-lb-purge -LBPARSEEFILE=glite-lb-parse_eventsfile -LB4AGUACTINFO=glite-lb-ws_lb4agu_GetActivityInfo -LB4AGUACTSTATUS=glite-lb-ws_lb4agu_GetActivityStatus -LBREGSANDBOX=glite-lb-register_sandbox -LBHISTORY=glite-lb-state_history -LBCMSCLIENT=glite-lb-cmsclient - -LB_LOGD=glite-lb-logd -LB_INTERLOGD=glite-lb-interlogd -LB_SERVER=glite-lb-bkserverd - -LB_READY_SH=glite-lb-ready.sh -LB_RUNNING_SH=glite-lb-running.sh -LB_DONE_SH=glite-lb-done.sh -LB_CLEARED_SH=glite-lb-cleared.sh - -LB_STATS=glite-lb-stats -LB_FROMTO=glite-lb-stats-duration-fromto - -#general grid binaries -GRIDPROXYINFO=grid-proxy-info - -# default LB ports -GLITE_LB_SERVER_PORT=${GLITE_LB_SERVER_PORT:-9000} -GLITE_LB_IL_SOCK=${GLITE_LB_IL_SOCK:-/tmp/interlogger.sock} -let GLITE_LB_SERVER_QPORT=${GLITE_LB_SERVER_PORT}+1 -if [ -z "${GLITE_LB_SERVER_WPORT}" ]; then - let GLITE_LB_SERVER_WPORT=${GLITE_LB_SERVER_PORT}+3 -fi - -GLITE_LB_LOGGER_PORT=${GLITE_LB_LOGGER_PORT:-9002} - -# default sockets -GLITE_WMS_LBPROXY_STORE_SOCK=${GLITE_WMS_LBPROXY_STORE_SOCK:-/tmp/lb proxy store.sock} - -# other binaries -TEST_SOCKET=$SAME_SENSOR_HOME/tests/testSocket -SYS_LSOF=lsof -SYS_GREP=grep -SYS_SED=sed -SYS_PS=ps -SYS_PIDOF=pidof -SYS_MYSQLD=mysqld -SYS_MYSQLADMIN=mysqladmin -SYS_PING=ping -SYS_AWK=awk -SYS_ECHO=echo -SYS_DOMAINNAME=domainname -SYS_CURL=curl -SYS_RM="rm -f" -SYS_CHMOD=chmod -SYS_LDAPSEARCH=ldapsearch -SYS_CAT=cat -SYS_NL=nl -SYS_TAIL=tail -SYS_DATE=date -SYS_EXPR=expr -SYS_BC=bc -SYS_SCP=scp -SYS_TOUCH=touch -SYS_HOSTNAME=hostname -SYS_RPM=rpm -SYS_WC=wc - -# not used at the moment -DEBUG=2 - -# ping host -function ping_host() -{ - if [ -z $1 ]; then - set_error "No host to ping" - return $TEST_ERROR - fi - PING_HOST=$1 - # XXX: there might be a better way to test the network reachability - result=`${SYS_PING} -c 3 $PING_HOST 2>/dev/null | ${SYS_GREP} " 0% packet loss"| wc -l` - if [ $result -gt 0 ]; then - return $TEST_OK - else - return $TEST_ERROR - fi -} - - -# check the binaries -function check_exec() -{ - if [ -z $1 ]; then - set_error "No binary to check" - return $TEST_ERROR - fi - # XXX: maybe use bash's command type? - local ret=`which $1 2> /dev/null` - if [ -n "$ret" -a -x "$ret" ]; then - return $TEST_OK - else - return $TEST_ERROR - fi -} - -function check_binaries() -{ -# TODO: test only the binaries that are needed - it can differ in each test - local ret=$TEST_OK - for file in $@ - do - check_exec $file - if [ $? -gt 0 ]; then - update_error "file $file not found" - ret=$TEST_ERROR - fi - done - return $ret -} - -# check socket -function check_socket() -{ - if [ $# -lt 2 ]; then - set_error "No host:port to check" - return $TEST_ERROR - fi - $TEST_SOCKET $1 $2 2> $testerrfile - if [ $? -eq 0 ]; then - return $TEST_OK - else - return $TEST_ERROR - fi -} - -# Check listener -# Arguments: -# $1: program expected to listen on the given port -# $2: TCP port to check -function check_listener() -{ - req_program=$1 - req_port=$2 - if [ -z $1 ]; then - set_error "No program name entered" - return $TEST_ERROR - fi - - pid=`lsof -F p -i TCP:$req_port | sed "s/^p//"` - if [ -z $pid ]; then - return $TEST_ERROR - fi - program=`ps -p ${pid} -o args= | grep -E "[\/]*$req_program[ \t]*"` - if [ -z "$program" ]; then - return $TEST_ERROR - else - return $TEST_OK - fi -} - - -# Check socket listener -# Arguments: -# $1: program expected to listen on the given socket -# $2: socket to check -function check_socket_listener() -{ - req_program=$1 - req_socket=$2 - if [ -z $1 ]; then - set_error "No program name entered" - return $TEST_ERROR - fi - - pid=`lsof -F p $req_socket | sed "s/^p//" | head -n 1` - if [ -z $pid ]; then - return $TEST_ERROR - fi - program=`ps -p ${pid} -o args= | grep -E "[\/]*$req_program[ \t]*"` - if [ -z "$program" ]; then - return $TEST_ERROR - else - return $TEST_OK - fi -} - -#df /var/lib/mysql/ | tail -n 1 | awk '{ print $4 }' - -function try_purge() -{ - #Purge test job - joblist=$1 - - printf "Purging test job (Trying the best, result will not be tested)\n" - - ${LBPURGE} -j ${joblist} - - $SYS_RM ${joblist} - -} - -function test_args() -{ - echo $@ -} - -function check_credentials() -{ - my_GRIDPROXYINFO=${GRIDPROXYINFO} - if [ "$1" != "" ]; then - my_GRIDPROXYINFO="${GRIDPROXYINFO} -f $1" - fi - - timeleft=`${my_GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - if [ "$timeleft" = "" ]; then - print_error "No credentials" - return 1 - fi - if [ "$timeleft" = "0:00:00" ]; then - print_error "Credentials expired" - return 1 - fi - return 0 -} diff --git a/org.glite.testsuites.ctb/LB/tests/lb-l2.sh b/org.glite.testsuites.ctb/LB/tests/lb-l2.sh deleted file mode 100755 index 585ad93..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-l2.sh +++ /dev/null @@ -1,280 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#3.1.4 et 3.2.1: Normal event delivery and Normal Job States - -#Prerequisities: All services running - -#Actions: -#Registers jobs with glite-lb-job-reg prferably pointing to remote LB Server -#Check of the job status -#Logs sequences of events with glite-lb-logevent -#Checks with glite-lb-job_log that the events got delivered aftewards -#Checks with glite-lb-job_status that the status of the jobs are correct - - -PATH=/opt/glite/examples:$PATH -#echo $PATH -LBJOBREG=${LBJOBREG:-glite-lb-job_reg} -LBLOGEVENT=${LBLOGEVENT:-glite-lb-logevent} -LBJOBSTATUS=${LBJOBSTATUS:-glite-lb-job_status} -LBJOBLOG=${LBJOBLOG:-glite-lb-job_log} -LBJOBSTAT=${LBJOBSTAT:-glite-lb-job_status} -LBPURGE=${PURGE:-glite-lb-purge} - -BKSERVER="localhost" -STATES="aborted cancelled done ready running scheduled waiting submitted " -SOURCES="NetworkServer WorkloadManager BigHelper JobController LogMonitor LRMS Application UserInterface" - -dtest=1 -i=0 -JOBS_ARRAY_SIZE=10 -INTERVAL=2 -DATE_S=`date +"%s"` -DATE=`date` -LOG_FILE="$DATE_S.log" - - -init() -{ -echo "Date: $DATE" > $LOG_FILE -export EDG_WL_QUERY_SERVER="$BKSERVER:9000" -export EDG_WL_LOG_DESTINATION="$BKSERVER:9002" -BKSERVER_HOST="$BKSERVER:9000" -BKSERVER_OPT="-m $BKSERVER" -} - - -getJobId() -{ -cat jobreg |grep "EDG_JOBID" |cut -c12- > jobList2 -res=`cat jobList2 |wc -c` -res=$[$res-2] -cat jobList2 |cut -c1-`echo $res` > jobreg -rm jobList2 -} - -#registrating a job -job_reg() -{ -eval $LBJOBREG $BKSERVER_OPT -s $1 > jobreg -getJobId -job=`cat jobreg` -rm jobreg -} - -#registering a list of jobs which jobid's are placed in an array -array_job_reg() -{ -echo "Registering $JOBS_ARRAY_SIZE jobs...................." -job_id=0 -st_count=`echo $SOURCES | wc -w` -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` - jsource=`echo $SOURCES | cut -d " " -f $tmp | tr A-Z a-z` - job_reg $jsource - echo $job - SAMPLE_JOBS_ARRAY[$job_id]=$job - job_id=$[$job_id+1] - done -} - -#Event delivery test -testLB() -{ -echo "Checking the Events............................................." -echo -job_id=0 -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - #sleep 2 - #out is the list of events sent, we count the number of events and then we extract the job status - nbEvents=`cat out[$job_id] |grep glite-lb-logevent | wc -l` - nbEvents=$[$nbEvents+1] - cat out[$job_id] |gawk -F"-e " '{ print $2 }' > eventsTemp - echo "UserTag"> events - echo "RegJob">> events - cat eventsTemp|gawk -F" --" '{ print $1 }'>> events - rm eventsTemp - events3="blank" - i=0 - cmp -s events events3 - while [ $? -ne 0 ] && [ $i -lt $INTERVAL ] ; do - - - #we use glite-lb-job_log and apply the same treatment as above to the output - eval $LBJOBLOG -r $INTERVAL -d 2 ${SAMPLE_JOBS_ARRAY[$job_id]} > joblog2 - nbevents=`cat joblog2 | grep DATE | wc -l` - cat joblog2|gawk -F"DG.EVNT=\"" '{ print $2 }' > eventsTemp2 - cat eventsTemp2|gawk -F"\"" '{ print $1 }'> events2 - cat events2|sed /^$/d > events3 - rm eventsTemp2 events2 joblog2 - #Comparison of the outputs and intermediary printout - echo "Events Sent....." >> $LOG_FILE - cat -n events >> $LOG_FILE -# cat -n events - echo "Events recorded in the LB server....." >> $LOG_FILE - cat -n events3 >> $LOG_FILE -# cat -n events3 - i=$[$i+1] - cmp -s events events3 - done - cmp -s events events3 - if [ $? -eq 0 ]; then - echo "Job $job_id ....................[OK]" - i=0 - - else - echo "Job $job_id.....................[FAILED]" - dtest=0 - fi - rm events events3 out[$job_id] - job_id=$[$job_id+1] -done -echo -echo "A detailed list of events logged has been printed to $LOG_FILE" -echo -} - -#job status test -testLB2() -{ -echo "Checking the Jobs Status........................................" -echo -job_id=0 - while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - #sleep 1 - eval $LBJOBSTATUS ${SAMPLE_JOBS_ARRAY[$job_id]} > status - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - i=0 - while [ $testStatus -ne 1 ] && [ $i -lt $INTERVAL ] ; do - bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - i=$[$i+1] - done - if [ $testStatus -eq 1 ] ; then - echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[OK]" - else - echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[FAILED]" - cat status > errorStatus.tmp - echo "Detailed status has been copied to errorStatus.tmp" - echo - dtest=0 - fi - rm status -job_id=$[$job_id+1] -done -} - -#logging events to the jobs. Events are selected randomly from a list. -logEvents() -{ -echo "Logging events to the $JOBS_ARRAY_SIZE jobs...................................." -echo -job_id2=0 -st_count=`echo $STATES | wc -w` - while [ $job_id2 -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` - state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - SAMPLE_JOBS_STATES[$job_id2]=$state - echo >> $LOG_FILE - echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$job_id2]} " >> $LOG_FILE - echo >> $LOG_FILE - - echo "event submitted.......................................[$state]" >> $LOG_FILE - eval glite-lb-$state.sh $LARGE_STRESS -j ${SAMPLE_JOBS_ARRAY[$job_id2]} 2>out[$job_id2] - job_id2=$(($job_id2 + 1)) -done -} - -#logging tags to the jobs -logTags() -{ -echo "Logging tags to the $JOBS_ARRAY_SIZE jobs...................................." -echo - -job_id=0 -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - eval $LBLOGEVENT -s Application -e UserTag -j ${SAMPLE_JOBS_ARRAY[$job_id]} -name testTag -value 12345 >> $LOG_FILE -job_id=$[$job_id+1] -done -} - -showHelp() -{ -echo "Usage: $0 [OPTIONS] " -echo "Options:" -echo " -h | --help Show this help message." -echo " -r | --retries Number of test retries (2 by default)" -echo " -n | --nbjobs Number of jobs (10 by default)" -echo " -m | --bkserver Host address of the BKServer ex:pc900.iihe.ac.be " -echo " -s | --states List of states in which could tested jobs fall." -echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." -echo "" - -# echo "For proper operation check your grid-proxy-info" -# grid-proxy-info -} - - -#input -if [ -z "$1" ]; then - showHelp - exit 2 -fi -BK=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-r" | "--retries") shift ; INTERVAL=$1 ;; - "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; - "-m" | "--bkserver") shift ; BKSERVER=$1 BK=1;; - "-s" | "--states") shift; STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; -# "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1 try -h for help"; exit 2 ;; - - esac - shift -done -if [ $BK -ne 1 ]; then - echo - echo "You must specify the hostname of the LB Server with the option -m (ex: -m pf435.ulb.ac.be)" - echo - exit 2 -fi -echo - - -#main.................................................................. -init -array_job_reg -logEvents -logTags -testLB -testLB2 -#testProxy -#eval $LBPURGE -h -echo -if [ $dtest -eq 1 ];then - echo "Final test result .........................................[OK]" - exit 1 -else echo "Final test result .........................................[FAILED]" - exit 0 - fi -echo diff --git a/org.glite.testsuites.ctb/LB/tests/lb-l2ILR.sh b/org.glite.testsuites.ctb/LB/tests/lb-l2ILR.sh deleted file mode 100755 index b8ee45c..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-l2ILR.sh +++ /dev/null @@ -1,278 +0,0 @@ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -#3.1.3: Interlogger Recovery -############################################################################################## -#Prerequisities: locallogger(glite-lb-logd) and BKServer (glite-lb-bkserv) must be running. -#The interlogger(glite-lb-interl) must be stopped. (kill the process manually on the LB machine) - -#Actions: -#Registers jobs with glite-lb-job-reg -#Logs sequences of events with glite-lb-logevent -#User starts the interlogger daemon -#(/opt/glite/etc/config/scripts/glite-lb-cofig.py --start on your LB machine (as root)) -#Checks with glite-lb-job_log that the events got delivered aftewards -#by the interloger to the bookkeeping server. (from the localloger which is linked to the WMS) -#Checks with glite-lb-job_status that the status of the jobs are correct in the BKserver -############################################################################################### - -PATH=/opt/glite/examples:$PATH -#echo $PATH -LBJOBREG=${LBJOBREG:-glite-lb-job_reg} -LBLOGEVENT=${LBLOGEVENT:-glite-lb-logevent} -LBJOBSTATUS=${LBJOBSTATUS:-glite-lb-job_status} -LBJOBLOG=${LBJOBLOG:-glite-lb-job_log} -LBJOBSTAT=${LBJOBSTAT:-glite-lb-job_status} -LBPURGE=${PURGE:-glite-lb-purge} - -STATES="aborted cancelled done ready running scheduled waiting submitted " -SOURCES="NetworkServer WorkloadManager BigHelper JobController LogMonitor LRMS Application UserInterface" -dtest=1 -i=0 -JOBS_ARRAY_SIZE=10 -INTERVAL=2 -DATE_S=`date +"%s"` -DATE=`date` -LOG_FILE="$DATE_S.log" - -#initialisation -init() -{ -echo "Date: $DATE" > $LOG_FILE -export EDG_WL_QUERY_SERVER="$BKSERVER:9000" -export EDG_WL_LOG_DESTINATION="$BKSERVER:9002" -BKSERVER_HOST="$BKSERVER:9000" -BKSERVER_OPT="-m $BKSERVER" -} - -#extracting the job id -getJobId() -{ -cat jobreg |grep "EDG_JOBID" |cut -c12- > jobList2 -res=`cat jobList2 |wc -c` -res=$[$res-2] -cat jobList2 |cut -c1-`echo $res` > jobreg -rm jobList2 -} - -#registrating a job -job_reg() -{ -eval $LBJOBREG $BKSERVER_OPT -s $1 > jobreg -getJobId -job=`cat jobreg` -rm jobreg -} - -#registering a list of jobs which jobid's are placed in an array -array_job_reg() -{ -echo "Registering $JOBS_ARRAY_SIZE jobs...................." -job_id=0 -st_count=`echo $SOURCES | wc -w` -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` - jsource=`echo $SOURCES | cut -d " " -f $tmp | tr A-Z a-z` - job_reg $jsource - echo $job - SAMPLE_JOBS_ARRAY[$job_id]=$job - job_id=$[$job_id+1] - done -} - -#Event delivery test -testLB() -{ -echo "Checking the Events............................................." -echo -job_id=0 -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - #sleep 2 - #out is the list of events sent, we count the number of events and then we extract the job status - nbEvents=`cat out[$job_id] |grep glite-lb-logevent | wc -l` - nbEvents=$[$nbEvents+1] - cat out[$job_id] |gawk -F"-e " '{ print $2 }' > eventsTemp - echo "RegJob">> events - cat eventsTemp|gawk -F" --" '{ print $1 }'>> events - rm eventsTemp - events3="blank" - i=0 - cmp -s events events3 - while [ $? -ne 0 ] && [ $i -lt $INTERVAL ] ; do - - - #we use glite-lb-job_log and apply the same treatment as above to the output - eval $LBJOBLOG -r $INTERVAL -d 2 ${SAMPLE_JOBS_ARRAY[$job_id]} > joblog2 - nbevents=`cat joblog2 | grep DATE | wc -l` - cat joblog2|gawk -F"DG.EVNT=\"" '{ print $2 }' > eventsTemp2 - cat eventsTemp2|gawk -F"\"" '{ print $1 }'> events2 - cat events2|sed /^$/d > events3 - rm eventsTemp2 events2 joblog2 - #Comparison of the outputs and intermediary printout - echo "Events Sent....." >> $LOG_FILE - cat -n events >> $LOG_FILE -# cat -n events - echo "Events recorded in the LB server....." >> $LOG_FILE - cat -n events3 >> $LOG_FILE -# cat -n events3 - i=$[$i+1] - cmp -s events events3 - done - cmp -s events events3 - if [ $? -eq 0 ]; then - echo "Job $job_id ....................[OK]" - i=0 - - else - echo "Job $job_id.....................[FAILED]" - dtest=0 - fi - rm events events3 out[$job_id] - job_id=$[$job_id+1] -done -echo -echo "A detailed list of events logged has been printed to $LOG_FILE" -echo -} - -#job status test -testLB2() -{ -echo "Checking the Jobs Status........................................" -echo -job_id=0 - while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - #sleep 1 - eval $LBJOBSTATUS ${SAMPLE_JOBS_ARRAY[$job_id]} > status - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - i=0 - while [ $testStatus -ne 1 ] && [ $i -lt $INTERVAL ] ; do - bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - i=$[$i+1] - done - if [ $testStatus -eq 1 ] ; then - echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[OK]" - else - echo "Job: $job_id ..Logged state:${SAMPLE_JOBS_STATES[$job_id]}-Recorded `cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`.......[FAILED]" - cat status > errorStatus.tmp - echo "Detailed status has been copied to errorStatus.tmp" - echo - dtest=0 - fi - rm status -job_id=$[$job_id+1] -done -} - -#logging events to the jobs. Events are selected randomly from a list. -logEvents() -{ -echo "Logging events to the $JOBS_ARRAY_SIZE jobs...................................." -echo -job_id2=0 -st_count=`echo $STATES | wc -w` - while [ $job_id2 -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` - state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` - SAMPLE_JOBS_STATES[$job_id2]=$state - echo >> $LOG_FILE - echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$job_id2]} " >> $LOG_FILE - echo >> $LOG_FILE - - echo "event submitted.......................................[$state]" >> $LOG_FILE - eval glite-lb-$state.sh $LARGE_STRESS -j ${SAMPLE_JOBS_ARRAY[$job_id2]} 2>out[$job_id2] - job_id2=$(($job_id2 + 1)) -done -} - - -showHelp() -{ -echo "Usage: $0 [OPTIONS] " -echo "Options:" -echo " -h | --help Show this help message." -echo " -r | --retries Number of test retries (2 by default)" -echo " -n | --nbjobs Number of jobs (10 by default)" -echo " -m | --bkserver Host address of the BKServer ex:pc900.iihe.ac.be " -echo " -s | --states List of states in which could tested jobs fall." -echo " -l | --large-stress 'size' Do a large stress logging ('size' random data added to the messages." -echo "" - -# echo "For proper operation check your grid-proxy-info" -# grid-proxy-info -} - - -#input -if [ -z "$1" ]; then - showHelp - exit 2 -fi -BK=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-r" | "--retries") shift ; INTERVAL=$1 ;; - "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; - "-m" | "--bkserver") shift ; BKSERVER=$1 BK=1;; - "-s" | "--states") shift; STATES="$1" ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; -# "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1 try -h for help"; exit 2 ;; - - esac - shift -done -if [ $BK -ne 1 ]; then - echo - echo "You must specify the hostname of the LB Server with the option -m (ex: -m pf435.ulb.ac.be)" - echo - exit 2 -fi -echo - - -#main.................................................................. - -#main.................................................................. -init -echo "Be sure you have stopped glite-lb-interlogd .........................." -echo "You have to log on on your LB machine and kill the process manually..." -echo "Press any key........................................................." -read x -array_job_reg -logEvents -echo "Please start the glite-lb-interlogd..................................." -echo "Please use /opt/glite/etc/config/scripts/glite-lb-cofig.py --start...." -echo "Press any key........................................................." -read x -echo "Sleeping 10 seconds......................................................" -sleep 10 -testLB -testLB2 -#testProxy -#eval $LBPURGE -h -echo -if [ $dtest -eq 1 ];then - echo "Final test result .........................................[OK]" - exit 1 -else echo "Final test result .........................................[FAILED]" - exit 0 - fi -echo diff --git a/org.glite.testsuites.ctb/LB/tests/lb-l2Stat.sh b/org.glite.testsuites.ctb/LB/tests/lb-l2Stat.sh deleted file mode 100755 index 301443d..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-l2Stat.sh +++ /dev/null @@ -1,239 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Normal event delivery and Normal Job States with internal BKsrever performance - -#Prerequisities: All services running -#Actions: -#Registers jobs with glite-lb-job-reg prferably pointing to remote LB Server -#Check of the job status -#Logs sequences of events with glite-lb-logevent -#Check with glite-lb-job_status that the status of the jobs are correct and mesures how long it took to get results - - -PATH=/opt/glite/examples:$PATH -#echo $PATH -LBJOBREG=${LBJOBREG:-glite-lb-job_reg} -LBLOGEVENT=${LBLOGEVENT:-glite-lb-logevent} -LBJOBSTATUS=${LBJOBSTATUS:-glite-lb-job_status} -LBJOBLOG=${LBJOBLOG:-glite-lb-job_log} -LBJOBSTAT=${LBJOBSTAT:-glite-lb-job_status} -LBPURGE=${PURGE:-glite-lb-purge} - - -STATES="aborted cancelled done ready running scheduled waiting submitted " -SOURCES="NetworkServer WorkloadManager BigHelper JobController LogMonitor LRMS Application UserInterface" -dtest=1 -i=0 -JOBS_ARRAY_SIZE=10 -# timeouts for polling the bkserver -timeout=10 -maxtimeout=300 -NB_TAGS=50 -INTERVAL=2 -DATE_S=`date +"%s"` -DATE=`date` -LOG_FILE="$DATE_S.log" - -init() -{ -echo "Date: $DATE" > $LOG_FILE -export EDG_WL_QUERY_SERVER="$BKSERVER:9000" -export EDG_WL_LOG_DESTINATION="$BKSERVER:9002" -BKSERVER_HOST="$BKSERVER:9000" -BKSERVER_OPT="-m $BKSERVER" -} - -get_time() -{ - sec=`date +%s` - nsec=`date +%N` - time=`echo "1000000000*$sec + $nsec"|bc` -# time=$sec - return 0 -} - -getJobId() -{ -cat jobreg |grep "EDG_JOBID" |cut -c12- > jobList2 -res=`cat jobList2 |wc -c` -res=$[$res-2] -cat jobList2 |cut -c1-`echo $res` > jobreg -rm jobList2 -} - -#registrating a job -job_reg() -{ -eval $LBJOBREG $BKSERVER_OPT -s $1 > jobreg -getJobId -job=`cat jobreg` -rm jobreg -} - -array_job_reg() -{ -echo "Registering $JOBS_ARRAY_SIZE jobs...................." -job_id=0 -st_count=`echo $SOURCES | wc -w` -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - tmp=`echo $RANDOM % $st_count + 1 | bc` - jsource=`echo $SOURCES | cut -d " " -f $tmp | tr A-Z a-z` - job_reg $jsource - echo $job - SAMPLE_JOBS_ARRAY[$job_id]=$job - job_id=$[$job_id+1] - done -} - -#job status test -testLBP() -{ -echo "Checking the Events............................................." -echo -job_id=0 -while [ $job_id -lt $JOBS_ARRAY_SIZE ] ; do - get_time - start=$time - logEvent $job_id - logTag $job_id - - - eval $LBJOBSTATUS ${SAMPLE_JOBS_ARRAY[$job_id]} > status - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - response=0 - while [ $testStatus -ne 1 ];do - bkserver_state=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}` - testStatus=`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}|wc -l` - echo "**Retrying**" - sleep $timeout - response=$(($response + $timeout )) - if test $response -gt $maxtimeout ; then - echo -e "ERROR\n\tstatus of job ${SAMPLE_JOBS_ARRAY[$job_id]} as queried from bkserver ($bkserver_state) has not become ${SAMPLE_JOBS_STATES[$job_id]} for more than $response seconds!" - echo "Detailed status has been copied to errorStatus.tmp" - echo - dtest=0 - fi - done - get_time - response=`echo "scale=9; ($time - $start)/1000000000"|bc` - SAMPLE_JOBS_RESPONSES[$job_id]=$response - echo "Job: $job_id ....[`cat status |grep -i state.*${SAMPLE_JOBS_STATES[$job_id]}`].......[OK]" - echo - rm status - job_id=$[$job_id+1] - done - j=0 - total=0 - echo "Sending events took for individual jobs the following time" - while [ $j -lt $JOBS_ARRAY_SIZE ] ; do - total=`echo "scale=9; $total + ${SAMPLE_JOBS_RESPONSES[$j]}" |bc` - echo -e "${SAMPLE_JOBS_ARRAY[$j]} \t${SAMPLE_JOBS_RESPONSES[$j]} seconds" - j=$(($j + 1)) - done - echo -e "Total time for $JOBS_ARRAY_SIZE jobs: \t$total" - echo -e -n "Average time for event: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE "|bc - echo -e -n "Average time for event and tags: \t" - echo "scale=9; $total / $JOBS_ARRAY_SIZE / $NB_TAGS"|bc - echo -e -n "Event throughput (events/sec): \t" - echo "scale=9; $NB_TAGS * $JOBS_ARRAY_SIZE / $total"|bc - echo - echo "A detailed list of events logged has been printed to $LOG_FILE" - echo -} - -logEvent() -#ARG1: Number of the job considered in the jobs array -{ -st_count=`echo $STATES | wc -w` -tmp=`echo $RANDOM % $st_count + 1 | bc` -state=`echo $STATES | cut -d " " -f $tmp | tr A-Z a-z` -SAMPLE_JOBS_STATES[$1]=$state -echo "Logging event to the job($1).........................[$state]" -echo > LoggedEvents.log -echo "Submitting events to the job: ${SAMPLE_JOBS_ARRAY[$1]} " >> $LOG_FILE -echo >> LoggedEvents.log -echo "event submitted.......................................[$state]" >> $LOG_FILE -eval glite-lb-$state.sh $LARGE_STRESS -j ${SAMPLE_JOBS_ARRAY[$1]} 2>out -} -logTag() -{ -i=0 -echo "Logging $NB_TAGS tags to the job................" -eval $LBLOGEVENT -s Application -n $NB_TAGS -e UserTag -j ${SAMPLE_JOBS_ARRAY[$1]} -name testTag -value 12345 >> $LOG_FILE -} - -showHelp() -{ - echo "Usage: $0 [OPTIONS] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -n | --nbjobs Number of jobs" - echo " -s | --states List of states in which could tested jobs fall." - echo " -m | --bkserver Host address of the BKServer " - echo " -t | --tags Number of user tags to load to each job." - echo " -l | --large-stress 'size' Do a large stress logging ('size' rand om data added to the messages." - echo "" - -# echo "For proper operation check your grid-proxy-info" -# grid-proxy-info -} - -#input -if [ -z "$1" ]; then - showHelp - exit 2 -fi -BK=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-n" | "--nbjobs") shift ; JOBS_ARRAY_SIZE=$1 ;; - "-s" | "--states") shift; STATES="$1" ;; - "-m" | "--bkserver") shift ; BKSERVER=$1 BK=1 ;; - "-t" | "--tags") shift ; NB_TAGS=$1 ;; - "-l" | "--large-stress") shift ; LARGE_STRESS="-l $1" ;; -# "-g" | "--log") shift ; logfile=$1 ;; - - *) echo "Unrecognized option $1 try -h for help"; exit 2 ;; - - esac - shift -done -if [ $BK -ne 1 ]; then - echo - echo "You must specify the hostname of the LB Server with the option -m (ex: -m pf435.ulb.ac.be)" - echo - exit 2 -fi - -echo -init -array_job_reg -testLBP -echo -if [ $dtest -eq 1 ];then - echo "Final test result .........................................[OK]" - exit 1 -else echo "Final test result .........................................[FAILED]" - exit 0 - fi -echo - - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-run-tests.sh b/org.glite.testsuites.ctb/LB/tests/lb-run-tests.sh deleted file mode 100755 index d1f1629..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-run-tests.sh +++ /dev/null @@ -1,247 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -This script logs to an indicated server, downloads the L&B test suite and executes it - -Prerequisities: - - LB server (hostname given as a cmdline argument) - - Valid proxy certificate (will be imported and used in testing) - -Tests called: - - The full L&B Functional Test Suite - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] hostname" - echo "Options:" - echo " -h | --help Show this help message." - echo " hostname L&B server to use for testing." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -#logfile=$$.tmp -#flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - *) remotehost=$1 - shift - outformat=$1 - shift ;; - esac - shift -done - -if [ -z $outformat ]; then - outformat='-c' -fi - -# check_binaries -printf "\nTesting if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $SYS_SCP -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - # Get path to the proxy cert - printf "Getting proxy cert path... " - - PROXYCERT=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^path" | ${SYS_SED} "s/path\s*:\s//"` - - if [ "$PROXYCERT" = "" ]; then - test_failed - print_error "Unable to identify the path to your proxy certificate" - else - printf "$PROXYCERT" - test_done - - printf "L&B server: '$remotehost'" - - if [ "$remotehost" = "" ]; then - test_failed - else - test_done - - scp $PROXYCERT root@$remotehost:/tmp/ - -cat << EndArrangeScript > arrange_lb_test_root.sh -CERTFILE=\$1 -GLITE_USER=\$2 -LBTSTCOLS=\$3 -OUTPUT_OPT=\$4 - - -export LBTSTCOLS - -yum install -q -y globus-proxy-utils -yum install -q -y postgresql postgresql-server -#Standard setup now uses production brokers. No need to install our own. -#yum install -q -y activemq java-1.6.0-openjdk - -/etc/init.d/postgresql start -mv /var/lib/pgsql/data/pg_hba.conf /var/lib/pgsql/data/pg_hba.conf.orig -cat >/var/lib/pgsql/data/pg_hba.conf < arrange_lb_test_user.sh -echo export LBTSTCOLS=\$LBTSTCOLS >> arrange_lb_test_user.sh -echo export TEST_TAG_ACL=yes >> arrange_lb_test_user.sh -echo 'export GLITE_MYSQL_ROOT_PASSWORD="[Edited]"' >> arrange_lb_test_user.sh -echo mkdir LB_testing >> arrange_lb_test_user.sh -echo cd LB_testing >> arrange_lb_test_user.sh -echo cvs -d :pserver:anonymous@glite.cvs.cern.ch:/cvs/jra1mw co org.glite.testsuites.ctb/LB >> arrange_lb_test_user.sh -echo ls >> arrange_lb_test_user.sh -echo cd org.glite.testsuites.ctb/LB/tests >> arrange_lb_test_user.sh -echo ulimit -c unlimited >> arrange_lb_test_user.sh -echo 'export HNAME=\`hostname -f\`' >> arrange_lb_test_user.sh -echo 'export GLITE_WMS_QUERY_SERVER=\$HNAME:9000' >> arrange_lb_test_user.sh -echo 'export GLITE_WMS_NOTIF_SERVER=\$HNAME:9000' >> arrange_lb_test_user.sh -echo 'export GLITE_WMS_LOG_DESTINATION=\$HNAME:9002' >> arrange_lb_test_user.sh -echo export GLITE_LB_SERVER_WPORT=9003 >> arrange_lb_test_user.sh -echo export GLITE_LB_SERVER_PORT=9000 >> arrange_lb_test_user.sh -echo export GLITE_LB_LOGGER_PORT=9002 >> arrange_lb_test_user.sh -echo export GLITE_WMS_LBPROXY_STORE_SOCK=/tmp/lb_proxy_ >> arrange_lb_test_user.sh -echo 'env | egrep "GLITE|\$HNAME|PATH"' >> arrange_lb_test_user.sh -echo pwd >> arrange_lb_test_user.sh -if [ "\$OUTPUT_OPT" == "-i" ]; then -echo echo ======================== >> arrange_lb_test_user.sh -echo echo " THE CONSOLE IS YOURS" >> arrange_lb_test_user.sh -echo echo ======================== >> arrange_lb_test_user.sh -echo '/bin/bash -i' >> arrange_lb_test_user.sh -else -echo echo ======================== >> arrange_lb_test_user.sh -echo echo " REAL TESTS START HERE" >> arrange_lb_test_user.sh -echo echo ======================== >> arrange_lb_test_user.sh -echo 'echo ""' >> arrange_lb_test_user.sh -echo 'echo ""' >> arrange_lb_test_user.sh -echo sh ./lb-test-event-delivery.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-il-recovery.sh -f /var/glite/log/dglogd.log \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-job-registration.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-https.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-job-states.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-logevent.sh /var/glite/log/dglogd.log \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-notif-recovery.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-notif-msg.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-notif.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-notif-switch.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-notif-stream.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-proxy-delivery.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-ws.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-bdii.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-sandbox-transfer.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-changeacl.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-statistics.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-threaded.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo sh ./lb-test-harvester.sh \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo perl ./lb-test-purge.pl --i-want-to-purge delwin.fi.muni.cz:9000 \$OUTPUT_OPT >> arrange_lb_test_user.sh -echo 'echo ""' >> arrange_lb_test_user.sh -echo 'echo ""' >> arrange_lb_test_user.sh -echo echo ================== >> arrange_lb_test_user.sh -echo echo " TESTS END HERE" >> arrange_lb_test_user.sh -echo echo ================== >> arrange_lb_test_user.sh -fi -#echo "" >> arrange_lb_test_user.sh - -chown \$GLITE_USER:\$GLITE_USER arrange_lb_test_user.sh -chmod +x arrange_lb_test_user.sh - -#su -l \$GLITE_USER -su -l \$GLITE_USER --command=/tmp/arrange_lb_test_user.sh -echo "" - -EndArrangeScript - TERMCOLS=`stty size | awk '{print $2}'` - - chmod +x arrange_lb_test_root.sh - - scp arrange_lb_test_root.sh root@$remotehost:/tmp/ - - ssh -l root $remotehost "sh /tmp/arrange_lb_test_root.sh $PROXYCERT glite $TERMCOLS $outformat" - - - fi - fi - fi -fi - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-acl-authz.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-acl-authz.sh deleted file mode 100755 index ad41727..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-acl-authz.sh +++ /dev/null @@ -1,268 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct interpretation of ChangeACL events - -Prerequisities: - - LB server, logger, interlogger - - environment variables set: - - GLITE_WMS_QUERY_SERVER - X509_USER_PROXY_BOB - set TEST_TAG_ACL=yes if you want to test ACL with TAGs - -Tests called: - - job registration - sending a ChangeACL-type event - chcking result - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - - -check_credentials() -{ - my_GRIDPROXYINFO=${GRIDPROXYINFO} - if [ "$1" != "" ]; then - my_GRIDPROXYINFO="${GRIDPROXYINFO} -f $1" - fi - - timeleft=`${my_GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - - if [ "$timeleft" = "" ]; then - print_error "No credentials" - return 1 - fi - if [ "$timeleft" = "0:00:00" ]; then - print_error "Credentials expired" - return 1 - fi - return 0 -} - - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -test_tag_acl=${TEST_TAG_ACL:-"no"} - -{ -test_start - -CONT="yes" -while [ "$CONT" = "yes" ]; do - CONT="no" - - # check_binaries - printf "Testing if all binaries are available" - check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $LBLOGEVENT $LBJOBREG - if [ $? -gt 0 ]; then - test_failed - break - fi - test_done - - printf "Testing credentials" - check_credentials - if [ $? -ne 0 ]; then - test_failed - break - fi - if [ "$X509_USER_PROXY_BOB" = "" ]; then - test_failed - print_error "\$X509_USER_PROXY_BOB must be set" - break - fi - check_credentials $X509_USER_PROXY_BOB - if [ $? -ne 0 ]; then - test_failed - break - fi - test_done - - printf "Testing Tags permissions " - if [ "$test_tag_acl" != "yes" ]; then - test_skipped - else - test_done - fi - - identity=`${GRIDPROXYINFO} -f $X509_USER_PROXY_BOB| ${SYS_GREP} -E "^identity" | ${SYS_SED} "s/identity\s*:\s//"` - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - break - fi - test_done - - printf "Checking not-allowed access" -#try unauthorized read - X509_USER_PROXY=$X509_USER_PROXY_BOB $LBJOBSTATUS $jobid 2>&1 >/dev/null| grep -E "edg_wll_JobStatus: Operation not permitted" > /dev/null - if [ "$?" != "0" ]; then - test_failed - print_error "Ungranted READ access allowed!" - break - fi - -#try unauthorized tagging - X509_USER_PROXY=$X509_USER_PROXY_BOB $LBLOGEVENT -e UserTag -s Application -j $jobid --name "hokus" --value "pokus" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "Sending UserTag failed" - break - fi -# sleep 10 - - res=`$LBJOBSTATUS $jobid 2>/dev/null` - if [ $? -ne 0 ]; then - test_failed - print_error "Server doesn't respond" - break - fi - echo $res | grep "hokus = \"pokus\"" > /dev/null - if [ $? -eq 0 ]; then - test_failed - print_error "Adding UserTag allowed" - break - fi - test_done - - printf "Changing ACL setting " - perms="READ" - [ "$test_tag_acl" = "yes" ] && perms="$perms TAG" - res=0 - for p in $perms; do - $LBLOGEVENT -e ChangeACL -s UserInterface -p -j $jobid --user_id "$identity" --user_id_type DN --permission $p --permission_type ALLOW --operation ADD > /dev/null - if [ $? -ne 0 ]; then - print_error "Adding $p permission to ACL failed" - res=1 - fi - done - if [ $res -ne 0 ]; then - test_failed - break - fi - test_done - - printf "Checking allowed access " -#try querying status - X509_USER_PROXY=$X509_USER_PROXY_BOB $LBJOBSTATUS $jobid 2>/dev/null| grep "^state : Submitted" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "ACL permission doesn't work" - break - fi - -#try adding a usertag - if [ "$test_tag_acl" = "yes" ]; then - X509_USER_PROXY=$X509_USER_PROXY_BOB $LBLOGEVENT -e UserTag -s Application -j $jobid --name "hokus" --value "pokus" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "Sending UserTag failed" - break - fi - - # sleep 10 - - res=`$LBJOBSTATUS $jobid 2>/dev/null` - if [ $? -ne 0 ]; then - test_failed - print_error "Server doesn't respond" - break - fi - echo $res | grep "hokus = \"pokus\"" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "Adding UserTag not allowed" - break - fi - fi - - test_done - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} -done - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh deleted file mode 100755 index 6cd8648..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-bdii.sh +++ /dev/null @@ -1,232 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct reporting of LB server properties over BDII/LDAP. -This should also be thought of as a regression test for bug #55482, -and ggus ticket #62737. - -Prerequisities: - - LB server - - environment variables set: - - GLITE_WMS_QUERY_SERVER - -Tests called: - - ldap query to the server, checking the output - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all essential binaries are available" -check_binaries $SYS_GREP $SYS_SED $SYS_AWK $SYS_LDAPSEARCH -if [ $? -gt 0 ]; then - test_failed -else - test_done - - printf "Testing optional WS client binary" - check_binaries $LBWSGETVERSION - if [ $? -gt 0 ]; then - printf " ... not present. Some tests will be skipped\n" - WSBIN="no" - else - test_done - - printf "Testing credentials" - - timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - - if [ "$timeleft" = "" ]; then - printf "No credentials, not critical\n" - WSBIN="no" - else - if [ "$timeleft" = "0:00:00" ]; then - printf "Credentials expired, not critical\n" - WSBIN="no" - else - test_done - WSBIN="yes" - fi - - fi - - fi - - # Register job: - - server=`${SYS_ECHO} ${GLITE_WMS_QUERY_SERVER} | ${SYS_SED} 's/:.*$//'` - - printf "Checking if BDII operational... " - $SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=infosys' > ldap.$$.out - if [ $? -gt 0 ]; then - test_failed - print_error "No reply" - else - test_done - fi - - printf "Checking Glue 1 root entry... " - $SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=grid' 'GlueServiceType=org.glite.lb.Server' > ldap.$$.out - if [ $? -gt 0 ]; then - test_failed - print_error "No reply" - else - test_done - fi - - printf "Checking ServiceStatus... " - health=`$SYS_GREP GlueServiceStatus: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'` - if [ "$health" == "" ]; then - print_error "GlueServiceStatus not specified" - test_failed - else - printf "$health" - if [ "$health" == "OK" ]; then - test_done - else - test_failed - fi - fi - - printf "Checking Glue 2.0 entry with 'o=glue'... " - $SYS_LDAPSEARCH -x -H ldap://${server}:2170 -b 'o=glue' 'GLUE2EndpointInterfaceName=org.glite.lb.Server' > ldap.$$.out - if [ $? -gt 0 ]; then - test_failed - print_error "No reply" - else - test_done - fi - - printf "Checking GLUE2 HealthStatus... " - health=`$SYS_GREP GLUE2EndpointHealthState: ldap.$$.out | $SYS_SED 's/^[^:]*: *//'` - if [ "$health" == "" ]; then - print_error "GLUE2EndpointHealthState not specified" - test_failed - else - printf "$health" - if [ "$health" == "ok" ]; then - test_done - else - test_failed - fi - fi - - printf "Checking GlueServiceVersion... " - glservver=`$SYS_GREP GLUE2EndpointImplementationVersion ldap.$$.out | $SYS_SED 's/^.*GLUE2EndpointImplementationVersion:\s*//'` - if [ "$glservver" == "" ]; then - print_error "GLUE2EndpointImplementationVersion not specified" - test_failed - else - printf "$glservver" - test_done - - printf "Reading version through WS... " - if [ "$WSBIN" == "yes" ]; then - servername=`echo ${GLITE_WMS_QUERY_SERVER} | ${SYS_SED} "s/:.*//"` - wsglservver=`$LBWSGETVERSION -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_SED 's/^.*Server version:\s*//'` - if [ "$wsglservver" == "" ]; then - test_failed - else - printf "$wsglservver" - test_done - - printf "Comparing versions: '$glservver' == '$wsglservver'" - if [ "$glservver" == "$wsglservver" ]; then - test_done - else - test_failed - fi - fi - else - test_skipped - fi - fi - - rm ldap.$$.out - -fi - - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-binaries.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-binaries.sh deleted file mode 100755 index 96aad3a..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-binaries.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -## -# Starting the test -##################### - -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries -if [ $? -gt 0 ]; then - test_failed - print_error "Some binaries are missing" - exit $TEST_ERR -else - test_done -fi - -test_end - -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-changeacl.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-changeacl.sh deleted file mode 100755 index 3bd415e..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-changeacl.sh +++ /dev/null @@ -1,228 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct interpretation of ChangeACL events - -Prerequisities: - - LB server, logger, interlogger - - environment variables set: - - GLITE_WMS_QUERY_SERVER - set TEST_TAG_ACL=yes if the you want to test ACL with TAGs - - -Tests called: - - job registration - sending a ChangeACL-type event - chcking result - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -change_acl() -{ - jobid=$1; op=$2; perm=$3; id=$4 - - $LBLOGEVENT -e ChangeACL -s UserInterface -p -j "$jobid" --user_id "$id" --user_id_type DN --permission "$perm" --permission_type ALLOW --operation "$op" > /dev/null - res=$? - if [ $res -ne 0 ]; then - print_error "Changing ACL ($op $perm) failed" - fi - return $res -} - -## -# Starting the test -##################### - -identity="ThisIsJustATestingIdentity" -test_tag_acl=${TEST_TAG_ACL:-"no"} - -{ -test_start - -CONT="yes" -while [ "$CONT" = "yes" ]; do - CONT="no" - - # check_binaries - printf "Testing if all binaries are available" - check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $LBLOGEVENT $LBJOBREG - if [ $? -gt 0 ]; then - test_failed - break - fi - test_done - - printf "Testing credentials" - timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" - break - fi - - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - break - fi - test_done - - printf "Testing Tags permissions... " - if [ "$test_tag_acl" != "yes" ]; then - printf "Capability not detected..." - test_skipped - else - test_done - fi - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - break - fi - test_done - - printf "Changing ACL..." - change_acl "$jobid" "ADD" "READ" $identity - if [ $? -ne 0 ]; then - test_failed - break; - fi - - if [ "$test_tag_acl" = "yes" ]; then - change_acl "$jobid" "ADD" "TAG" $identity - if [ $? -ne 0 ]; then - test_failed - break - fi - fi - test_done - - - printf "Checking ACL for new values... " - ops="read" - [ "$test_tag_acl" = "yes" ] && ops="$ops write" - res=0 - for operation in $ops; do - $LBJOBSTATUS $jobid | grep -E "^acl :.*dn:${identity}<${operation}/>" > /dev/null - if [ $? -ne 0 ]; then - res=1 - fi - done - if [ $res -ne 0 ]; then - test_failed - print_error "ACL not modified properly" - break; - fi - test_done - - - printf "Removing ACL entries..." - perms="READ" - [ "$test_tag_acl" = "yes" ] && perms="$perms TAG" - res=0 - for p in $perms; do - change_acl "${jobid}" "REMOVE" $p $identity - if [ $? -ne 0 ]; then - res=1 - fi - done - if [ $res -ne 0 ]; then - test_failed - break; - fi - - $LBJOBSTATUS $jobid | grep -E "^acl :$" > /dev/null - if [ $res -ne 0 ]; then - test_failed - print_error "Entries not removed properly" - fi - test_done - - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - -done - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-event-delivery.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-event-delivery.sh deleted file mode 100755 index 3bc6a2e..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-event-delivery.sh +++ /dev/null @@ -1,343 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct event delivery - -Prerequisities: - - LB delivery chain - logger, interlogger, server - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_LB_IL_SOCK - if nondefault socket at /tmp/interlogger.sock is used - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - -Tests called: - - job registration - event logging - checking events - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LB_READY_SH $LB_RUNNING_SH $LB_DONE_SH $SYS_AWK $LBJOBLOG -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job... " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "Registered job: $jobid" - test_done - fi - - # log events: - printf "Logging events resulting in READY state... " - $LB_READY_SH -j ${jobid} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds...\n" - - sleep 10 - - jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Ready" ]; then - test_done - else - test_failed - print_error "Job is not in appropriate state" - fi - -# printf "Logging events resulting in RUNNING state\n" -# $LB_RUNNING_SH -j ${jobid} > /dev/null 2> /dev/null - - printf "Logging events resulting in DONE state... " - $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds...\n" - - sleep 10 - - jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Testing job ($jobid) is in state: $jobstate" - - if [ "${jobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "Job is not in appropriate state" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - - printf "Registering collection " - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -C -n 2 -S > $$_test_coll_registration.txt - jobid=`$SYS_CAT $$_test_coll_registration.txt | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - subjobs=( $(cat $$_test_coll_registration.txt | $SYS_GREP EDG_WL_SUB_JOBID | $SYS_SED 's/EDG_WL_SUB_JOBID.*="//' | $SYS_SED 's/"$//') ) - printf "Collection ID: $jobid\n Subjob 1: ${subjobs[0]}\n Subjob 2: ${subjobs[1]}\nChecking if subjob registration worked... " - - ${LBJOBLOG} ${subjobs[0]} | $SYS_GREP 'DG.EVNT="RegJob"' >> /dev/null - if [ $? = 0 ]; then - printf "Registration event recorded" - test_done - else - test_failed - print_error "Subjob registration did not work (Registration event not recorded)" - fi - - - job1jdl=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} -E "^jdl :" | ${SYS_AWK} '{print $3}'` - if [ "${job1jdl}" = "(null)" ]; then - test_failed - print_error "Subjob registration did not work (JDL not present: "${job1jdl}")" - else - printf "JDL present" - test_done - fi - - printf "Logging events for subjobs... " - $LB_READY_SH -j ${subjobs[0]} > /dev/null 2> /dev/null - $LB_DONE_SH -j ${subjobs[1]} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - sleep 10 - - jobstate=`${LBJOBSTATUS} ${subjobs[0]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job (${subjobs[0]}) in a correct state? $jobstate" - - if [ "${jobstate}" = "Ready" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Ready)" - fi - jobstate=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job (${subjobs[1]}) in a correct state? $jobstate" - - if [ "${jobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Done)" - fi - - - jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'` - printf "Is the collection ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Waiting" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Waiting)" - fi - - printf "Logging events to clear subjobs... " - $LB_CLEARED_SH -j ${subjobs[0]} > /dev/null 2> /dev/null - $LB_CLEARED_SH -j ${subjobs[1]} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - sleep 10 - - jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'` - printf "Is the collection ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Cleared" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Cleared)" - fi - - echo $jobid > $$_jobs_to_purge_test.txt - - printf "Purging collection... " - - $LBPURGE -j $$_jobs_to_purge_test.txt - - printf "Sleeping for 10 seconds... " - - sleep 10 - - printf "Checking state of collection... " - - ${LBJOBSTATUS} $jobid > $$_collstate.tmp 2> $$_collstate_err.tmp - jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp` - $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null - if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then - - if [ "${jobstate}" = "Purged" ]; then - printf "${jobstate}" - else - printf "Identifier removed" - fi - test_done - - printf "Checking state of subjob #1... " - ${LBJOBSTATUS} ${subjobs[0]} > $$_collstate.tmp 2> $$_collstate_err.tmp - jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp` - $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null - if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then - if [ "${jobstate}" = "Purged" ]; then - printf "${jobstate}" - else - printf "Identifier removed" - fi - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Cleared)" - fi - - printf "Checking state of subjob #2... " - ${LBJOBSTATUS} ${subjobs[1]} > $$_collstate.tmp 2> $$_collstate_err.tmp - jobstate=`$SYS_CAT $$_collstate.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_collstate.tmp` - $SYS_GREP "Identifier removed" $$_collstate_err.tmp > /dev/null - if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then - if [ "${jobstate}" = "Purged" ]; then - printf "${jobstate}" - else - printf "Identifier removed" - fi - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Cleared)" - fi - - else - printf "${jobstate}" - test_skipped - fi - - $SYS_RM $$_jobs_to_purge_test.txt - $SYS_RM $$_collstate.tmp - $SYS_RM $$_collstate_err.tmp - - fi - - echo ${subjobs[0]} >> ${joblist} - echo ${subjobs[1]} >> ${joblist} - echo $jobid >> ${joblist} - try_purge ${joblist} - - $SYS_RM $$_test_coll_registration.txt - - - fi -fi - -test_end -#} &> $logfile -} - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-harvester.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-harvester.sh deleted file mode 100755 index dd52c32..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-harvester.sh +++ /dev/null @@ -1,220 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for local testing of L&B harvester. - -Prerequisities: - - posgtgresql server running, with appropriate user access - - mysql server running, with appropriate user access - - environment variables set (may be specified in site-info.def): - - GLITE_LOCATION ................... gLite location - GLITE_MYSQL_ROOT_PASSWORD ........ mysql root password - GLITE_RTM_TEST_ADDITIONAL_ARGS ... L&B harvester additional arguments - (--old required for L&B < 2.0) - - For full list of the possible environment variables, see '`which glite-lb-harvester.sh` --help'. - -Tests called (glite-lb-harvester.sh script): - - basic: notifications for basic events (submitted/waiting/running) - rebind: rebinding of the notifications - cleanup: proper dropping of the notifications on quit - refresh: renewing of the notifications - JDL: getting of the attributes from JDL - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] LB_SERVER_1 [LB_SERVER_2 ...] " - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo " -s | --site-info 'file' site-info.def file (mysql password, ...)." - echo "" -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - "-s" | "--site") - shift - cat "$1" | grep -v '^#' | grep -v '^[ \t]*$' | sed 's/^/export /' > site-info.def.tmp.$$ - source "site-info.def.tmp.$$" - rm -f "site-info.def.tmp.$$" - site=1 - if test -z "$GLITE_MYSQL_ROOT_PASSWORD"; then - export GLITE_MYSQL_ROOT_PASSWORD="$MYSQL_PASSWORD" - fi - ;; - *) showHelp && exit 2 ;; - esac - shift -done - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -## -# ==== Various sanity checks first ==== -## - -# check_binaries -# (harvester test script is using own names of the all binaries) -printf "Testing if all binaries are available" -check_binaries $SYS_GREP $SYS_SED $SYS_CAT $SYS_TAIL $SYS_DATE $GRIDPROXYINFO $LBJOBREG $LBLOGEV $LBPURGE mysqladmin mysql createdb dropdb psql -if [ $? = 0 ]; then - test_done -else - test_failed - print_error "Some binaries missing!" - test_end - exit 2 -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials!" - test_end - exit 2 -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - test_end - exit 2 - else - test_done - fi -fi - -printf "Testing access to MySQL" -if [ -z "$GLITE_LB_TEST_DB" ]; then - MYSQL_ARGS="-u ${GLITE_MYSQL_ROOT_USER:-root}" - [ -z "$GLITE_MYSQL_ROOT_PASSWORD" ] || MYSQL_ARGS="--password=${GLITE_MYSQL_ROOT_PASSWORD} $MYSQL_ARGS" - mysqladmin $MYSQL_ARGS status >/dev/null - if [ $? = 0 ]; then - test_done - else - test_failed - print_error "MySQL not running or access denied!" - if [ -z "$GLITE_MYSQL_ROOT_PASSWORD" ]; then - print_warning "\$GLITE_MYSQL_ROOT_PASSWORD not specified" - fi - if [ -z "$site" ]; then - print_warning "site-info.def file not specified" - fi - test_end - exit 2 - fi -else - printf " ... using $GLITE_LB_TEST_DB, not tested" - test_skipped -fi - -printf "Testing access to PostgreSQL" -if [ -z "$GLITE_RTM_TEST_DB" ]; then - PG_ARGS="-U ${GLITE_PG_ROOT_USER:-postgres}" - echo "SHOW server_version;" | psql -At $PG_ARGS >/dev/null - if [ $? = 0 ]; then - test_done - else - test_failed - print_error "PosgreSQL not running or access denied!" - exit 2 - fi -else - printf " ... using $GLITE_RTM_TEST_DB, not tested" - test_skipped -fi - -printf "L&B harvester test script in PATH" -if which glite-lb-harvester-test.sh >/dev/null 2>&1; then - test_done -else - test_failed - print_error "glite-lb-harvester-test.sh not found" - exit 2 -fi - -## -# ==== L&B harvester test ==== -## - -printf "Launching the L&B harvester test..." -print_newline -if [ -n "$is_html" ]; then - local_amp='&' - printf "

    "
    -else
    -	local_amp='&'
    -fi
    -glite-lb-harvester-test.sh stop
    -(glite-lb-harvester-test.sh 2>&1; echo $? > res.$$.txt) | sed "s,&,$local_amp,"
    -err=`cat res.$$.txt`; rm -f res.$$.txt
    -if [ -n "$is_html" ]; then
    -	printf "
    " -fi - -if [ "$err" = "0" ]; then - test_done -else - test_failed - print_error "L&B harvester test failed!" - test_end - exit 1 -fi - -test_end -} - -exit $TEST_OK diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-https.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-https.sh deleted file mode 100755 index 9539039..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-https.sh +++ /dev/null @@ -1,271 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct job registration - -Prerequisities: - - LB server - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_WMS_QUERY_SERVER - GLITE_WMS_NOTIF_SERVER - -Tests called: - - job registration - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $SYS_CURL -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - # Get path to the proxy cert - printf "Getting proxy cert path... " - - PROXYCERT=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^path" | ${SYS_SED} "s/path\s*:\s//"` - - if [ "$PROXYCERT" = "" ]; then - test_failed - print_error "Unable to identify the path to your proxy certificate" - else - printf "$PROXYCERT" - test_done - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - - # Get list of jobs - printf "Evaluating job list... " - - $SYS_CURL -3 --silent --key $PROXYCERT --cert $PROXYCERT --capath /etc/grid-security/certificates --output https.$$.tmp https://${GLITE_WMS_QUERY_SERVER}/ - - if [ "$?" != "0" ]; then - test_failed - print_error "Job list not returned" - else - test_done - - printf "Looking up the test job..." - - $SYS_GREP $jobid https.$$.tmp > /dev/null 2> /dev/null - - if [ "$?" != "0" ]; then - test_failed - print_error "Test job not found in the list" - else - test_done - fi - - $SYS_RM https.$$.tmp - - fi - - # Get job status - printf "Evaluating job status listing... " - - $SYS_CURL -3 --silent --key $PROXYCERT --cert $PROXYCERT --capath /etc/grid-security/certificates --output https.$$.tmp "${jobid}" - - if [ "$?" != "0" ]; then - test_failed - print_error "Job status not returned" - else - test_done - - printf "Checking for jobid (verifying content)..." - - $SYS_GREP $jobid https.$$.tmp > /dev/null 2> /dev/null - - if [ "$?" != "0" ]; then - test_failed - print_error "JobID not found among data returned" - else - test_done - fi - - $SYS_RM https.$$.tmp - - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi - - # Register notification: - printf "Registering notification " - - notifid=`${LBNOTIFY} new -j ${jobid} | $SYS_GREP "notification ID" | ${SYS_AWK} '{ print $3 }'` - echo ${LBNOTIFY} new -j ${jobid} - - if [ -z $notifid ]; then - test_failed - print_error "Failed to register notification" - else - printf "(${notifid}) " - test_done - - # Get notification status - printf "Evaluating notification status listing... " - - $SYS_CURL -3 --silent --key $PROXYCERT --cert $PROXYCERT --capath /etc/grid-security/certificates --output https.$$.tmp "${notifid}" - - if [ "$?" != "0" ]; then - test_failed - print_error "Job status not returned" - else - test_done - - printf "Checking for jobid (verifying content)..." - - notifunique=`${SYS_ECHO} ${notifid} | ${SYS_SED} 's/^.*NOTIF://'` - - $SYS_GREP $notifunique https.$$.tmp > /dev/null 2> /dev/null - - if [ "$?" != "0" ]; then - test_failed - print_error "Notification ID not found among data returned" - else - test_done - fi - - $SYS_RM https.$$.tmp - - fi - - #Drop notification - printf "Dropping the test notification (${notifid})" - dropresult=`${LBNOTIFY} drop ${notifid} 2>&1` - if [ -z $dropresult ]; then - test_done - else - test_failed - print_error "Failed to drop notification ${dropresult}" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - - fi - - - fi - - - fi -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh deleted file mode 100755 index bd85c3a..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-il-recovery.sh +++ /dev/null @@ -1,224 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing interlogger recovery - -Prerequisities: - - LB server, interlogger either running or startable - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_LB_IL_SOCK - if nondefault socket at /tmp/interlogger.sock is used - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - -Tests called: - - job registration - event logging - through interlogger - checking jobs states - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -function generate_done_events() -{ -#outfile = $1 -#user = $2 -#host = $3 -#jobid = $4 - - echo DG.LLLID=28000000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"NetworkServer\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Accepted\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000001:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.ACCEPTED.FROM=\"UserInterface\" DG.ACCEPTED.FROM_HOST=\"sending component hostname\" DG.ACCEPTED.FROM_INSTANCE=\"sending component instance\" DG.ACCEPTED.LOCAL_JOBID=\"new jobId \(Condor Globus ...\)\" >> $1 - echo DG.LLLID=28003000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"NetworkServer\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"EnQueued\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000003:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.ENQUEUED.QUEUE=\"destination queue\" DG.ENQUEUED.JOB=\"job description in receiver language\" DG.ENQUEUED.RESULT=\"OK\" DG.ENQUEUED.REASON=\"detailed description of transfer\" >> $1 - echo DG.LLLID=28006000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"WorkloadManager\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"DeQueued\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000001:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.DEQUEUED.QUEUE=\"queue name\" DG.DEQUEUED.LOCAL_JOBID=\"new jobId assigned by the receiving component\" >> $1 - echo DG.LLLID=28009000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"WorkloadManager\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"HelperCall\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000003:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.HELPERCALL.HELPER_NAME=\"name of the called component\" DG.HELPERCALL.HELPER_PARAMS=\"parameters of the call\" DG.HELPERCALL.SRC_ROLE=\"CALLING\" >> $1 - echo DG.LLLID=28012000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"WorkloadManager\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Match\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000005:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.MATCH.DEST_ID=\"destination CE/queue\" >> $1 - echo DG.LLLID=28015000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"WorkloadManager\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"HelperReturn\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000007:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.HELPERRETURN.HELPER_NAME=\"name of the called component\" DG.HELPERRETURN.RETVAL=\"returned data\" DG.HELPERRETURN.SRC_ROLE=\"CALLING\" >> $1 - echo DG.LLLID=28018000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"WorkloadManager\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"EnQueued\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000009:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.ENQUEUED.QUEUE=\"destination queue\" DG.ENQUEUED.JOB=\"job description in receiver language\" DG.ENQUEUED.RESULT=\"OK\" DG.ENQUEUED.REASON=\"detailed description of transfer\" >> $1 - echo DG.LLLID=28021000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"JobController\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"DeQueued\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000001:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.DEQUEUED.QUEUE=\"queue name\" DG.DEQUEUED.LOCAL_JOBID=\"new jobId assigned by the receiving component\" >> $1 - echo DG.LLLID=28024000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"JobController\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Transfer\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000003:LM=000000:LRMS=000000:APP=000000:LBS=000000\" DG.TRANSFER.DESTINATION=\"LRMS\" DG.TRANSFER.DEST_HOST=\"destination hostname\" DG.TRANSFER.DEST_INSTANCE=\"destination instance\" DG.TRANSFER.JOB=\"job description in receiver language\" DG.TRANSFER.RESULT=\"OK\" DG.TRANSFER.REASON=\"detailed description of transfer\" DG.TRANSFER.DEST_JOBID=\"destination internal jobid\" >> $1 - echo DG.LLLID=28027000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"LogMonitor\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Accepted\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000001:LRMS=000000:APP=000000:LBS=000000\" DG.ACCEPTED.FROM=\"JobController\" DG.ACCEPTED.FROM_HOST=\"sending component hostname\" DG.ACCEPTED.FROM_INSTANCE=\"sending component instance\" DG.ACCEPTED.LOCAL_JOBID=\"new jobId \(Condor Globus ...\)\" >> $1 - echo DG.LLLID=28030000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"LogMonitor\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Transfer\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000003:LRMS=000000:APP=000000:LBS=000000\" DG.TRANSFER.DESTINATION=\"LRMS\" DG.TRANSFER.DEST_HOST=\"destination hostname\" DG.TRANSFER.DEST_INSTANCE=\"destination instance\" DG.TRANSFER.JOB=\"job description in receiver language\" DG.TRANSFER.RESULT=\"OK\" DG.TRANSFER.REASON=\"detailed description of transfer\" DG.TRANSFER.DEST_JOBID=\"destination internal jobid\" >> $1 - echo DG.LLLID=28033000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"LogMonitor\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Running\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000005:LRMS=000000:APP=000000:LBS=000000\" DG.RUNNING.NODE=\"worker node\" >> $1 - echo DG.LLLID=28036000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"LogMonitor\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Done\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000007:LRMS=000000:APP=000000:LBS=000000\" DG.DONE.STATUS_CODE=\"OK\" DG.DONE.REASON=\"reason for the change\" DG.DONE.EXIT_CODE=\"0\" >> $1 - echo DG.LLLID=28039000 DG.USER=\"$2\" DATE=\"$($SYS_DATE --universal +'%Y%m%d%H%M%S.%N' | sed 's/...$//')\" HOST=\"$3\" PROG=edg-wms LVL=SYSTEM DG.PRIORITY=4 DG.SOURCE=\"LogMonitor\" DG.SRC_INSTANCE=\"\" DG.EVNT=\"Clear\" DG.JOBID=\"$4\" DG.SEQCODE=\"UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000009:LRMS=000000:APP=000000:LBS=000000\" DG.CLEAR.REASON=\"USER\" >> $1 -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - "--stop") shift ; STOPCOMMAND="$1" ;; - "--start") shift ; STARTCOMMAND="$1" ;; - "-f" | "--file-prefix") shift ; EVENTFILE=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $SYS_DOMAINNAME $LBJOBSTATUS -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - USERIDENTITY=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^identity" | ${SYS_SED} "s/identity\s*:\s//"` - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "($jobid)" - test_done - - #Stopping interlogger (if required) - if [ -z $STOPCOMMAND ]; then - $SYS_ECHO Info: No command to stop was given - else - $SYS_ECHO Stoping the interlogger using the stop command supplied - $STOPCOMMAND - fi - - UNIQUE=`$SYS_ECHO ${jobid} | ${SYS_SED} 's/.*\///'` - - if [ -z $EVENTFILE ]; then - #Set the default event file prefix if none has been supplied - EVENTFILE=/var/glite/log/dglogd.log - fi - - DOMAINNAME=`${SYS_DOMAINNAME} -f` - - # log events: - printf "Generating events resulting in CLEARED state\n" - - #Make sure the il is able to access the file, whatever account it is running under. - $SYS_TOUCH $EVENTFILE.$UNIQUE - $SYS_CHMOD 666 $EVENTFILE.$UNIQUE - - generate_done_events "$EVENTFILE.$UNIQUE" "$USERIDENTITY" "$DOMAINNAME" $jobid - - #Starting interlogger or waiting - if [ -z "$STARTCOMMAND" ]; then - $SYS_ECHO Info: No command to start was given - printf "Sleeping for 70 seconds (waiting for interlogger to notice and deliver events)...\n" - sleep 70 - else - $SYS_ECHO Starting the interlogger using the start command supplied - $STARTCOMMAND > /dev/null 2> /dev/null & - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - sleep 10 - fi - - - - jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Testing job ($jobid) is in state: $jobstate\n" - - if [ "${jobstate}" = "Cleared" ]; then - test_done - else - test_failed - print_error "Job is not in appropriate state" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh deleted file mode 100755 index dd3bee4..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-job-registration.sh +++ /dev/null @@ -1,270 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct job registration - -Prerequisities: - - LB server - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - -Tests called: - - job registration - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "($jobid)" - test_done - - # Check result - jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the job in a correct state? $jobstate" - - if [ "${jobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "Job has not been submitted" - fi - - printf "Trying to re-register job with the same jobid..." - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid > /dev/null - - noofevents=`${LBHISTORY} $jobid | $SYS_NL | $SYS_TAIL -n 1 | ${SYS_AWK} '{print $1}'` - - printf "(Event No. $noofevents)..." - - if [ "${noofevents}" = "2" ]; then - test_done - else - test_failed - print_error "Second registration did not take place" - fi - - - printf "Trying to re-register job with the same jobid, 'exclusive' flag on..." - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid -E > /dev/null 2> /dev/null - - if [ "$?" = "0" ]; then - test_failed - print_error "Registration should not have returned 0" - else - printf " Returned $?" - test_done - fi - - printf "Checking events... " - noofevents=`${LBHISTORY} $jobid | $SYS_NL | $SYS_TAIL -n 1 | ${SYS_AWK} '{print $1}'` - - printf "(There are $noofevents events)..." - - if [ "${noofevents}" = "2" ]; then - test_done - else - test_failed - print_error "Wrong number of registration events" - fi - - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - ${LBPURGE} -j ${joblist} > /dev/null - $SYS_RM ${joblist} - - printf "Test job purged. Testing state..." - ${LBJOBSTATUS} $jobid > $$_jobreg.tmp 2> $$_jobreg_err.tmp - jobstate=`$SYS_CAT $$_jobreg.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_jobreg.tmp` - $SYS_GREP "Identifier removed" $$_jobreg_err.tmp > /dev/null - if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then - test_done - - ${LBJOBREG} -h 2>&1 | $SYS_GREP '\-E' > /dev/null - - if [ $? = 0 ]; then - printf "Trying to re-register. Same JobID, exclusive flag..." - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid -E > /dev/null 2> /dev/null - if [ "$?" = "0" ]; then - test_failed - print_error "Registration should not have returned 0" - else - printf " Returned $?" - test_done - fi - - printf "Checking state (expecting state 'Purged' or EIDRM). " - ${LBJOBSTATUS} $jobid > $$_jobreg.tmp 2> $$_jobreg_err.tmp - jobstate=`$SYS_CAT $$_jobreg.tmp | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}' 2> $$_jobreg.tmp` - $SYS_GREP "Identifier removed" $$_jobreg_err.tmp > /dev/null - if [ "$?" = "0" -o "${jobstate}" = "Purged" ]; then - test_done - else - printf " Option may be off on server side" - test_skipped - - echo $jobid > ${joblist} - ${LBPURGE} -j ${joblist} > /dev/null - $SYS_RM ${joblist} - fi - - printf "Trying to re-register same JobID, exclusive flag off." - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application -j $jobid > /dev/null - if [ "$?" = "0" ]; then - printf " Returned $?" - test_done - else - test_failed - print_error "Registration should not have returned 0" - fi - - printf "Checking state (expecting state 'Submitted'). " - jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - - if [ "${jobstate}" = "Submitted" ]; then - test_done - echo $jobid > ${joblist} - ${LBPURGE} -j ${joblist} > /dev/null - $SYS_RM ${joblist} - else - test_failed - print_error "Falied to re-register a purged JobID event with the 'exclusive' flag off." - fi - - else - printf "Client does not support the 'exclusive' flag." - test_skipped - fi - - - else - printf "Job has not been purged, re-registration test will be skipped" - - test_skipped - fi - - $SYS_RM $$_jobreg.tmp - $SYS_RM $$_jobreg_err.tmp - - fi - - - - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-job-states.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-job-states.sh deleted file mode 100755 index 05976b7..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-job-states.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing if jobs pass through correct states through their lifetimes - -Prerequisities: - - LB local logger, interlogger, and server running - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - -Tests called: - - job registration - event logging - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] [event file prefix]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo "" -} - -test_state () { - - jobstate=`${LBJOBSTATUS} $1 | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - #printf "Testing job ($1) is in state: $jobstate (should be $2)" - printf "Testing job is in state: $jobstate (should be $2)" - - if [ "${jobstate}" = "$2" ]; then - test_done - else - test_failed - print_error "Job is not in appropriate state" - fi - -} - -check_return_and_test_state () -{ -# 1: previous return value -# 2: jobid -# 2> expected state -# printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - if [ $1 = 0 ]; then - test_done - else - test_failed - fi - - sleep 10 - - test_state $2 $3 -} - - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - *) EVENTFILE=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LBJOBSTATUS -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "($jobid)" - test_done - fi - - test_state $jobid Submitted - - EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000" - - printf "logging Accepted" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e Accepted --from="UserInterface" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"` - check_return_and_test_state $? $jobid Waiting - - printf "logging EnQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"` - check_return_and_test_state $? $jobid Waiting - - printf "logging DeQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"` - check_return_and_test_state $? $jobid Waiting - - printf "logging HelperCall" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperCall --helper_name="name of the called component" --helper_params="parameters of the call" --src_role=CALLING` - check_return_and_test_state $? $jobid Waiting - - printf "logging Match" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e Match --dest_id="${DESTINATION:-destination CE/queue}"` - check_return_and_test_state $? $jobid Waiting - - printf "logging HelperReturn" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperReturn --helper_name="name of the called component" --retval="returned data" --src_role=CALLING` - check_return_and_test_state $? $jobid Waiting - - printf "logging EnQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"` - check_return_and_test_state $? $jobid Ready - - printf "logging DeQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"` - check_return_and_test_state $? $jobid Ready - - printf "logging Transfer" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"` - check_return_and_test_state $? $jobid Ready - - printf "logging Accepted" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Accepted --from="JobController" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"` - check_return_and_test_state $? $jobid Ready - - printf "logging Transfer" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"` - check_return_and_test_state $? $jobid Scheduled - - printf "logging Running" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Running --node="${CE_NODE:-worker node}"` - check_return_and_test_state $? $jobid Running - - printf "logging Done" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Done --status_code=OK --reason="reason for the change" --exit_code=0` - check_return_and_test_state $? $jobid Done - - printf "logging Clear" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Clear --reason=USER` - check_return_and_test_state $? $jobid Cleared - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-logevent.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-logevent.sh deleted file mode 100755 index 5278888..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-logevent.sh +++ /dev/null @@ -1,319 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing if local logger is accepting events - -Prerequisities: - - LB local logger, server - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - -Tests called: - - job registration - event logging - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] [event file prefix]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo "" - echo "Give the same prefix you pass to your local logger on startup (-f or --file-prefix option)" - echo "If no event file prefix is given, the default will be used (/var/glite/log/dglogd.log)." -} - - -generate_reference_file() -{ - echo "line 1: edg_wll_ParseEvent() o.k. (event Accepted), edg_wll_UnparseEvent() o.k." > $1 - echo "line 2: edg_wll_ParseEvent() o.k. (event EnQueued), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 3: edg_wll_ParseEvent() o.k. (event DeQueued), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 4: edg_wll_ParseEvent() o.k. (event HelperCall), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 5: edg_wll_ParseEvent() o.k. (event Match), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 6: edg_wll_ParseEvent() o.k. (event HelperReturn), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 7: edg_wll_ParseEvent() o.k. (event EnQueued), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 8: edg_wll_ParseEvent() o.k. (event DeQueued), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 9: edg_wll_ParseEvent() o.k. (event Transfer), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 10: edg_wll_ParseEvent() o.k. (event Accepted), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 11: edg_wll_ParseEvent() o.k. (event Transfer), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 12: edg_wll_ParseEvent() o.k. (event Running), edg_wll_UnparseEvent() o.k." >> $1 - echo "line 13: edg_wll_ParseEvent() o.k. (event Done), edg_wll_UnparseEvent() o.k." >> $1 -} - - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - *) EVENTFILE=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LBPARSEEFILE -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "($jobid)" - test_done - fi - - printf "Logging events\n" - - EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000" - - printf "logging Accepted" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e Accepted --from="UserInterface" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging EnQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s NetworkServer -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging DeQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging HelperCall" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperCall --helper_name="name of the called component" --helper_params="parameters of the call" --src_role=CALLING` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging Match" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e Match --dest_id="${DESTINATION:-destination CE/queue}"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging HelperReturn" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperReturn --helper_name="name of the called component" --retval="returned data" --src_role=CALLING` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging EnQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s WorkloadManager -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging DeQueued" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging Transfer" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s JobController -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging Accepted" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Accepted --from="JobController" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging Transfer" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging Running" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Running --node="${CE_NODE:-worker node}"` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - printf "logging Done" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $jobid -c $EDG_WL_SEQUENCE -s LogMonitor -e Done --status_code=OK --reason="reason for the change" --exit_code=0` - if [ $? = 0 ]; then - test_done - else - test_failed - fi - - UNIQUE=`$SYS_ECHO ${jobid} | ${SYS_SED} 's/.*\///'` - - if [ -z $EVENTFILE ]; then - #Set the default event file prefix if none has been supplied - EVENTFILE=/var/glite/log/dglogd.log - fi - - printf "Testing if event file exists ($EVENTFILE.$UNIQUE) " - if [ -f $EVENTFILE.$UNIQUE ]; then - test_done - - #Test the contents of the file - - #process events file - $LBPARSEEFILE -f $EVENTFILE.$UNIQUE 2>&1 | $SYS_GREP -v "Parsing file" > events.tested.$$.txt - - generate_reference_file events.reference.$$.txt - - printf "Comparing results (<) with expectations (>) ... " - diff events.tested.$$.txt events.reference.$$.txt - if [ $? = 0 ]; then - printf "(MATCH)" - test_done - else - printf "Comparison failed, details above" - test_failed - fi - - echo Cleaning up - $SYS_RM events.tested.$$.txt - $SYS_RM events.reference.$$.txt - else - test_failed - echo "" - echo "* Test file not found. Possible reasons:" - echo "* - Local logger is not running and the file was never created." - echo "* - You have not specified a correct event file prefix." - echo "* Note that you need to give the same prefix used to start" - echo "* the local logger daemon." - #echo "* - Interlogger is running and has already processed and removed" - #echo "* the file. Stop the interlogger for this test." - echo "" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-logger-local.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-logger-local.sh deleted file mode 100755 index 66520df..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-logger-local.sh +++ /dev/null @@ -1,151 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing the LB logger locally - -Prerequisities: - - LB logger running on local machine - - environment variables set: - - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - -Tests called: - - pidof - return instance PIDs of the given binary - mysqladmin ping - check for response by the mysql server - check_socket() - simple tcp echo to all LB server ports - (9002 by default) - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_MYSQLADMIN $SYS_PIDOF -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -# logger running: -printf "Testing if LB logger is running" -if [ "$(${SYS_PIDOF} ${LB_LOGD})" ]; then - test_done -else - test_failed - print_error "${LB_LOGD} is not running" -fi - -# logger listening: -printf "Testing if LB logger is listening on port ${GLITE_LB_LOGGER_PORT}" -check_listener ${LB_LOGD} ${GLITE_LB_LOGGER_PORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB logger is not listening on port ${GLITE_LB_LOGGER_PORT}" -else - test_done -fi - -# interlogger running: -printf "Testing if Interlogger is running" -if [ "$(${SYS_PIDOF} ${LB_INTERLOGD})" ]; then - test_done -else - test_failed - print_error "${LB_INTERLOGD} server is not running" -fi - - -# Interlogger listening on socket: -printf "Testing if interlogger is listening on socket ${GLITE_LB_IL_SOCK}" -check_socket_listener ${LB_INTERLOGD} ${GLITE_LB_IL_SOCK} -if [ $? -gt 0 ]; then - test_failed - print_error "LB interlogger is not listening on socket ${GLITE_LB_IL_SOCK}" -else - test_done -fi - - - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-logger-remote.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-logger-remote.sh deleted file mode 100755 index 2fa55a0..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-logger-remote.sh +++ /dev/null @@ -1,137 +0,0 @@ -#!/bin/bash -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing remotely the LB logger - -Prerequisities: - - LB logger running on remote machine - - environment variables set: - - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - -Tests called: - check_binaries() - check if all necessary binaries are locally available - ping_host() - network ping to LB server host - check_socket() - simple tcp echo to the LB logger port - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] host" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo "" - echo "where host is the LB logger host, it must be specified everytime." -} -if [ -z "$1" ]; then - showHelp - exit 2 -fi - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - *) LB_HOST=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -###################### -# Starting the test # -###################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $TEST_SOCKET $SYS_PING $SYS_GREP -if [ $? -gt 0 ]; then - test_failed - print_error "Some binaries are missing" -else - test_done -fi - -# ping_host: -printf "Testing ping to LB logger ${LB_HOST}" -ping_host ${LB_HOST} -if [ $? -gt 0 ]; then - test_failed - print_error "Destination host might be unreachable" -else - test_done -fi - -# check_services -printf "Testing LB logger at ${LB_HOST}:${GLITE_LB_LOGGER_PORT} (logging)" -check_socket ${LB_HOST} ${GLITE_LB_LOGGER_PORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB logger at ${LB_HOST}:${GLITE_LB_LOGGER_PORT} might be unreachable" -else - test_done -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-msg.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-msg.sh deleted file mode 100755 index 1198683..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-msg.sh +++ /dev/null @@ -1,223 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing notification delivery - -Prerequisities: - - LB server - - Event logging chain - - Notification delivery chain (notification interlogger) - - environment variables set: - - GLITE_LOCATION - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - GLITE_WMS_NOTIF_SERVER - -Tests called: - - job registration - notification registration - logging events - receiving notifications - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $LBCMSCLIENT $SYS_EXPR -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "(${jobid}) " - test_done - fi - - # Register notification: - printf "Registering notification " - - notifid=`${LBNOTIFY} new -j ${jobid} -a x-msg://grid.emi.lbtest | $SYS_GREP "notification ID" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $notifid ]; then - test_failed - print_error "Failed to register notification" - else - printf "(${notifid}) " - test_done - - BROKERLINE=`grep -E "^broker" /etc/glite-lb/msg.conf` - - if [ $? = 0 ]; then - - BROKER=`$SYS_ECHO $BROKERLINE | $SYS_AWK '{print $3}' | $SYS_SED 's/^.*\/\///' | $SYS_SED 's/\///g'` - - printf "connecting to broker $BROKER, topic grid.emi.lbtest" - - #Start listening for notifications - ${LBCMSCLIENT} ${BROKER} grid.emi.lbtest > $$_notifications.txt & - recpid=$! - test_done - - printf "Logging events resulting in DONE state... " - $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - test_done - - printf "Sleep for 20 seconds to give messages time to deliver... " - - sleep 20 - test_done - - kill $recpid - - printf "Checking number of messages delivered... " - - NOofMESSAGES=`$SYS_GREP -E "Message #[0-9]* Received" $$_notifications.txt | $SYS_WC -l` - - printf "$NOofMESSAGES. Checking if >= 10... " - - cresult=`$SYS_EXPR ${NOofMESSAGES} \>= 10` - - if [ "$cresult" -eq "1" ]; then - printf "OK" - test_done - else - test_failed - print_error "Fewer messages than expected" - fi - - $SYS_RM $$_notifications.txt - else - printf "Cannot determine broker address" - test_skipped - fi - - - - #Drop notification - printf "Dropping the test notification (${notifid})" - dropresult=`${LBNOTIFY} drop ${notifid} 2>&1` - if [ -z $dropresult ]; then - test_done - else - test_failed - print_error "Failed to drop notification ${dropresult}" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi - fi -fi - -test_end -#} &> $logfile -} - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh deleted file mode 100755 index 14bd023..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-recovery.sh +++ /dev/null @@ -1,198 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing delayed notification delivery - -Prerequisities: - - LB server - - Event logging chain - - Notification delivery chain (notification interlogger) - - environment variables set: - - GLITE_LOCATION - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - GLITE_WMS_NOTIF_SERVER - -Tests called: - - job registration - notification registration - logging events - receiving notifications - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "(${jobid}) " - test_done - fi - - # Register notification: - printf "Registering notification " - - notifid=`${LBNOTIFY} new -j ${jobid} | $SYS_GREP "notification ID" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $notifid ]; then - test_failed - print_error "Failed to register notification" - else - printf "(${notifid}) " - test_done - - printf "Logging events resulting in DONE state\n" - $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - - sleep 10 - - #Start listening for notifications - ${LBNOTIFY} receive -i 5 ${notifid} > $$_notifications.txt & - recpid=$! - - sleep 10 - kill $recpid - - $SYS_GREP ${jobid} $$_notifications.txt > /dev/null - - if [ $? = 0 ]; then - printf "Notifications were delivered" - test_done - else - printf "Notifications were NOT delivered" - test_failed - fi - - $SYS_RM $$_notifications.txt - - #Drop notification - printf "Dropping the test notification (${notifid})" - dropresult=`${LBNOTIFY} drop ${notifid} 2>&1` - if [ -z $dropresult ]; then - test_done - else - test_failed - print_error "Failed to drop notification ${dropresult}" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi - fi -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh deleted file mode 100755 index 7ec2508..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-stream.sh +++ /dev/null @@ -1,217 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing stream notifications - -Prerequisities: - - LB server - - Event logging chain - - Notification delivery chain (notification interlogger) - - environment variables set: - - GLITE_LOCATION - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - GLITE_WMS_NOTIF_SERVER - -Tests called: - - job registration - logging events - notification registration with stream flag - receiving notifications - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input/Other Error - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 -RETURN=2 - -## -# Starting the test -##################### - -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK -if [ $? -gt 0 ]; then - test_failed - exit $RETURN -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -while true; do - if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" - break - fi - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - break - fi - test_done - - RETURN=1 - - # Register job: - printf "Registering job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - break - else - printf "(${jobid}) " - test_done - fi - - # and log something: - printf "Logging events resulting in DONE state" - $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - if [ $? -eq 0 ]; then - test_done - else - test_failed - print_error "Failed logging" - break - fi - - sleep 5 - - # Register stream notification: - printf "Registering notification " - - notifid=`${LBNOTIFY} new -j ${jobid} -f 256 | $SYS_GREP "notification ID" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $notifid ]; then - test_failed - print_error "Failed to register notification" - break - fi - printf "(${notifid}) " - test_done - - #Start listening for notifications - ${LBNOTIFY} receive -i 5 ${notifid} > $$_notifications.txt & - recpid=$! - - printf "Receiving the stream: " - cnt=0 - while ! $SYS_GREP ${jobid} $$_notifications.txt > /dev/null; do - sleep 0.5 - printf "." - cnt=$((cnt+1)) - if [ $cnt -ge 10 ]; then - break - fi - done - kill $recpid - - $SYS_GREP ${jobid} $$_notifications.txt > /dev/null - if [ $? = 0 ]; then - printf "Notifications were delivered" - test_done - else - printf "Notifications were NOT delivered" - test_failed - break - fi - - RETURN=0 - break -done - -#$SYS_RM $$_notifications.txt - -#Drop notification -if [ ! -z "${notifid}" ]; then - printf "Dropping the test notification (${notifid})" - dropresult=`${LBNOTIFY} drop ${notifid} 2>&1` - if [ -z $dropresult ]; then - test_done - else - test_failed - print_error "Failed to drop notification ${dropresult}" - fi -fi - -#Purge test job -if [ ! -z "${jobid}" ]; then - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} -fi - -test_end - -exit $RETURN diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh deleted file mode 100755 index e6040c7..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif-switch.sh +++ /dev/null @@ -1,263 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing notification delivery - -Prerequisities: - - LB server - - Event logging chain - - Notification delivery chain (notification interlogger) - - environment variables set: - - GLITE_LOCATION - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - GLITE_WMS_NOTIF_SERVER - -Tests called: - - job registration - notification registration - logging events - receiving notifications - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing jobs" - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - otherjobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ] || [ -z $otherjobid ] ; then - test_failed - print_error "Failed to register job" - else - printf "\nold: ${jobid}\nnew:$otherjobid" - test_done - fi - - # Register notification: - printf "Registering notification " - - notifid=`${LBNOTIFY} new -j ${jobid} | $SYS_GREP "notification ID" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $notifid ]; then - test_failed - print_error "Failed to register notification" - else - printf "(${notifid}) " - test_done - - - #Start listening for notifications - ${LBNOTIFY} receive -i 15 ${notifid} > $$_notifications.txt & - recpid=$! - - printf "Logging events resulting in RUNNING state\n" - $LB_RUNNING_SH -j ${jobid} > /dev/null 2> /dev/null - - sleep 10 - - #$SYS_CAT $$_notifications.txt - - $SYS_GREP ${jobid} $$_notifications.txt > /dev/null - - if [ $? = 0 ]; then - printf "Notifications were delivered" - test_done - else - printf "Notifications were NOT delivered" - test_failed - fi - - $SYS_RM $$_notifications.txt - - - printf "Changing notification ... " - $LBNOTIFY change ${notifid} ${otherjobid} - sleep 5 - - if [ $? = 0 ]; then - printf "$LBNOTIFY change returned OK" - test_done - else - printf "Error on return from $LBNOTIFY change" - test_failed - fi - - kill $recpid - - #Start listening for notifications - ${LBNOTIFY} receive -i 10 ${notifid} > $$_notifications.txt & - recpid=$! - - printf "Logging events resulting in DONE state for both jobs\n" - $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - $LB_DONE_SH -j ${otherjobid} > /dev/null 2> /dev/null - - sleep 10 - - kill $recpid - - #$SYS_CAT $$_notifications.txt - - #There may be old notifications still arriving for the 1st job - $SYS_GREP ${jobid} $$_notifications.txt > $$_notifications_old.txt - $SYS_GREP -E "Waiting|Ready|Scheduled|Running" $$_notifications_old.txt >> /dev/null - - if [ $? = 0 ]; then - printf "Old notifications for the 1st job still arriving." - test_running - fi - - #There should be no notifications for the 1st job - $SYS_GREP ${jobid} $$_notifications_old.txt | $SYS_GREP -w "Done">> /dev/null - - if [ $? = 0 ]; then - printf "Notifications for the old job were delivered" - test_failed - else - printf "Notifications for the old job were not delivered" - test_done - fi - - #There should be notifications for the 2nd job - $SYS_GREP ${otherjobid} $$_notifications.txt >> /dev/null - - if [ $? = 0 ]; then - printf "Notifications for the new job were delivered" - test_done - else - printf "Notifications for the new job were NOT delivered" - test_failed - fi - - $SYS_RM $$_notifications.txt - $SYS_RM $$_notifications_old.txt - - #Drop notification - printf "Dropping the test notification (${notifid})" - dropresult=`${LBNOTIFY} drop ${notifid} 2>&1` - if [ -z $dropresult ]; then - test_done - else - test_failed - print_error "Failed to drop notification ${dropresult}" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - echo $otherjobid >> ${joblist} - try_purge ${joblist} - - fi - fi -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh deleted file mode 100755 index 30f890e..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-notif.sh +++ /dev/null @@ -1,197 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing notification delivery - -Prerequisities: - - LB server - - Event logging chain - - Notification delivery chain (notification interlogger) - - environment variables set: - - GLITE_LOCATION - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - GLITE_WMS_NOTIF_SERVER - -Tests called: - - job registration - notification registration - logging events - receiving notifications - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application 2>&1 | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - printf "(${jobid}) " - test_done - fi - - # Register notification: - printf "Registering notification " - - notifid=`${LBNOTIFY} new -j ${jobid} | $SYS_GREP "notification ID" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $notifid ]; then - test_failed - print_error "Failed to register notification" - else - printf "(${notifid}) " - test_done - - #Start listening for notifications - ${LBNOTIFY} receive -i 5 ${notifid} > $$_notifications.txt & - recpid=$! - - printf "Logging events resulting in DONE state\n" - $LB_DONE_SH -j ${jobid} > /dev/null 2> /dev/null - - sleep 10 - - kill $recpid - - $SYS_GREP ${jobid} $$_notifications.txt > /dev/null - - if [ $? = 0 ]; then - printf "Notifications were delivered" - test_done - else - printf "Notifications were NOT delivered" - test_failed - fi - - $SYS_RM $$_notifications.txt - - #Drop notification - printf "Dropping the test notification (${notifid})" - dropresult=`${LBNOTIFY} drop ${notifid} 2>&1` - if [ -z $dropresult ]; then - test_done - else - test_failed - print_error "Failed to drop notification ${dropresult}" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi - fi -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-proxy-delivery.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-proxy-delivery.sh deleted file mode 100755 index 07c4c0c..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-proxy-delivery.sh +++ /dev/null @@ -1,287 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct event delivery - -Prerequisities: - - LB delivery chain - logger, interlogger, server - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_WMS_LBPROXY_STORE_SOCK - if nondefault socket /tmp/lb_proxy_store.sock - -Tests called: - - job registration - proxy-based event logging - checking events - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LB_READY_SH $LB_RUNNING_SH $LB_DONE_SH $SYS_AWK -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - printf "\nRegistered job: $jobid\n" - fi - - jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Submitted)" - fi - - # log events: - printf "Logging events resulting in READY state... " - $LB_READY_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${jobid} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds... \n" - sleep 10 - - jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job ($jobid) in a correct state? $jobstate" - if [ "${jobstate}" = "Ready" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Ready)" - fi - - printf "Logging events for the testing job... " - $LB_RUNNING_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${jobid} > /dev/null 2> /dev/null - $LB_DONE_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${jobid} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds...\n" - sleep 10 - - jobstate=`${LBJOBSTATUS} ${jobid} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Testing job ($jobid) is in state: $jobstate" - - if [ "${jobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Done)" - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - - printf "Registering collection " - ${LBJOBREG} -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -m ${GLITE_WMS_QUERY_SERVER} -s application -C -n 2 -S > $$_test_coll_registration.txt - jobid=`$SYS_CAT $$_test_coll_registration.txt | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - subjobs=( $(cat $$_test_coll_registration.txt | $SYS_GREP EDG_WL_SUB_JOBID | $SYS_SED 's/EDG_WL_SUB_JOBID.*="//' | $SYS_SED 's/"$//') ) - printf "Collection ID: $jobid\n Subjob 1: ${subjobs[0]}\n Subjob 2: ${subjobs[1]}\nChecking if subjob registration worked... " - - job1jdl=`${LBJOBSTATUS} ${subjobs[0]} | ${SYS_GREP} -E "^jdl :" | ${SYS_AWK} '{print $3}'` - if [ "${job1jdl}" = "(null)" ]; then - test_failed - print_error "Subjob registration did not work (JDL not present: "${job1jdl}")" - else - printf "JDL present" - test_done - fi - - printf "Checking if subjob has stateEnterTime set and > 0... " - j1stateenter=`${LBJOBSTATUS} ${subjobs[0]} | $SYS_GREP "stateEnterTime :" | $SYS_SED 's/stateEnterTime :\s*//' ` - cresult=`$SYS_EXPR $j1stateenter= \> 0` - if [ "$cresult" -eq "1" ]; then - printf "$j1stateenter (`$SYS_DATE -d @$j1stateenter`)" - test_done - else - test_failed - print_error "stateEnterTime not set" - fi - - - - printf "Logging events for subjobs... " - $LB_READY_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${subjobs[0]} > /dev/null 2> /dev/null - $LB_DONE_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${subjobs[1]} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - sleep 10 - - jobstate=`${LBJOBSTATUS} ${subjobs[0]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job (${subjobs[0]}) in a correct state? $jobstate" - - if [ "${jobstate}" = "Ready" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Ready)" - fi - - jobstate=`${LBJOBSTATUS} ${subjobs[1]} | ${SYS_GREP} "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job (${subjobs[1]}) in a correct state? $jobstate" - - if [ "${jobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Done)" - fi - - - jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'` - printf "Is the collection ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Waiting" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Waiting)" - fi - - printf "Logging events to clear subjobs... " - $LB_CLEARED_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${subjobs[0]} > /dev/null 2> /dev/null - $LB_CLEARED_SH -X ${GLITE_WMS_LBPROXY_STORE_SOCK}store.sock -j ${subjobs[1]} > /dev/null 2> /dev/null - - printf "Sleeping for 10 seconds (waiting for events to deliver)...\n" - sleep 10 - - jobstate=`${LBJOBSTATUS} -fullhist $jobid | ${SYS_GREP} -E "^state :" | ${SYS_AWK} '{print $3}'` - printf "Is the collection ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Cleared" ]; then - test_done - else - test_failed - print_error "State ${jobstate}: Job is not in appropriate state (Cleared)" - fi - fi - - - - - echo ${subjobs[0]} >> ${joblist} - echo ${subjobs[1]} >> ${joblist} - echo $jobid >> ${joblist} - try_purge ${joblist} - - $SYS_RM $$_test_coll_registration.txt - - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-purge.pl b/org.glite.testsuites.ctb/LB/tests/lb-test-purge.pl deleted file mode 100755 index e176dbd..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-purge.pl +++ /dev/null @@ -1,310 +0,0 @@ -#!/usr/bin/perl -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -use Term::ANSIColor; - -BEGIN{ -$inst = $ENV{GLITE_LB_LOCATION}; -$inst = $ENV{GLITE_LOCATION} unless $inst; -$inst = "/opt/glite" unless $inst; -$sbin = "$inst/sbin"; -$bin = "$inst/bin"; -$test = "$inst/examples"; -$t = "$inst/lib/glite-lb/examples"; if (-d $t) { $test = $t; } -$t = "$inst/lib64/glite-lb/examples"; if (-d $t) { $test = $t; } -$purge = "glite-lb-purge"; -$status = "$test/glite-lb-job_status"; -$log = "$test/glite-lb-job_log"; -$prefix = "/tmp/purge_test_$$"; -$delay = 60; -$html_output = 0; - -$ENV{PATH} .= ":$bin"; -} - -$option = shift; -$server = shift; -$moreopts = shift; - -if ($moreopts =~ m/-x/) { $html_output = 1; } - -die qq{ -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - - This script will DESTROY ALL DATA in the specified bookkeeping server. - -Don't run it unless you are absolutely sure what you are doing. -If you really mean it, the magic usage is: - - $0 --i-want-to-purge server:port - -Good luck! - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -} unless $option eq '--i-want-to-purge'; - -die "usage: $0 --i-want-to-purge server:port [-x]\n" unless $server; - -sub logit { - my $ids = shift; - my $prefix = shift; - my $failed = 0; - - for (qw/aborted cleared cancelled waiting/) { - my $key = $_ eq waiting ? 'other' : $_; - $id = `$test/glite-lb-$_.sh -m $server 2> /dev/null`; - chomp $id; - if ($?) { - test_failed(); - die "$test/glite-lb-$_.sh"; } - $id =~ s/EDG_JOBID=//; - $ids->{$key} = $id; -#print "$status $id | head -1\n"; - $stat = `$status $id | head -2 | tail -1`; - chomp $stat; - $stat =~ s/state :\s*//; -#print "$id: ".uc($stat)." ".uc($_)."\n"; - $failed = 1 if uc($stat) ne uc($_); - - system "$log $id | grep -v '^[ ]*\$' | grep -v '^Found' >${prefix}_$_"; - } - - !$failed; -} - -sub print_result { - my ($format,$text) = @_; - print color $format; -# ($c)=qx(stty size)=~/\d+\s+(\d+)/; -# printf "\015%${c}s\n","[ $text ]"; - printf "%s\n","[ $text ]"; - print color 'reset'; -} -sub test_done() { - if ($html_output) { printf ("done
    \n"); } - else { print_result ('bold green','done'); } -} -sub test_failed() { - if ($html_output) { printf ("-TEST FAILED-
    \n"); } - else { print_result ('bold red','-TEST FAILED-'); } -} -sub test_printf { - if ($html_output) { printf("
    "); } - printf "@_\n"; - if ($html_output) { printf("
    "); } -} - - -test_printf ("** Hey, purging the whole database..."); -system "$purge --server $server --return-list --aborted=0 --cleared=0 --cancelled=0 --other=0"; -if ($!) { - test_failed(); - die "$purge: $!\n"; -} - -test_done(); - -test_printf ("** Logging test jobs\n"); - -if (!logit \%old,"${prefix}_old") { - test_failed(); - die "!! failed\n"; -} - -test_printf ("** So far so good "); -test_done(); - -test_printf ("** sleeping $delay seconds...\n"); -sleep $delay; -test_printf ("** OK, another set of jobs"); -if (!logit \%new,"${prefix}_new") { - test_failed(); - die "!! failed\n"; -} - -test_done(); - -$drain = $delay/10; -test_printf ("** draining other $drain seconds ...\n"); -sleep $drain; - -test_printf ("** test jobs:\n"); - -for (qw/aborted cleared cancelled other/) { - print "$_:\n\t$old{$_}\n\t$new{$_}\n"; -} - -test_printf ("** Dry run\n"); -$failed = 0; - -$half = $delay/2; -for (qw/aborted cleared cancelled other/) { - open LIST,"$purge --server $server --dry-run --return-list --$_=${half}s| grep '^https://'|" or die "!! run $purge\n"; - - $id = ; chomp $id; - if ($old{$_} ne $id) { - $failed = 1; - print "!! $old{$_} (old $_) is not there"; - test_failed(); - } - else { - print "${half}s $_ $id "; - test_done(); - } - $id = ; - if ($id) { - $failed = 1; - chomp $id; - print "!! $id should not be there"; - test_failed(); - } - close LIST; - - open LIST,"$purge --server $server --dry-run --return-list --$_=0s | grep '^https://'|" or die "!! run $purge\n"; - - - $cnt = 0; - while ($id = ) { - chomp $id; - if ($old{$_} ne $id && $new{$_} ne $id) { - $failed = 1; - print "!! $id should not be there"; - test_failed(); - } - else { - print "0s $_ $id "; - test_done(); - } - $cnt++; - } - - close LIST; - if ($cnt != 2) { - $failed = 1; - print "!! bad number of $_ jobs ($cnt)"; - test_failed(); - } -} - -if ($failed) { - printf("aborting"); - test_failed(); - die "!! failed!"; } - -test_printf ("** Server defaults\n"); - -open LIST,"$purge --server $server --dry-run --return-list | grep '^https://'|" or die "!! run $purge\n"; - -$failed = 0; -while ($id = ) { - $failed = 1; - printf "$id"; - test_failed(); } - -if ($failed) { - printf "!! Oops, should not do anything, too short defaults?"; - test_failed(); - die "!! failed!"; } - -print "Nothing purged as expected "; -test_done(); - -test_printf ("** Purge the first set of jobs\n"); - -open DUMP,"$purge --server $server --server-dump --aborted=${half}s --cleared=${half}s --cancelled=${half}s --other=${half}s | grep '^Server dump:'|" - or die "!! run $purge\n"; - -$dump = ; chomp $dump; $dump =~ s/Server dump: //; -close DUMP; - -unless ($dump) { - printf "!! no dump file reported"; - test_failed(); - die "!! failed!"; } -#print "DEBUG: dump file: '$dump'\n"; -@list = glob "${prefix}_old*"; -system "cat @list | sort >${prefix}_old_all"; -system "cat $dump | sed -e s/^.*DATE/DATE/ | sort >${prefix}_old_dump"; -sleep 60; -system "diff ${prefix}_old_all ${prefix}_old_dump >/dev/null"; - -die "!! aggregate log and dump differ\n" if $? & 0xff00; - -print "diff OK "; -test_done(); - -test_printf ("** Purge the rest\n"); -open DUMP,"$purge --server $server --server-dump --aborted=0 --cleared=0 --cancelled=0 --other=0 | grep '^Server dump:'|" - or die "!! run $purge\n"; - -$dump = ; chomp $dump; $dump =~ s/Server dump: //; -close DUMP; - -die "!! no dump file reported\n" unless $dump; -#print "DEBUG: dump file: '$dump'\n"; -@list = glob "${prefix}_new*"; -system "cat @list | sort >${prefix}_new_all"; -system "cat $dump | sed -e s/^.*DATE/DATE/ | sort >${prefix}_new_dump"; -system "diff ${prefix}_new_all ${prefix}_new_dump >/dev/null"; - -die "!! aggregate log and dump differ\n" if $? & 0xff00; - -print "diff OK "; -test_done(); - - -test_printf ("** Anything left?\n"); -open LIST,"$purge --server $server --return-list --dry-run --aborted=0 --cleared=0 --cancelled=0 --other=0 | grep '^https://'|" or die "!! $purge\n"; - -$id = ; -close LIST; -die "!! Yes, but should not\n" if $id; -print "No, OK "; -test_done(); - -test_printf ("** Check zombies\n"); -$failed = 0; - -$errfile = $prefix . "_stat_err.tmp"; -$statfile = $prefix . "_stat.tmp"; - -for (values(%old),values(%new)) { - $jobid = $_; - $stat = 'nic moc'; - system("$status $jobid > $statfile 2> $errfile"); - $stat = `cat $statfile | head -2 | tail -1`; - chomp $stat; - $stat =~ s/state :\s*//; - - $exitcode = system("grep \"Identifier removed\" $errfile > /dev/null"); - if ( ! $exitcode ) { print "$jobid returned EIDRM"; } - else { print "$jobid $stat "; } - if ($stat ne 'Purged' && $exitcode ne 0) { $failed = 1; test_failed(); } - else { test_done(); } -} - -die "EIDRM or state Purged should have been returned for zombies\n" if $failed; - -test_printf ("\n** All tests passed **"); -test_done(); -exit 0; - -END{ unlink glob "${prefix}*" if $prefix; } diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-sandbox-transfer.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-sandbox-transfer.sh deleted file mode 100755 index 32fe822..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-sandbox-transfer.sh +++ /dev/null @@ -1,660 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing support for logging sandbox transfers - -Prerequisities: - - LB event delivery chain (local logger, interlogger, server) - - environment variables set: - - GLITE_WMS_QUERY_SERVER - LB server address and port - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - -Tests called: - - job registration - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $SYS_CAT -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - # Register job: - printf "Registering testing job " - - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application > sbtestjob.$$.out - - jobid=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - seqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "EDG_WL_SEQUENCE" | ${SYS_SED} 's/EDG_WL_SEQUENCE=//' | ${SYS_SED} 's/"//g'` - - $SYS_RM sbtestjob.$$.out - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - - # Check result - jobstate=`${LBJOBSTATUS} ${jobid} | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Is the testing job ($jobid) in a correct state? $jobstate" - - if [ "${jobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "Job has not been submitted" - fi - - printf "Registering input SandBox... " - - $LBREGSANDBOX --jobid $jobid --input --from http://users.machine/path/to/sandbox.file --to file://where/it/is/sandbox.file --sequence $seqcode > sbtestjob.$$.out - - - isbjobid=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_LB_ISB_JOBID" | ${SYS_SED} 's/GLITE_LB_ISB_JOBID=//' | ${SYS_SED} 's/"//g'` - isbseqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_LB_ISB_SEQUENCE" | ${SYS_SED} 's/GLITE_LB_ISB_SEQUENCE=//' | ${SYS_SED} 's/"//g'` - seqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_WMS_SEQUENCE_CODE" | ${SYS_SED} 's/GLITE_WMS_SEQUENCE_CODE=//' | ${SYS_SED} 's/"//g'` - - $SYS_RM sbtestjob.$$.out - - if [ -z $isbjobid ]; then - test_failed - print_error "Failed to register job" - else - printf "$isbjobid" - test_done - - printf "Registering output SandBox... " - $LBREGSANDBOX --jobid $jobid --output --from file://where/it/is/sandbox.file2 --to http://users.machine/path/to/sandbox.file2 --sequence $seqcode > sbtestjob.$$.out - - osbjobid=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_LB_OSB_JOBID" | ${SYS_SED} 's/GLITE_LB_OSB_JOBID=//' | ${SYS_SED} 's/"//g'` - osbseqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_LB_OSB_SEQUENCE" | ${SYS_SED} 's/GLITE_LB_OSB_SEQUENCE=//' | ${SYS_SED} 's/"//g'` - - $SYS_RM sbtestjob.$$.out - - if [ -z $osbjobid ]; then - test_failed - print_error "Failed to register job" - else - printf "$osbjobid" - test_done - - # *************** Input SB transfer -- will be OK ************************************ - printf "Input SB transfer starting... " - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbjobid --sequence $isbseqcode --event FileTransfer --result START` - - if [ -z $isbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state... $isbjobstate" - - if [ "${isbjobstate}" = "Running" ]; then - test_done - else - test_failed - print_error "'Running' was expected" - fi - - printf "Input SB transfer finishing... " - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbjobid --sequence $isbseqcode --event FileTransfer --result OK` - - if [ -z $isbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state... $isbjobstate" - - if [ "${isbjobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "'Done' was expected" - fi - - # *************** Output SB transfer -- will fail ************************************ - printf "Output SB transfer starting... " - osbseqcode=`$LBLOGEVENT --source LRMS --jobid $osbjobid --sequence $osbseqcode --event FileTransfer --result START` - - if [ -z $osbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - sleep 10 - - osbjobstate=`$LBJOBSTATUS $osbjobid | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state... $osbjobstate" - - if [ "${osbjobstate}" = "Running" ]; then - test_done - else - test_failed - print_error "'Running' was expected" - fi - - printf "Output SB transfer failing... " - osbseqcode=`$LBLOGEVENT --source LRMS --jobid $osbjobid --sequence $osbseqcode --event FileTransfer --result FAIL --reason "by design"` - - if [ -z $osbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - sleep 10 - - osbjobstate=`$LBJOBSTATUS $osbjobid | $SYS_GREP "done_code :" | ${SYS_AWK} '{print $3}'` - printf "Checking Done Code... $osbjobstate" - - if [ "${osbjobstate}" = "DONE_CODE_FAILED" ]; then - test_done - else - test_failed - print_error "'DONE_CODE_FAILED' was expected" - fi - - # ******************** Check relationships ******************************* - printf "Check ISB transfer JobID for computing job... " - isbjobidreported=`$LBJOBSTATUS $jobid | $SYS_GREP "isb_transfer :" | ${SYS_AWK} '{print $3}'` - printf "$isbjobidreported" - - if [ "$isbjobidreported" = "$isbjobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - printf "Check OSB transfer JobID for computing job... " - osbjobidreported=`$LBJOBSTATUS $jobid | $SYS_GREP "osb_transfer :" | ${SYS_AWK} '{print $3}'` - printf "$osbjobidreported" - - if [ "$osbjobidreported" = "$osbjobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - printf "Check computing Job ID for ISB... " - jobidreported=`$LBJOBSTATUS $isbjobid | $SYS_GREP "ft_compute_job :" | ${SYS_AWK} '{print $3}'` - printf "$jobidreported" - - if [ "$jobidreported" = "$jobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - fi - - - fi - - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - echo $isbjobid >> ${joblist} - echo $osbjobid >> ${joblist} - try_purge ${joblist} - - fi - - #******************************* Test sandbox collection ********************************* - - # Register job: - printf "Registering testing job " - - ${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application > sbtestjob.$$.out - - jobid=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - seqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "EDG_WL_SEQUENCE" | ${SYS_SED} 's/EDG_WL_SEQUENCE=//' | ${SYS_SED} 's/"//g'` - - $SYS_RM sbtestjob.$$.out - - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - else - test_done - - # register sandbox collection - - printf "Registering input SandBox collection... " - - $LBREGSANDBOX --jobid $jobid --input --from http://users.machine/path/to/sandbox.file --to file://where/it/is/sandbox.file --sequence $seqcode -n 2 > sbtestjob.$$.out 2> sbtestjob.$$.err - - $SYS_GREP "invalid option -- n" sbtestjob.$$.err > /dev/null - - if [ $? -eq 0 ]; then - printf "Capability not detected..." - test_skipped - else - - isbjobid=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_LB_ISB_JOBID" | ${SYS_SED} 's/GLITE_LB_ISB_JOBID=//' | ${SYS_SED} 's/"//g'` - isbseqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_LB_ISB_SEQUENCE" | ${SYS_SED} 's/GLITE_LB_ISB_SEQUENCE=//' | ${SYS_SED} 's/"//g'` - seqcode=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "GLITE_WMS_SEQUENCE_CODE" | ${SYS_SED} 's/GLITE_WMS_SEQUENCE_CODE=//' | ${SYS_SED} 's/"//g'` - isbsubjobid0=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "EDG_WL_SUB_JOBID\[0\]" | ${SYS_SED} 's/EDG_WL_SUB_JOBID\[0\]=//' | ${SYS_SED} 's/"//g'` - isbsubjobid1=`$SYS_CAT sbtestjob.$$.out | $SYS_GREP "EDG_WL_SUB_JOBID\[1\]" | ${SYS_SED} 's/EDG_WL_SUB_JOBID\[1\]=//' | ${SYS_SED} 's/"//g'` - - printf "Subjobs: " $isbsubjobid0 $isbsubjobid1 - - $SYS_RM sbtestjob.$$.out - - if [ -z $isbjobid ]; then - test_failed - print_error "Failed to register job" - else - printf "$isbjobid" - test_done - - # Check relations - - printf "Check ISB transfer JobID for computing job... " - isbjobidreported=`$LBJOBSTATUS $jobid | $SYS_GREP -m 1 "isb_transfer :" | ${SYS_AWK} '{print $3}'` - printf "$isbjobidreported" - - if [ "$isbjobidreported" = "$isbjobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - - printf "Check computing Job ID for ISB... " - jobidreported=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "ft_compute_job :" | ${SYS_AWK} '{print $3}'` - printf "$jobidreported" - - if [ "$jobidreported" = "$jobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - - printf "Check computing Job ID for subjob 0... " - jobidreported=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "ft_compute_job :" | ${SYS_AWK} '{print $3}'` - printf "$jobidreported" - - if [ "$jobidreported" = "$jobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - - printf "Check transfer Job ID for subjob 0... " - jobidreported=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "parent_job :" | ${SYS_AWK} '{print $3}'` - printf "$jobidreported" - - if [ "$jobidreported" = "$isbjobid" ]; then - test_done - else - test_failed - print_error "Not returned or no match" - fi - - - # Check states - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "'Submitted' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid0... $isbjobstate" - - if [ "${isbjobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "'Submitted' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid1 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid1... $isbjobstate" - - if [ "${isbjobstate}" = "Submitted" ]; then - test_done - else - test_failed - print_error "'Submitted' was expected" - fi - - # log START for subjob 1 - printf "Subjob 1 transfer starting... " - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbsubjobid1 --sequence $osbseqcode --event FileTransfer --result START` - - if [ -z $isbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - # Check states - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Running" ]; then - test_done - else - test_failed - print_error "'Running' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid1 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid1... $isbjobstate" - - if [ "${isbjobstate}" = "Running" ]; then - test_done - else - test_failed - print_error "'Running' was expected" - fi - - # log OK for subjob 1 - printf "Subjob 1 transfer ending... " - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbsubjobid1 --sequence $osbseqcode --event FileTransfer --result OK` - - if [ -z $isbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - # Check states - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Waiting" ]; then - test_done - else - test_failed - print_error "'Waiting' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid1 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid1... $isbjobstate" - - if [ "${isbjobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "'Done' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid1 | $SYS_GREP "done_code :" | ${SYS_AWK} '{print $3}'` - printf "Checking Done Code... $isbjobstate" - - if [ "${isbjobstate}" = "DONE_CODE_OK" ]; then - test_done - else - test_failed - print_error "'DONE_CODE_OK' was expected" - fi - - # log START for subjob 0 - printf "Subjob 0 transfer starting... " - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbsubjobid0 --sequence $osbseqcode --event FileTransfer --result START` - - if [ -z $isbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - # Check states - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Running" ]; then - test_done - else - test_failed - print_error "'Running' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid0... $isbjobstate" - - if [ "${isbjobstate}" = "Running" ]; then - test_done - else - test_failed - print_error "'Running' was expected" - fi - - # log FAIL for subjob 0 - printf "Subjob 0 transfer ending... " - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbsubjobid0 --sequence $osbseqcode --event FileTransfer --result FAIL` - - if [ -z $isbseqcode ]; then - test_failed - print_error "LogEvent failed" - else - test_done - fi - - # Check states - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Waiting" ]; then - test_done - else - test_failed - print_error "'Waiting' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid0... $isbjobstate" - - if [ "${isbjobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "'Done' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "done_code :" | ${SYS_AWK} '{print $3}'` - printf "Checking Done Code... $isbjobstate" - - if [ "${isbjobstate}" = "DONE_CODE_FAILED" ]; then - test_done - else - test_failed - print_error "'DONE_CODE_FAILED' was expected" - fi - - # START and OK subjob 0 - - printf "Subjob 0 starting and ending..." - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbsubjobid0 --sequence $osbseqcode --event FileTransfer --result START` - isbseqcode=`$LBLOGEVENT --source LRMS --jobid $isbsubjobid0 --sequence $osbseqcode --event FileTransfer --result OK` - - # Check states - sleep 10 - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "'Done' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbjobid | $SYS_GREP -m 1 "done_code :" | ${SYS_AWK} '{print $3}'` - printf "Checking Done Code... $isbjobstate" - - if [ "${isbjobstate}" = "DONE_CODE_OK" ]; then - test_done - else - test_failed - print_error "'DONE_CODE_OK' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "state :" | ${SYS_AWK} '{print $3}'` - printf "Checking state of $isbsubjobid... $isbjobstate" - - if [ "${isbjobstate}" = "Done" ]; then - test_done - else - test_failed - print_error "'Done' was expected" - fi - - isbjobstate=`$LBJOBSTATUS $isbsubjobid0 | $SYS_GREP "done_code :" | ${SYS_AWK} '{print $3}'` - printf "Checking Done Code... $isbjobstate" - - if [ "${isbjobstate}" = "DONE_CODE_OK" ]; then - test_done - else - test_failed - print_error "'DONE_CODE_OK' was expected" - fi - - - fi - fi - $SYS_RM sbtestjob.$$.err - fi - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-server-local.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-server-local.sh deleted file mode 100755 index 629bfc0..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-server-local.sh +++ /dev/null @@ -1,190 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing the LB server locally - -Prerequisities: - - LB server running on local machine - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - -Tests called: - - pidof - return instance PIDs of the given binary - mysqladmin ping - check for response by the mysql server - check_socket() - simple tcp echo to all LB server ports - (by default 9000 for logging, 9001 for querying, 9003 for web services) - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_MYSQLADMIN $SYS_PIDOF -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -# mySQL running: -printf "Testing if mySQL is running" -if [ "$(${SYS_PIDOF} ${SYS_MYSQLD})" ]; then - test_done -else - test_failed - print_error "mySQL server is not running" -fi - -# mySQL accessible: -printf "Testing if mySQL is accessible" -if [ "$(${SYS_MYSQLADMIN} ${SYS_PING})" ]; then - test_done -else - test_failed - print_error "mySQL server is not answering" -fi - -# server running: -printf "Testing if LB Server is running" -if [ "$(${SYS_PIDOF} ${LB_SERVER})" ]; then - test_done -else - test_failed - print_error "${LB_SERVER} server is not running" -fi - -# Server listening: -printf "Testing if LB Server is listening on port ${GLITE_LB_SERVER_PORT}" -check_listener ${LB_SERVER} ${GLITE_LB_SERVER_PORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB server is not listening on port ${GLITE_LB_SERVER_PORT}" -else - test_done -fi - -# Server listening: -printf "Testing if LB Server is listening on port ${GLITE_LB_SERVER_QPORT}" -check_listener ${LB_SERVER} ${GLITE_LB_SERVER_QPORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB server is not listening on port ${GLITE_LB_SERVER_QPORT}" -else - test_done -fi - -# Server listening: -printf "Testing if LB Server is listening on port ${GLITE_LB_SERVER_WPORT}" -check_listener ${LB_SERVER} ${GLITE_LB_SERVER_WPORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB server is not listening on port ${GLITE_LB_SERVER_WPORT}" -else - test_done -fi - - -# Interlogger running: -printf "Testing if Interlogger is running" -if [ "$(${SYS_PIDOF} ${LB_INTERLOGD})" ]; then - test_done -else - test_failed - print_error "${LB_INTERLOGD} server is not running" -fi - - -# Interlogger listening on socket: -printf "Testing if interlogger is listening on socket ${GLITE_LB_IL_SOCK}" -check_socket_listener ${LB_INTERLOGD} ${GLITE_LB_IL_SOCK} -if [ $? -gt 0 ]; then - test_failed - print_error "LB interlogger is not listening on socket ${GLITE_LB_IL_SOCK}" -else - test_done -fi - - - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-server-remote.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-server-remote.sh deleted file mode 100755 index 34698c3..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-server-remote.sh +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/bash -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing remotely the LB server - -Prerequisities: - - LB server running on remote machine - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - -Tests called: - check_binaries() - check if all necessary binaries are locally available - ping_host() - network ping to LB server host - check_socket() - simple tcp echo to all LB server ports - (by default 9000 for logging, 9001 for querying, 9003 for web services) - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] host" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo "" - echo "where host is the LB server host, it must be specified everytime." -} -if [ -z "$1" ]; then - showHelp - exit 2 -fi - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - *) LB_HOST=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $TEST_SOCKET $SYS_PING $SYS_GREP -if [ $? -gt 0 ]; then - test_failed - print_error "Some binaries are missing" -else - test_done -fi - -# ping_host: -printf "Testing ping to LB server ${LB_HOST}" -ping_host ${LB_HOST} -if [ $? -gt 0 ]; then - test_failed - print_error "Destination host might be unreachable" -else - test_done -fi - -# check_services -printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_PORT} (logging)" -check_socket ${LB_HOST} ${GLITE_LB_SERVER_PORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB server at ${LB_HOST}:${GLITE_LB_SERVER_PORT} might be unreachable" -else - test_done -fi -# -printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_QPORT} (queries)" -check_socket ${LB_HOST} ${GLITE_LB_SERVER_QPORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB server at ${LB_HOST}:${GLITE_LB_SERVER_QPORT} might be unreachable" -else - test_done -fi -# -printf "Testing LB server at ${LB_HOST}:${GLITE_LB_SERVER_WPORT} (web services)" -check_socket ${LB_HOST} ${GLITE_LB_SERVER_WPORT} -if [ $? -gt 0 ]; then - test_failed - print_error "LB server at ${LB_HOST}:${GLITE_LB_SERVER_WPORT} might be unreachable" -else - test_done -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-statistics.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-statistics.sh deleted file mode 100755 index cfeb831..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-statistics.sh +++ /dev/null @@ -1,335 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing statistic functions provided by the L&B Service - -Prerequisities: - - LB local logger, interlogger, and server running - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - GLITE_LB_LOGGER_PORT - if nondefault port (9002) is used - GLITE_WMS_QUERY_SERVER - GLITE_WMS_LOG_DESTINATION - -Tests called: - - job registration - event logging - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] [event file prefix]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo "" -} - -submitted_to_running () { - - EDG_WL_SEQUENCE="UI=000003:NS=0000000000:WM=000000:BH=0000000000:JSS=000000:LM=000000:LRMS=000000:APP=000000:LBS=000000" - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s NetworkServer -e Accepted --from="UserInterface" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s NetworkServer -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperCall --helper_name="name of the called component" --helper_params="parameters of the call" --src_role=CALLING` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e Match --dest_id="CE$datestr$$"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e HelperReturn --helper_name="name of the called component" --retval="returned data" --src_role=CALLING` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s WorkloadManager -e EnQueued --queue="destination queue" --job="job description in receiver language" --result=OK --reason="detailed description of transfer"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s JobController -e DeQueued --queue="queue name" --local_jobid="new jobId assigned by the receiving component"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s JobController -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Accepted --from="JobController" --from_host="sending component hostname" --from_instance="sending component instance" --local_jobid="new jobId (Condor Globus ...)"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Transfer --destination="LRMS" --dest_host="destination hostname" --dest_instance="destination instance" --job="job description in receiver language" --result=OK --reason="detailed description of transfer" --dest_jobid="destination internal jobid"` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Running --node="${CE_NODE:-worker node}"` -} - -running_to_done () { - - EDG_WL_SEQUENCE="UI=000003:NS=0000000004:WM=000010:BH=0000000000:JSS=000004:LM=000006:LRMS=000000:APP=000000:LBS=000000" - - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Done --status_code=OK --reason="reason for the change" --exit_code=0` - EDG_WL_SEQUENCE=`${LBLOGEVENT} -j $1 -c $EDG_WL_SEQUENCE -s LogMonitor -e Clear --reason=USER` -} - - - -# read common definitions and functions -COMMON=lb-common.sh -NOOFJOBS=10 -SEC_COVERAGE=600 -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - "-n" | "--noofjobs") shift ; NOOFJOBS=$1 ;; - *) EVENTFILE=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $LBJOBREG $SYS_AWK $LBJOBSTATUS $SYS_DATE $SYS_EXPR $LB_STATS $LB_FROMTO $SYS_BC -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - datestr=`$SYS_DATE +%Y%m%d%H%M` - - SEQUENCE=`eval "echo {1..${NOOFJOBS}}"` - - for i in $SEQUENCE - do - # Register job: - jobid[$i]=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | ${SYS_GREP} "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z ${jobid[$i]} ]; then - test_failed - print_error "Failed to register job" - fi - done - printf "Test jobs registered." - test_done - - printf "Sleeping for 10 seconds... " - - sleep 10 - - printf "Sending events for all test jobs, Submitted => Running " - for i in $SEQUENCE - do - submitted_to_running ${jobid[$i]} - done - test_done - - printf "Sleeping for 10 seconds... " - - sleep 10 - - printf "Sending events for all test jobs, Running => Done " - for i in $SEQUENCE - do - running_to_done ${jobid[$i]} - done - test_done - - printf "Sleeping for 10 seconds... " - - sleep 10 - -# printf "Sending events for all test jobs, Running => Done" -# for i in $SEQUENCE -# do -# running_to_done ${jobid[$i]} -# done -# test_done - - expected_rate=`echo "scale=7;$NOOFJOBS/$SEC_COVERAGE" | bc` - printf "Getting job rate (should be around $expected_rate, testing if > 0): " - #rate=`$LB_STATS -n $SEC_COVERAGE CE$datestr$$ 5 | ${SYS_GREP} "Average" | ${SYS_AWK} '{ print $6 }'` - rate=`$LB_STATS CE$datestr$$ 5 | ${SYS_GREP} "Average" | ${SYS_AWK} '{ print $6 }'` - cresult=`$SYS_EXPR $rate \> 0` - printf "$rate" - if [ "$cresult" -eq "1" ]; then - test_done - else - test_failed - print_error "Rate other than expected" - fi - - printf "Getting average 'Submitted' -> 'Running' transfer time (should be a number > 10): " - $LB_FROMTO CE$datestr$$ 1 5 > fromto.out.$$ - average=`$SYS_CAT fromto.out.$$ | ${SYS_GREP} "Average duration" | ${SYS_AWK} '{ print $5 }'` - cresult=`$SYS_EXPR $average \> 10` - printf "$average" - if [ "$cresult" -eq "1" ]; then - test_done - else - test_failed - print_error "Average value other than expected" - fi - - printf "Getting the dispersion index (should be a number >= 0): " - dispersion=`$SYS_CAT fromto.out.$$ | ${SYS_GREP} "Dispersion index" | ${SYS_AWK} '{ print $3 }'` - cresult=`$SYS_EXPR $dispersion \>= 0` - printf "$dispersion" - if [ "$cresult" -eq "1" ]; then - test_done - else - test_failed - print_error "Dispersion index value other than expected" - fi - - $SYS_RM fromto.out.$$ - - - printf "Getting average 'Submitted' -> 'Done/OK' transfer time (should be a number > 20): " - $LB_FROMTO CE$datestr$$ 1 6 0 > fromto.out.$$ - doneaverage=`$SYS_CAT fromto.out.$$ | ${SYS_GREP} "Average duration" | ${SYS_AWK} '{ print $5 }'` - donecresult=`$SYS_EXPR $doneaverage \> 20` - printf "$doneaverage" - if [ "$donecresult" -eq "1" ]; then - test_done - else - test_failed - print_error "Average value other than expected" - fi - - printf "Comparing. 'Submitted' -> 'Running' should take longer than 'Submitted' -> 'Done/OK': " - - donecresult=`$SYS_EXPR $doneaverage \> $average` - if [ "$donecresult" -eq "1" ]; then - printf "OK" - test_done - else - test_failed - print_error "Done earlier than Running" - fi - - printf "Long term: Getting average 'Submitted' -> 'Running' transfer times (should be numbers >= 0):" - $LB_FROMTO ALL 1 5 > fromto.out.$$ - averages=( $($SYS_CAT fromto.out.$$ | ${SYS_GREP} "Average duration" | ${SYS_SED} 's/^.*": //' | ${SYS_SED} 's/ s.*$//') ) - $SYS_CAT fromto.out.$$ | ${SYS_GREP} "Average duration" | $SYS_SED 's/":.*$//' | $SYS_SED 's/^.*"//' > fromto.out.ces.$$ - dispersions=( $($SYS_CAT fromto.out.$$ | ${SYS_GREP} "Dispersion index" | ${SYS_AWK} '{ print $3 }') ) - printf "\n" - - let i=0 - $SYS_CAT fromto.out.ces.$$ | while read ce; do - printf "$i.\t$ce:\t${averages[$i]}\t${dispersions[$i]}" - cresult=`$SYS_EXPR ${averages[$i]} \>= 0` - if [ "$cresult" -ne "1" ]; then - test_failed - print_error "Bad average value" - fi - # Also check dispersion - cresult=`$SYS_EXPR ${dispersions[$i]} \>= 0` - if [ "$cresult" -eq "1" ]; then - test_done - else - test_failed - print_error "Bad dispersion value" - fi - - let i++ - done - - $SYS_RM fromto.out.$$ - $SYS_RM fromto.out.ces.$$ - - printf "Long term: Getting average 'Running' rates (should be numbers >= 0):" - $LB_STATS -n 7200 ALL 5 > rates.out.$$ - rates=( $(${SYS_GREP} "Average" rates.out.$$ | ${SYS_SED} 's/^.*": //' | ${SYS_SED} 's/ jobs.*$//') ) - $SYS_CAT rates.out.$$ | ${SYS_GREP} "Average" | $SYS_SED 's/":.*$//' | $SYS_SED 's/^.*"//' > rates.out.ces.$$ - printf "\n" - - let i=0 - $SYS_CAT rates.out.ces.$$ | while read ce; do - printf "$i.\t$ce:\t${rates[$i]}" - cresult=`$SYS_EXPR ${rates[$i]} \>= 0` - if [ "$cresult" -eq "1" ]; then - test_done - else - test_failed - print_error "Bad dispersion value" - fi - - let i++ - done - - $SYS_RM rates.out.$$ - $SYS_RM rates.out.ces.$$ - - - #Purge test job - joblist=$$_jobs_to_purge.txt - for i in $SEQUENCE - do - echo ${jobid[$i]} >> ${joblist} - done - try_purge ${joblist} - - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-switch-owner.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-switch-owner.sh deleted file mode 100755 index 1335fe3..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-switch-owner.sh +++ /dev/null @@ -1,205 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners/ for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing correct interpretation of ChangeACL events - -Prerequisities: - - LB server, logger, interlogger - - environment variables set: - - GLITE_WMS_QUERY_SERVER - X509_USER_PROXY_BOB - -Tests called: - - job registration - sending a GrantOwnership event - sending a TakeOwnership event - quering and tagging the job using the Bob's certificate - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -CONT="yes" -while [ "$CONT" = "yes" ]; do - CONT="no" - - # check_binaries - printf "Testing if all binaries are available" - check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK $LBLOGEVENT $LBJOBREG - if [ $? -gt 0 ]; then - test_failed - break - fi - test_done - - printf "Testing credentials" - check_credentials - if [ $? -ne 0 ]; then - test_failed - break - fi - if [ "$X509_USER_PROXY_BOB" = "" ]; then - test_failed - print_error "\$X509_USER_PROXY_BOB must be set" - break - fi - check_credentials $X509_USER_PROXY_BOB - if [ $? -ne 0 ]; then - test_failed - break - fi - test_done - - identity=`${GRIDPROXYINFO} -f $X509_USER_PROXY_BOB| ${SYS_GREP} -E "^identity" | ${SYS_SED} "s/identity\s*:\s//"` - - # Register job: - printf "Registering testing job " - jobid=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - if [ -z $jobid ]; then - test_failed - print_error "Failed to register job" - break - fi - test_done - - printf "Setting payload owner ..." - $LBLOGEVENT -e GrantPayloadOwnership -s UserInterface --payload_owner "$identity" -j "$jobid" > /dev/null - if [ $? -ne 0 ]; then - test_skipped - print_error "Failed to send GrantPayloadOwnership event, skipping the rest" - break - fi - - X509_USER_PROXY=$X509_USER_PROXY_BOB $LBLOGEVENT -e TakePayloadOwnership -s UserInterface -j "$jobid" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "Sending GrantPayloadOwnership failed" - break - fi - test_done - -# sleep 10 - - printf "Testing acquired permissions" - id=`X509_USER_PROXY=$X509_USER_PROXY_BOB $LBJOBSTATUS $jobid | grep "^payload_owner :" | sed 's/^payload_owner : //'` - if [ $? -ne 0 ]; then - test_failed - print_error "Quering server failed" - break - fi - if [ "$id" != "$identity" ]; then - test_failed - print_error "Payload owner not set in status" - break - fi - - X509_USER_PROXY=$X509_USER_PROXY_BOB $LBLOGEVENT -e UserTag -s Application -j $jobid --name "hokus" --value "pokus" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "Sending UserTag failed" - break - fi - -# sleep 10 - - res=`X509_USER_PROXY=$X509_USER_PROXY_BOB $LBJOBSTATUS $jobid 2>/dev/null` - if [ $? -ne 0 ]; then - test_failed - print_error "Quering server failed" - break - fi - echo $res | grep "hokus = \"pokus\"" > /dev/null - if [ $? -ne 0 ]; then - test_failed - print_error "Adding UserTag not allowed" - break - fi - - test_done - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} -done - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-threaded.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-threaded.sh deleted file mode 100755 index 2987486..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-threaded.sh +++ /dev/null @@ -1,188 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for tebasic sting of threaded client - -Prerequisities: - - LB server - - environment variables set: - - GLITE_LB_SERVER_PORT - if nondefault port (9000) is used - -Tests called: - - job registration - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $GRIDPROXYINFO $SYS_GREP $SYS_SED $SYS_AWK - -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -printf "Testing credentials" - -timeleft=`${GRIDPROXYINFO} | ${SYS_GREP} -E "^timeleft" | ${SYS_SED} "s/timeleft\s*:\s//"` - -if [ "$timeleft" = "" ]; then - test_failed - print_error "No credentials" -else - if [ "$timeleft" = "0:00:00" ]; then - test_failed - print_error "Credentials expired" - else - test_done - - # Register jobs: - - reg_error="0" - printf "Registering testing jobs " - for i in {0..30} - do - printf " $i" - jobid[$i]=`${LBJOBREG} -m ${GLITE_WMS_QUERY_SERVER} -s application | $SYS_GREP "new jobid" | ${SYS_AWK} '{ print $3 }'` - - if [ -z ${jobid[$i]} ]; then - test_failed - print_error "Failed to register a job" - reg_error="1" - fi - done - if [ "$reg_error" = "0" ]; then - test_done - - # Check results - printf "Asking for states of all 30 jobs..." - for i in {0..30} - do - jobids="$jobids ${jobid[$i]}" - done - - - #echo $LBTHRJOBSTATUS $jobids - $LBTHRJOBSTATUS $jobids > threads.$$.tmp 2>/dev/null - test_done - - printf "Checking if states were returned for all jobs..." - let grep_error=0 - for i in {0..30} - do - printf " $i" - $SYS_GREP ${jobid[$i]} threads.$$.tmp > /dev/null 2> /dev/null - if [ $? != 0 ]; then - printf "(!)" - let grep_error++ - fi - done - - if [ "$grep_error" = "0" ]; then - test_done - else - test_failed - print_error "Status not retrieved for $grep_error jobs" - fi - - rm threads.$$.tmp - - #Purge test jobs -# joblist=$$_jobs_to_purge.txt -# for i in {0..30} -# do -# echo ${jobid[$i]} >> ${joblist} -# done -# try_purge ${joblist} - - fi - - fi -fi - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/lb-test-wild.sh b/org.glite.testsuites.ctb/LB/tests/lb-test-wild.sh deleted file mode 100755 index 63308f0..0000000 --- a/org.glite.testsuites.ctb/LB/tests/lb-test-wild.sh +++ /dev/null @@ -1,515 +0,0 @@ -#! /bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# read common definitions and functions -COMMON=lb-common.sh -if [ ! -r ${COMMON} ]; then - echo -en "Common definitions '${COMMON}' missing!\n" - exit 2 -fi -source ${COMMON} - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader - -Launch test in the wild real world against WMS. - -Tests (everything with normal jobs and collections): - - submit - - cancel - - output - - check proper end states (done, aborted, cancelled, cleared) - - all appropriate components send events - -Prerequisities: - - LB server - -Returned values: - Exit $TEST_OK: Test Passed - Exit $TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] HOST" - echo "Options:" - echo " -h | --help Show this help message." - echo " -n | --number Number of batches (default: 2)." - echo " -v | --vo Virtual organization (default: \`voms-proxy-info --vo\`)" - echo " -w | --world World test (by default limited on CESNET node)" - echo " -t | --test Type of test (default: all). Possible tests:" - echo " done fail cancel done_coll fail_coll cancel_coll all" - echo " -f | --format output format (default: color), color/html/text" - echo "" - echo "where HOST is the LB server host, it must be specified everytime." - echo "" - echo "Example for low intrusive test (one job only per test and sequentially):" - echo " for t in done fail cancel done_coll fail_coll cancel_coll; do" - echo " ./lb-test-wild.sh -n 1 -w -f html --test \$t" - echo " done" -} - - -function fatal() { - ret=$1 - shift - print_error " $@" - exit $ret -} - - -if [ -z "$1" ]; then - showHelp - exit 2 -fi -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-n" | "--number") shift && N=$1 ;; - "-v" | "--vo") shift && VO="$1" ;; - "-w" | "--world") NOREQ='#' ;; - "-t" | "--test") - shift - TEST="$1" - if test x"$TEST" = x"all"; then unset TEST; fi - ;; - "-f" | "--format") - shift - case "$1" in - "text") setOutputASCII ;; - "color") setOutputColor ;; - "html") setOutputHTML ;; - esac - ;; - -*) ;; - *) LB_HOST=$1 ;; - esac - shift -done - - -N=${N:-2} -voms-proxy-info >/dev/null || fatal 2 "No VOMS proxy certificate!" -if test -z "$VO"; then - VO=`voms-proxy-info --vo` -fi -if test -z "$VO"; then - fatal 2 "No VO!" -fi - -JDL_HEADER="LBAddress = \"$LB_HOST\"; -VirtualOrganisation = \"$VO\"; -${NOREQ}Requirements = other.GlueCEInfoHostname==\"ce2.egee.cesnet.cz\"; - -RetryCount=2;" - - -# $1 - description -# $2 - file prefix -function submit() { - echo -n "[wild] submit ($1 test): " - glite-wms-job-submit -a $2.jdl >"submit-$2.log" || fatal $TEST_ERROR "Can't submit job ($1 test)" - date '+%Y-%m-%d %H:%M:%S' >> log - cat "submit-$2.log" >> log - jobid=`cat "submit-$2.log" | $SYS_GREP ^https:` - echo -en "$jobid${lf}" - echo "$jobid $2" >> wild-joblist.txt - rm -f "submit-$2.log" - - i=${#jobs[*]} - jobs[$i]=$jobid - job_cats[$i]="$2"; -} - - -# $2 - jobid -function cancel() { - echo -en "[wild] cancel $1${lf}" - echo "y" | glite-wms-job-cancel $1 >>log || fatal $TEST_ERROR "Can't cancel job $1" -} - - -function submit_fail() { -cat > fail.jdl < launch.sh < done.jdl < launch.sh < fail_coll.jdl < launch.sh < done_coll.jdl <$$.stat.log || fatal 2 "Can't get job status" - status=`cat $$.stat.log | $SYS_GREP '^Current Status: ' | $SYS_SED -e 's/^Current Status: [ \t]*\([a-zA-Z]*\).*/\1/'` - if [ x"$status" != x"$prev_status" ]; then - date '+%Y-%m-%d %H:%M:%S' >> log - cat $$.stat.log >> log - - if [ x"${job_cats[$1]}" != x"" ]; then - desc=" (${job_cats[$1]} test)"; - else - desc="" - fi - date '+[wild] %Y-%m-%d %H:%M:%S ' | tr -d '\n' - echo -en "$jobid $status$desc${lf}" - stats[$1]="$status" - fi - rm -f $$.stat.log -} - - -# -- init -- - -rm -f log -touch $$.err -[ ! -z "${LB_HOST}" ] || fatal 2 "No L&B server specified!" - -check_binaries $SYS_GREP $SYS_SED || fatal 2 "not all needed system binaries available" - -fail=$TEST_OK - -# -- launch the beast -- - -{ -test_start - -for ((pass=0;pass> log -done - - -# -- check states -- -for ((i=0;i $$.ulm.log || fatal $TEST_ERROR "Can't query events for '$jobid'" - components=`cat $$.ulm.log | head -n -1 | $SYS_GREP -v '^$' | $SYS_SED -e 's/.*DG\.SOURCE="\([^"]*\)".*/\1/' | sort -f | uniq | tr '\n' ' ' | $SYS_SED 's/ $//'` - rm -f $$.ulm.log - - expected_status='' - expected_components='' - nocategory='' - case "${job_cats[$i]}" in - done) - expected_status='Done' - expected_components='JobController LogMonitor LRMS NetworkServer WorkloadManager' - ;; - done_coll) - expected_status='Done' - expected_components='LBServer NetworkServer WorkloadManager' - ;; - fail) - expected_status='Aborted' - expected_components='JobController LogMonitor LRMS NetworkServer WorkloadManager' - ;; - fail_coll) - expected_status='Aborted' - expected_components='LBServer NetworkServer WorkloadManager' - ;; - cancel) - expected_status='Cancelled' - expected_components='JobController LogMonitor NetworkServer WorkloadManager' - ;; - cancel_coll) - expected_status='Cancelled' - expected_components='NetworkServer WorkloadManager' - ;; - *) - nocategory="no category" - ;; - esac - - if test x"$nocategory" != x""; then - printf "[wild] $jobid: '$status' OK (no category)" && test_done - else - if test x"$expected_status" = x"$status"; then - printf "[wild] $jobid: '$status' OK (${job_cats[$i]})" && test_done - else - if test x"${job_cats[$i]}" = x"cancel_coll" -a x"$status" = x"Cleared"; then - printf "[wild] $jobid: expected '$expected_status', got '$status' (${job_cats[$i]}), so be it!" && test_done - else - print_error "$jobid: expected '$expected_status', got '$status'!" && test_failed - fail=$TEST_ERROR - fi - fi - - if test x"$expected_components" = x"$components"; then - printf "[wild] components: $components OK" && test_done - else - case "${job_cats[$i]}" in - cancel|cancel_coll) - echo -en "[wild] components: $components ?${lf}" - ;; - *) - print_error " components: $components DIFFERS " && test_failed - fail=$TEST_ERROR - ;; - esac - fi - fi -done -echo -en "[wild] ================================${lf}" - - -# -- only for done jobs: fetch output -- - -echo -en "[wild] job output test${lf}" -mkdir -p "jobOutput.$$" 2>/dev/null -for ((i=0; i<${#job_cats[*]}; i++)); do - jobid="${jobs[$i]}" - case "${job_cats[$i]}" in - done) - echo -en "[wild] fetching output from $jobid${lf}" - echo "y" | glite-wms-job-output --dir "jobOutput.$$/$i" "$jobid" >> log - if test "$?" = "0"; then - printf "[wild] output of '$jobid' fetched" && test_done - else - print_error "can't fetch output from $jobid!" && test_failed - fail=$TEST_ERROR - fi - ;; - done_coll) - echo -en "[wild] fetching output from $jobid${lf}" - glite-wms-job-status -v 0 "$jobid" | $SYS_GREP '^ .*https:' | $SYS_SED 's/.*https:/https:/' > $$.subjobs.log - if test x"`wc -l $$.subjobs.log | $SYS_SED 's/\s*\([0-9]*\).*/\1/'`" != x"2"; then - print_error "error, some offspring of $jobid were spawned or eaten!" && test_failed - fail=$TEST_ERROR - fi - j=1 - for subjobid in `cat $$.subjobs.log`; do - echo "y" | glite-wms-job-output --dir "jobOutput.$$/$i-$j" "$subjobid" >> log - if test "$?" = "0"; then - printf "[wild] output of $subjobid ($j. offspring of $jobid) fetched" && test_done - else - print_error "can't fetch output from $subjobid!" && test_failed - fail=$TEST_ERROR - fi - j=$((j+1)) - done - rm -f $$.subjobs.log - ;; - esac -done - - -# -- result data -- -echo -n "[wild] outputs: " -find "jobOutput.$$" -type f -echo -en "${lf}" - - -# -- only for done jobs: wait for cleared -- - -n=${#jobs[*]} -quit=0 -cleared_fail=0 -echo -en "[wild] waiting for cleared states...${lf}" -while test $quit -eq 0; do - quit=1 - for ((i=0;iSUBMITTED" >> /dev/null - if [ $? = 0 ]; then - test_done - else - test_failed - print_error "Job has not been submitted" - fi - - #(regresion-test Savannah Bug 77002) - printf "Checking if doneCode unset for job not yet done..." - - doneCode=`${LBWSJOBSTATUS} -m ${servername}:${GLITE_LB_SERVER_WPORT} -j ${jobid} | ${SYS_GREP} status | ${SYS_GREP} doneCode | ${SYS_SED} 's/^.*//' | ${SYS_SED} 's/<\/doneCode>.*$//'` - - printf "($doneCode)" - - if [ "$doneCode" == "" ]; then - test_done - else - test_failed - print_error "doneCode value $doneCode unexpected" - fi - - printf "Is it possible to retrieve events?" - - ${LBWSJOBLOG} -j ${jobid} -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_GREP "" >> /dev/null - if [ $? = 0 ]; then - test_done - else - test_failed - print_error "Job has not been submitted" - fi - - printf "Is it possible to retrieve AGU activity info?" - check_binaries ${LB4AGUACTINFO} ${LB4AGUACTSTATUS} - if [ $? -gt 0 ]; then - test_missed - else - ${LB4AGUACTINFO} -j ${jobid} -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_GREP "${jobid}" >> /dev/null - if [ $? = 0 ]; then - test_done - else - test_failed - print_error "Job Activity Info returned" - fi - - printf "Does AGU activity status return correct state?" - - ${LB4AGUACTSTATUS} -j ${jobid} -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_GREP "urn:org.glite.lb:Submitted" >> /dev/null - if [ $? = 0 ]; then - test_done - else - test_failed - print_error "Reported status is Running" - fi - fi - - #Purge test job - joblist=$$_jobs_to_purge.txt - echo $jobid > ${joblist} - try_purge ${joblist} - - fi - - printf "Getting server version... " - servername=`echo ${GLITE_WMS_QUERY_SERVER} | ${SYS_SED} "s/:.*//"` - wsglservver=`$LBWSGETVERSION -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_SED 's/^.*Server version:\s*//'` - if [ "$wsglservver" == "" ]; then - test_failed - else - printf "$wsglservver" - test_done - fi - - printf "Getting WS interface version... " - wsglifver=`$LBWSGETVERSION -i -m ${servername}:${GLITE_LB_SERVER_WPORT} | $SYS_SED 's/^.*Interface version:\s*//'` - if [ "$wsglifver" == "" ]; then - test_failed - else - printf "$wsglifver" - test_done - fi - - printf "Check if test runs on server... " - localname=`$SYS_HOSTNAME -f` - - if [ "$servername" == "$localname" ]; then - printf "Get rpm version... " - rpmversion=`$SYS_RPM -qi glite-lb-ws-interface | $SYS_GREP -E "^Version" | $SYS_SED 's/^Version\s*:\s*//' | $SYS_SED 's/\s.*$//'` - - if [ "$rpmversion" == "" ]; then - printf "Unable to detect rpm version" - test_skipped - else - printf "$rpmversion" - test_done - - printf "Comparing versions ($wsglifver == $rpmversion)... " - - if [ "$wsglifver" == "$rpmversion" ]; then - test_done - else - test_failed - print_error "Reported version differs from that indicated by RPM" - fi - fi - else - printf "No" - test_skipped - fi - fi -fi - -test_end -#} &> $logfile -} - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/LB/tests/test-common.sh b/org.glite.testsuites.ctb/LB/tests/test-common.sh deleted file mode 100644 index 5846335..0000000 --- a/org.glite.testsuites.ctb/LB/tests/test-common.sh +++ /dev/null @@ -1,258 +0,0 @@ -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ------------------------------------------------------------------------------ -# Definition of test script return messages -# -# The test scripts should use the variables test_done and test_failed to -# report whether they failed or succeeded. -# -# The variable test_reset is used to turn off all attributes and switch -# to the standard character set. -# -# \033 ascii ESCape -# \033[G move to column (linux console, xterm, not vt100) -# \033[C move columns forward but only upto last column -# \033[D move columns backward but only upto first column -# \033[A move rows up -# \033[B move rows down -# \033[1m switch on bold -# \033[31m switch on red -# \033[32m switch on green -# \033[33m switch on yellow -# \033[m switch off color/bold -# \017 exit alternate mode (xterm, vt100, linux console) -# \033[10m exit alternate mode (linux console) -# \015 carriage return (without newline) -# -# See also United Linux or OpenSUSE /etc/rc.status script -# -# ------------------------------------------------------------------------------ - -# Do _not_ be fooled by non POSIX locale -LC_ALL=POSIX -export LC_ALL - -# Seek for terminal size and, if needed, set default size -if [ -z "${LINES}" -o -z "${COLUMNS}" ]; then - stty_size=`stty size 2> /dev/null` - if [ $? = 0 ]; then - LINES=`echo ${stty_size} | awk '{print $1}'` - COLUMNS=`echo ${stty_size} | awk '{print $2}'` - else - LINES=24 - if [ $LBTSTCOLS -gt 0 ]; then - COLUMNS=$LBTSTCOLS - else - COLUMNS=80 - fi - fi -fi -if [ ! $LINES -ge 0 ]; then LINES=24; fi -if [ ! $COLUMNS -ge 0 ]; then COLUMNS=80; fi -export LINES COLUMNS - -# default return values -TEST_ERROR=1 -TEST_OK=0 - -# test error file -testerrfile=$$.err - -function set_test() -{ -test_done="${spacefill}${begin_green}done${end_green}" -test_running="${spacefill}${begin_green}running${end_green}" -test_failed="${spacefill}${begin_red}-TEST FAILED-${end_red}" -test_missed="${spacefill}${begin_red}missing${end_red}" -test_skipped="${spacefill}${begin_yellow}skipped${end_yellow}" -test_dead="${spacefill}${begin_red}dead${end_red}" -test_unused="${spacefill}${begin_bold}unused${end_bold}" -test_unknown="${spacefill}${begin_yellow}unknown${end_yellow}" - -test_start="${spacefill}${begin_green}start${end_green}" -test_end="${spacefill}${begin_green}end${end_green}" -} - -function test_done() { printf "${test_done}${lf}"; } -function test_running() { printf "${test_running}${lf}"; } -function test_failed() { printf "${test_failed}${lf}"; } -function test_missed() { printf "${test_missed}${lf}"; } -function test_skipped() { printf "${test_skipped}${lf}"; } -function test_dead() { printf "${test_dead}${lf}"; } -function test_unused() { printf "${test_unused}${lf}"; } -function test_unknown { printf "${test_unknown}${lf}"; } -function test_start() { - syslog "${test_start}"; - reset_error -} -function test_end() { - syslog "${test_end}"; - reset_error -} - -# set output to ASCII (without colors) -function setOutputASCII() -{ -lf="\n" -spacefill="..." - -begin_bold="" -begin_black="" -begin_red="" -begin_green="" -begin_yellow="" -begin_blue="" -begin_magenta="" -begin_cyan="" -begin_white="" - -end_bold="" -end_black="" -end_red="" -end_green="" -end_yellow="" -end_blue="" -end_magenta="" -end_cyan="" -end_white="" - -set_test -} - -# set output to ASCII with ANSI colors -function setOutputColor() -{ -local esc=`echo -en "\033"` -local normal="${esc}[0m" # unsets color to term's fg color -lf="\n" -spacefill=`echo -en "\015${esc}[${COLUMNS}C${esc}[15D"` - -begin_bold="${esc}[0;1m" -begin_black="${esc}[0;30m" -begin_red="${esc}[0;31m" -begin_green="${esc}[0;32m" -begin_yellow="${esc}[0;33m" -begin_blue="${esc}[0;34m" -begin_magenta="${esc}[0;35m" -begin_cyan="${esc}[0;36m" -begin_white="${esc}[0;37m" - -end_bold="$normal" -end_black="$normal" -end_red="$normal" -end_green="$normal" -end_yellow="$normal" -end_blue="$normal" -end_magenta="$normal" -end_cyan="$normal" -end_white="$normal" - -set_test -} - -# set output to HTML -function setOutputHTML() -{ -local ENDFONT="" -lf="
    \n" -spacefill="   " -is_html=1 - -begin_bold="" -begin_black="" -begin_red="" -begin_green="" -begin_yellow="" -begin_blue="" -begin_magenta="" -begin_cyan="" -begin_white="" - -end_bold="" -end_black="$ENDFONT" -end_red="$ENDFONT" -end_green="$ENDFONT" -end_yellow="$ENDFONT" -end_blue="$ENDFONT" -end_magenta="$ENDFONT" -end_cyan="$ENDFONT" -end_white="$ENDFONT" - -set_test -} - -function reset_error() -{ - rm -f $testerrfile -} - -function set_error() -{ - printf "%s ${lf}" "$*" > $testerrfile -} - -function update_error() -{ - printf "%s; " "$*" >> $testerrfile -} - -function print_error() -{ - printf "\t${begin_red}Error${end_red}: %s ${lf}" "$*" - - if [ -f $testerrfile ]; then - printf "\t${begin_red}Error${end_red}: %s ${lf}" "`cat $testerrfile`" - fi - reset_error -} - -function print_warning() -{ - printf "${begin_magenta}Warning${end_magenta}: %s ${lf}" "$*" -} - -function print_info() -{ - printf "${begin_blue}Info${end_blue}: %s ${lf}" "$*" -} - -function print_newline() -{ - printf "${lf}" -} - -function syslog() -{ - local tmp="`date +'%b %d %H:%M:%S'` `hostname` $progname" - printf "${begin_bold}${tmp}${end_bold}: %s ${lf}" "$*" -} - -function dprintf() -{ - if [ $DEBUG -gt 0 ]; then - printf "%s${lf}" "$*" - fi -} - -# by default set output to color if possible -if test -t 1 -a "$TERM" != "raw" -a "$TERM" != "dumb" && stty size <&1 > /dev/null 2>&1 ; then - setOutputColor -else - setOutputASCII -fi - diff --git a/org.glite.testsuites.ctb/LB/tests/testSocket.c b/org.glite.testsuites.ctb/LB/tests/testSocket.c deleted file mode 100755 index aedcd9b..0000000 --- a/org.glite.testsuites.ctb/LB/tests/testSocket.c +++ /dev/null @@ -1,73 +0,0 @@ -#ident "$Header$" -/* -Copyright (c) Members of the EGEE Collaboration. 2004-2010. -See http://www.eu-egee.org/partners for details on the copyright holders. - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define BUFFSIZE 32 - -int main (int argc, char *argv[]) { - int sock; - struct hostent *hip; - char *adrIPp; - struct in_addr adrIP; - struct sockaddr_in echoserver; - char buffer[BUFFSIZE]; - unsigned int echolen; - int received = 0; - if (argc != 3) { - fprintf(stderr, "USAGE: TCPecho \n"); - exit(1); - } -/* conversion from DNS to IPv4 */ - if ((hip = gethostbyname (argv[1])) == NULL) { - fprintf(stderr,"Error with gethostbyname: %s",strerror(errno)); -// exit(1); - } - adrIP.s_addr = *(int *) hip->h_addr; - adrIPp = (char *) inet_ntoa (adrIP); -/* Create the TCP socket */ - if ((sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0) { - fprintf(stderr,"Failed to create socket: %s",strerror(errno)); - exit(1); - } -/* Construct the server sockaddr_in structure */ - memset (&echoserver, 0, sizeof (echoserver)); /* Clear struct */ - echoserver.sin_family = AF_INET; /* Internet/IP */ - echoserver.sin_addr.s_addr = inet_addr (adrIPp); /* IP address */ - echoserver.sin_port = htons (atoi (argv[2])); /* server port */ -// fprintf(stdout,"Connecting to: %s:%s\n", adrIPp, argv[2]); -/* Establish connection */ - if (connect (sock, (struct sockaddr *) &echoserver, sizeof (echoserver)) < 0) { - //Die ("Failed to connect with server"); - fprintf(stderr,"Failed to connect with server (%s:%d): %s",adrIPp,atoi(argv[2]),strerror(errno)); - exit(1); - } - shutdown (sock, 2); -// fprintf(stdout," [OK]\n"); - exit(0); -} diff --git a/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh b/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh deleted file mode 100755 index 003ef64..0000000 --- a/org.glite.testsuites.ctb/gridsite/tests/gridsite-common.sh +++ /dev/null @@ -1,180 +0,0 @@ -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ------------------------------------------------------------------------------ -# Definitions of functions and variables common to LB test scripts -# -# ping_host() - basic network ping -# check_binaries() - check for binary executables, calls check_exec() -# check_socket() - TCPecho to host:port -# -# ------------------------------------------------------------------------------ - -# read common definitions and functions -TEST_COMMON=test-common.sh -if [ ! -r ${TEST_COMMON} ]; then - printf "Common definitions '${TEST_COMMON}' not found!\n" - exit 2 -fi -source ${TEST_COMMON} - - -# define variables -GLITE_LOCATION=${GLITE_LOCATION:-/opt/glite} -SAME_SENSOR_HOME=${SAME_SENSOR_HOME:-.} -PATH=$GLITE_LOCATION/bin:$GLITE_LOCATION/examples:$PATH -export PATH - -GRIDPROXYINFO=grid-proxy-info - -# binaries -SYS_LSOF=lsof -SYS_GREP=grep -SYS_SED=sed -SYS_PS=ps -SYS_PIDOF=pidof -if test -f /usr/sbin/apache2; then - SYS_APACHE=apache2 -else - SYS_APACHE=httpd -fi -if test -f /usr/sbin/apache2ctl; then - SYS_APACHECTL=apache2ctl -else - SYS_APACHECTL=apachectl -fi -SYS_PING=ping -SYS_AWK=awk -SYS_ECHO=echo -SYS_DOMAINNAME=domainname -SYS_CURL=curl -SYS_RM="rm -f" -SYS_CHMOD=chmod -SYS_CAT=cat -SYS_NL=nl -SYS_TAIL=tail -SYS_DATE=date -SYS_EXPR=expr -SYS_BC=bc -SYS_SCP=scp -SYS_NC=nc -SYS_CURL=curl -VOMSPROXYINFO=voms-proxy-info - -# not used at the moment -DEBUG=2 - -# ping host -function ping_host() -{ - if [ -z $1 ]; then - set_error "No host to ping" - return $TEST_ERROR - fi - PING_HOST=$1 - # XXX: there might be a better way to test the network reachability - result=`${SYS_PING} -c 3 $PING_HOST 2>/dev/null | ${SYS_GREP} " 0% packet loss"| wc -l` - if [ $result -gt 0 ]; then - return $TEST_OK - else - return $TEST_ERROR - fi -} - - -# check the binaries -function check_exec() -{ - if [ -z $1 ]; then - set_error "No binary to check" - return $TEST_ERROR - fi - # XXX: maybe use bash's command type? - local ret=`which $1 2> /dev/null` - if [ -n "$ret" -a -x "$ret" ]; then - return $TEST_OK - else - return $TEST_ERROR - fi -} - -function check_binaries() -{ -# TODO: test only the binaries that are needed - it can differ in each test - local ret=$TEST_OK - for file in $@ - do - check_exec $file - if [ $? -gt 0 ]; then - update_error "file $file not found" - ret=$TEST_ERROR - fi - done - return $ret -} - -# check socket -function check_socket() -{ - if [ $# -lt 2 ]; then - set_error "No host:port to check" - return $TEST_ERROR - fi - $SYS_NC -z $1 $2 > $testerrfile - if [ $? -eq 0 ]; then - return $TEST_OK - else - return $TEST_ERROR - fi -} - -# Check listener -# Arguments: -# $1: program expected to listen on the given port -# $2: TCP port to check -function check_listener() -{ - req_program=$1 - req_port=$2 - if [ -z $1 ]; then - set_error "No program name entered" - return $TEST_ERROR - fi - - pid=`lsof -F p -i TCP:$req_port | sed "s/^p//" | head -n 1` - if [ -z "$pid" ]; then - return $TEST_ERROR - fi - program=`ps -p ${pid} -o args= | grep -E "[\/]*$req_program[ \t]*"` - if [ -z "$program" ]; then - return $TEST_ERROR - else - return $TEST_OK - fi -} - -# make HTTP request using curl -# Arguments: Options to be passed to curl, at least the URL -# return http_code containing resulting code - -function call_curl() -{ - http_code=`curl --cert ${X509_USER_PROXY} --key ${X509_USER_PROXY} \ - --capath ${X509_CERT_DIR} \ - --output /dev/null --silent --write-out '%{http_code}\n' \ - "$@"` -} diff --git a/org.glite.testsuites.ctb/gridsite/tests/gridsite-test-all.sh b/org.glite.testsuites.ctb/gridsite/tests/gridsite-test-all.sh deleted file mode 100755 index d9a051e..0000000 --- a/org.glite.testsuites.ctb/gridsite/tests/gridsite-test-all.sh +++ /dev/null @@ -1,384 +0,0 @@ -#!/bin/bash -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing gridsite functions - -Prerequisities: - - GridSite and httpd with mod_ssl installe - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." -} - -# read common definitions and functions -COMMON=gridsite-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - esac - shift -done - -# redirecting all output to $logfile -#touch $logfile -#if [ ! -w $logfile ]; then -# echo "Cannot write to output file $logfile" -# exit $TEST_ERROR -#fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - - -# check_binaries -printf "Testing if all binaries are available" -check_binaries curl rm chown openssl htcp htls htmv htcp htrm htls htls htproxydestroy -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - - - if [ ! -e /var/www/htdocs ]; then - mkdir /var/www/htdocs - fi - - printf "READ (Read Permissions)\n" - -cat >/var/www/htdocs/test.html <

    Hello Grid

    -EOF - - $SYS_RM /var/www/htdocs/.gacl - - printf "Plain read... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' https://$(hostname -f)/test.html` - printf "Return code $code" - if [ "$code" = "403" ]; then - test_done - else - test_failed - fi - -cat >/var/www/htdocs/.gacl < - - - - - -EOF - - - printf "With gacl... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' https://$(hostname -f)/test.html` - printf "Return code $code" - if [ "$code" = "200" ]; then - test_done - else - test_failed - fi - - - printf "Get index (list & read permissions)\n" - - printf "Plain read... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' https://$(hostname -f)/` - printf "Return code $code" - if [ "$code" = "403" ]; then - test_done - else - test_failed - fi - -cat >/var/www/htdocs/.gacl < - - - `openssl x509 -noout -subject -in /etc/grid-security/hostcert.pem | sed -e 's/^subject= //'` - - - - -EOF - - printf "With gacl... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' \ -https://$(hostname -f)/` - printf "Return code $code" - if [ "$code" = "200" ]; then - test_done - else - test_failed - fi - - - - - printf "WRITE & DELETE (write permissions)\n" - - rm -f /var/www/htdocs/.gacl /var/www/htdocs/test.txt - date > /tmp/test.txt - chown apache /var/www/htdocs/ - - printf "Plain write... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' --upload-file /tmp/test.txt https://$(hostname -f)/test.txt` - printf "Return code $code" - if [ "$code" = "403" ]; then - test_done - else - test_failed - fi - -cat >/var/www/htdocs/.gacl < - - - `openssl x509 -noout -subject -in /etc/grid-security/hostcert.pem | sed -e 's/^subject= //'` - - - - -EOF - - printf "With gacl... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' --upload-file /tmp/test.txt https://$(hostname -f)/test.txt` - cmp -s /tmp/test.txt /var/www/htdocs/test.txt - printf "Return code $code" - if [ $? -eq 0 -a "$code" = "201" ]; then - test_done - else - test_failed - fi - - printf "Try deletion... " - mv /var/www/htdocs/.gacl /var/www/htdocs/.gacl.bak - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' -X DELETE https://$(hostname -f)/test.txt` - printf "Return code $code" - if [ $? -eq 0 -a "$code" = "403" ]; then - test_done - else - test_failed - fi - - mv /var/www/htdocs/.gacl.bak /var/www/htdocs/.gacl - - printf "With gacl... " - code=`curl --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --output /dev/null --silent --write-out '%{http_code}\n' -X DELETE https://$(hostname -f)/test.txt` - printf "Return code $code" - if [ $? -eq 0 -a "$code" = "200" ]; then - test_done - else - test_failed - fi - chown root /var/www/htdocs - - - printf "Checking attributes passed on to the environment\n" - -cat >/var/www/htdocs/.gacl < - - - `openssl x509 -noout -subject -in /etc/grid-security/hostcert.pem | sed -e 's/^subject= //'` - - - - -EOF - -cat >/var/www/htdocs/test.cgi </dev/null 2>/dev/null - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - - - printf "Test the basic commands (htcp, htls, htmkdir, htmv, htrm)\n" - -cat >/var/www/htdocs/.gacl < - - - `openssl x509 -noout -subject -in /etc/grid-security/hostcert.pem | sed -e 's/^subject= //'` - - - - -EOF - - chown apache /var/www/htdocs/ - - date > /tmp/test.txt - - printf "Testing htcp... " - htcp --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ /tmp/test.txt https://$(hostname -f)/ - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - printf "Checking by htls... " - htls --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ https://$(hostname -f)/test.txt > /dev/null - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - printf "Testing htmv... " - htmv --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ https://$(hostname -f)/test.txt https://$(hostname -f)/test2.txt - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - printf "htcp, file 2... " - htcp --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ https://$(hostname -f)/test2.txt /tmp - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - printf "Testing htrm... " - htrm --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ https://$(hostname -f)/test2.txt - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - printf "Checking by htls... " - htls --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ https://$(hostname -f)/test2.txt 2> /dev/null - if [ $? -eq 22 ]; then - test_done - else - test_failed - fi - printf "Checking directory contents with htls... " - htls --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates/ https://$(hostname -f)/ > /dev/null - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - printf "File compare... " - cmp /tmp/test.txt /tmp/test2.txt - if [ $? -eq 0 ]; then - test_done - else - test_failed - fi - - chown root /var/www/htdocs/ - - printf "Test proxy delegation\n" - - if [ ! -e /var/www/proxycache ]; then - mkdir /var/www/proxycache - fi - chown apache /var/www/proxycache - - #delegation - id=`htproxyput --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates https://$(hostname -f)/gridsite-delegation.cgi` - printf "id: $id" - if [ $? -eq 0 -a -n "$id" ]; then - test_done - else - test_failed - fi - - expiry=`htproxyunixtime --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --delegation-id $id https://$(hostname -f)/gridsite-delegation.cgi` - - newid=`htproxyrenew --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --delegation-id $id https://$(hostname -f)/gridsite-delegation.cgi` - printf "newid: $newid" - if [ $? -eq 0 -a -n "$newid" ]; then - test_done - else - test_failed - fi - - htproxydestroy --cert /etc/grid-security/hostcert.pem --key /etc/grid-security/hostkey.pem --capath /etc/grid-security/certificates --delegation-id $id https://$(hostname -f)/gridsite-delegation.cgi - - - - -test_end -} -#} &> $logfile - -#if [ $flag -ne 1 ]; then -# cat $logfile -# $SYS_RM $logfile -#fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh b/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh deleted file mode 100755 index 6fa1aba..0000000 --- a/org.glite.testsuites.ctb/gridsite/tests/ping-local.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/bash -# $Id$ - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing the GridSite components locally - -Prerequisities: - - Apache with the GridSite module enabled running on local machine - -Tests: - - Checks that Apache is running and listening to port 443. - - Checks that the GridSite module is loaded in the Apache configuration - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS]" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo " -f | --config Apache config file." -} - -# read common definitions and functions -COMMON=gridsite-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - "-f" | "--config") shift; apache_config_arg="-f $1" ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $SYS_LSOF $SYS_GREP $SYS_SED $SYS_PS $SYS_PIDOF $SYS_APACHECTL -if [ $? -gt 0 ]; then - test_failed -else - test_done -fi - -# Apache running: -printf "Testing if Apache is running" -if [ "$(${SYS_PIDOF} ${SYS_APACHE})" ]; then - test_done -else - test_failed - print_error "Apache server is not running" -fi - -# GridSite module loaded: -printf "Testing if GridSite is loaded" -${SYS_APACHECTL} ${apache_config_arg} -t -D DUMP_MODULES 2>&1| grep gridsite_module >/dev/null 2>&1 -if [ $? -eq 0 ]; then - test_done -else - test_failed - print_error "GridSite is not loaded in Apache" -fi - -# Server listening: -printf "Testing if Apache is listening on port 443" -check_listener ${SYS_APACHE} 443 -if [ $? -eq 0 ]; then - test_done -else - test_failed - print_error "Apache server is not listening on port 443" -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/gridsite/tests/ping-remote.sh b/org.glite.testsuites.ctb/gridsite/tests/ping-remote.sh deleted file mode 100755 index 91bc0b0..0000000 --- a/org.glite.testsuites.ctb/gridsite/tests/ping-remote.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# $Id$ - -# show help and usage -progname=`basename $0` -showHelp() -{ -cat << EndHelpHeader -Script for testing The GridSite components remotely - -Prerequisities: - - Apache with the GridSite module enabled running on remote machine - -Tests: - - ping_host() - network ping to Apache server host - - check_socket() - simple tcp echo to port 443 of the host - -Returned values: - Exit TEST_OK: Test Passed - Exit TEST_ERROR: Test Failed - Exit 2: Wrong Input - -EndHelpHeader - - echo "Usage: $progname [OPTIONS] host" - echo "Options:" - echo " -h | --help Show this help message." - echo " -o | --output 'file' Redirect all output to the 'file' (stdout by default)." - echo " -t | --text Format output as plain ASCII text." - echo " -c | --color Format output as text with ANSI colours (autodetected by default)." - echo " -x | --html Format output as html." - echo "" - echo "where host is the Apache server host, it must be specified everytime." -} -if [ -z "$1" ]; then - showHelp - exit 2 -fi - -# read common definitions and functions -COMMON=gridsite-common.sh -if [ ! -r ${COMMON} ]; then - printf "Common definitions '${COMMON}' missing!" - exit 2 -fi -source ${COMMON} - -logfile=$$.tmp -flag=0 -while test -n "$1" -do - case "$1" in - "-h" | "--help") showHelp && exit 2 ;; - "-o" | "--output") shift ; logfile=$1 flag=1 ;; - "-t" | "--text") setOutputASCII ;; - "-c" | "--color") setOutputColor ;; - "-x" | "--html") setOutputHTML ;; - *) APACHE_HOST=$1 ;; - esac - shift -done - -# redirecting all output to $logfile -touch $logfile -if [ ! -w $logfile ]; then - echo "Cannot write to output file $logfile" - exit $TEST_ERROR -fi - -DEBUG=2 - -## -# Starting the test -##################### - -{ -test_start - -# check_binaries -printf "Testing if all binaries are available" -check_binaries $SYS_NC $SYS_PING $SYS_GREP -if [ $? -gt 0 ]; then - test_failed - print_error "Some binaries are missing" -else - test_done -fi - -# ping_host: -printf "Testing ping to Apache server ${APACHE_HOST}" -ping_host ${APACHE_HOST} -if [ $? -gt 0 ]; then - test_failed - print_error "Destination host might be unreachable" -else - test_done -fi - -# check_services -printf "Testing Apache server at ${APACHE_HOST}:443" -check_socket ${APACHE_HOST} 443 -if [ $? -gt 0 ]; then - test_failed - print_error "Apache server at ${APACHE_HOST}:443 might be unreachable" -else - test_done -fi - -test_end -} &> $logfile - -if [ $flag -ne 1 ]; then - cat $logfile - $SYS_RM $logfile -fi -exit $TEST_OK - diff --git a/org.glite.testsuites.ctb/gridsite/tests/test-common.sh b/org.glite.testsuites.ctb/gridsite/tests/test-common.sh deleted file mode 100644 index 4480ea2..0000000 --- a/org.glite.testsuites.ctb/gridsite/tests/test-common.sh +++ /dev/null @@ -1,258 +0,0 @@ -# $Header$ -# -# Copyright (c) Members of the EGEE Collaboration. 2004-2010. -# See http://www.eu-egee.org/partners for details on the copyright holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# ------------------------------------------------------------------------------ -# Definition of test script return messages -# -# The test scripts should use the variables test_done and test_failed to -# report whether they failed or succeeded. -# -# The variable test_reset is used to turn off all attributes and switch -# to the standard character set. -# -# \033 ascii ESCape -# \033[G move to column (linux console, xterm, not vt100) -# \033[C move columns forward but only upto last column -# \033[D move columns backward but only upto first column -# \033[A move rows up -# \033[B move rows down -# \033[1m switch on bold -# \033[31m switch on red -# \033[32m switch on green -# \033[33m switch on yellow -# \033[m switch off color/bold -# \017 exit alternate mode (xterm, vt100, linux console) -# \033[10m exit alternate mode (linux console) -# \015 carriage return (without newline) -# -# See also United Linux or OpenSUSE /etc/rc.status script -# -# ------------------------------------------------------------------------------ - -# Do _not_ be fooled by non POSIX locale -LC_ALL=POSIX -export LC_ALL - -# Seek for terminal size and, if needed, set default size -if [ -z "${LINES}" -o -z "${COLUMNS}" ]; then - stty_size=`stty size 2> /dev/null` - if [ $? = 0 ]; then - LINES=`echo ${stty_size} | awk '{print $1}'` - COLUMNS=`echo ${stty_size} | awk '{print $2}'` - else - LINES=24 - if [ $LBTSTCOLS -gt 0 ]; then - COLUMNS=$LBTSTCOLS - else - COLUMNS=80 - fi - fi -fi -if [ ! $LINES -ge 0 ]; then LINES=24; fi -if [ ! $COLUMNS -ge 0 ]; then COLUMNS=80; fi -export LINES COLUMNS - -# default return values -TEST_ERROR=1 -TEST_OK=0 - -# test error file -testerrfile=$$.err - -function set_test() -{ -test_done="${spacefill}${begin_green}done${end_green}" -test_running="${spacefill}${begin_green}running${end_green}" -test_failed="${spacefill}${begin_red}-TEST FAILED-${end_red}" -test_missed="${spacefill}${begin_red}missing${end_red}" -test_skipped="${spacefill}${begin_yellow}skipped${end_yellow}" -test_dead="${spacefill}${begin_red}dead${end_red}" -test_unused="${spacefill}${begin_bold}unused${end_bold}" -test_unknown="${spacefill}${begin_yellow}unknown${end_yellow}" - -test_start="${spacefill}${begin_green}start${end_green}" -test_end="${spacefill}${begin_green}end${end_green}" -} - -function test_done() { printf "${test_done}${lf}"; } -function test_running() { printf "${test_running}${lf}"; } -function test_failed() { printf "${test_failed}${lf}"; } -function test_missed() { printf "${test_missed}${lf}"; } -function test_skipped() { printf "${test_skipped}${lf}"; } -function test_dead() { printf "${test_dead}${lf}"; } -function test_unused() { printf "${test_unused}${lf}"; } -function test_unknown { printf "${test_unknown}${lf}"; } -function test_start() { - syslog "${test_start}"; - reset_error -} -function test_end() { - syslog "${test_end}"; - reset_error -} - -# set output to ASCII (without colors) -function setOutputASCII() -{ -lf="\n" -spacefill="..." - -begin_bold="" -begin_black="" -begin_red="" -begin_green="" -begin_yellow="" -begin_blue="" -begin_magenta="" -begin_cyan="" -begin_white="" - -end_bold="" -end_black="" -end_red="" -end_green="" -end_yellow="" -end_blue="" -end_magenta="" -end_cyan="" -end_white="" - -set_test -} - -# set output to ASCII with ANSI colors -function setOutputColor() -{ -local esc=`echo -en "\033"` -local normal="${esc}[0m" # unsets color to term's fg color -lf="\n" -spacefill=`echo -en "\015${esc}[${COLUMNS}C${esc}[15D"` - -begin_bold="${esc}[0;1m" -begin_black="${esc}[0;30m" -begin_red="${esc}[0;31m" -begin_green="${esc}[0;32m" -begin_yellow="${esc}[0;33m" -begin_blue="${esc}[0;34m" -begin_magenta="${esc}[0;35m" -begin_cyan="${esc}[0;36m" -begin_white="${esc}[0;37m" - -end_bold="$normal" -end_black="$normal" -end_red="$normal" -end_green="$normal" -end_yellow="$normal" -end_blue="$normal" -end_magenta="$normal" -end_cyan="$normal" -end_white="$normal" - -set_test -} - -# set output to HTML -function setOutputHTML() -{ -local ENDFONT="
    " -lf="
    \n" -spacefill="   " -is_html=1 - -begin_bold="" -begin_black="" -begin_red="" -begin_green="" -begin_yellow="" -begin_blue="" -begin_magenta="" -begin_cyan="" -begin_white="" - -end_bold="" -end_black="$ENDFONT" -end_red="$ENDFONT" -end_green="$ENDFONT" -end_yellow="$ENDFONT" -end_blue="$ENDFONT" -end_magenta="$ENDFONT" -end_cyan="$ENDFONT" -end_white="$ENDFONT" - -set_test -} - -function reset_error() -{ - rm -f $testerrfile -} - -function set_error() -{ - printf "%s ${lf}" "$*" > $testerrfile -} - -function update_error() -{ - printf "%s; " "$*" >> $testerrfile -} - -function print_error() -{ - printf "${begin_red}Error${end_red}: %s ${lf}" "$*" - - if [ -f $testerrfile ]; then - printf "${begin_red}Error${end_red}: %s ${lf}" "`cat $testerrfile`" - fi - reset_error -} - -function print_warning() -{ - printf "${begin_magenta}Warning${end_magenta}: %s ${lf}" "$*" -} - -function print_info() -{ - printf "${begin_blue}Info${end_blue}: %s ${lf}" "$*" -} - -function print_newline() -{ - printf "${lf}" -} - -function syslog() -{ - local tmp="`date +'%b %d %H:%M:%S'` `hostname` $progname" - printf "${begin_bold}${tmp}${end_bold}: %s ${lf}" "$*" -} - -function dprintf() -{ - if [ $DEBUG -gt 0 ]; then - printf "%s${lf}" "$*" - fi -} - -# by default set output to color if possible -if test -t 1 -a "$TERM" != "raw" -a "$TERM" != "dumb" && stty size <&1 > /dev/null 2>&1 ; then - setOutputColor -else - setOutputASCII -fi - diff --git a/org.glite.wms-utils.exception/.cvsignore b/org.glite.wms-utils.exception/.cvsignore deleted file mode 100644 index e970233..0000000 --- a/org.glite.wms-utils.exception/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project \ No newline at end of file diff --git a/org.glite.wms-utils.exception/LICENSE b/org.glite.wms-utils.exception/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.wms-utils.exception/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.wms-utils.exception/Makefile.am b/org.glite.wms-utils.exception/Makefile.am deleted file mode 100755 index b66c2bb..0000000 --- a/org.glite.wms-utils.exception/Makefile.am +++ /dev/null @@ -1,67 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -## Process this file with automake to produce Makefile.in -EXTRA_DIST = LICENSE - -docdir = $(datadir)/doc/@PACKAGE@-@VERSION@ -doc_DATA = LICENSE -## Subdirectories list -SUBDIRS = interface src - -## Default flags to run aclocal -ACLOCAL_AMFLAGS = -I project - -stage: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target="install"; \ - prefix_arg="@prefix@"; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target $$prefix_arg in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \ - fi; test -z "$$fail" - -distsrc: dist - mv $(distdir).tar.gz $(DISTTAR)/$(distdir)_src.tar.gz - -distbin: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target="install"; \ - tmpdistbin="$(WORKDIR)/dist_bin"; \ - prefix_arg="prefix=$$tmpdistbin"; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target $$prefix_arg in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \ - fi; test -z "$$fail"; \ - pushd $$tmpdistbin; \ - $(AMTAR) -zcf $(DISTTAR)/$(distdir)_bin.tar.gz .; \ - popd; \ - rm -rf $$tmpdistbin - diff --git a/org.glite.wms-utils.exception/bootstrap b/org.glite.wms-utils.exception/bootstrap deleted file mode 100755 index 168aca4..0000000 --- a/org.glite.wms-utils.exception/bootstrap +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/sh - -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -[ $# -ne 0 ] && ac_dir="-I $1" - -mkdir -p src/autogen -set -x -aclocal ${ac_dir} -I project -libtoolize --force -autoheader -automake --foreign --add-missing --copy -autoconf - diff --git a/org.glite.wms-utils.exception/build.xml b/org.glite.wms-utils.exception/build.xml deleted file mode 100755 index d12e8c2..0000000 --- a/org.glite.wms-utils.exception/build.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.wms-utils.exception/configure.ac b/org.glite.wms-utils.exception/configure.ac deleted file mode 100755 index 0ba6571..0000000 --- a/org.glite.wms-utils.exception/configure.ac +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# $Id$ - -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.57) -AC_INIT([org.glite.wms-utils.exception], [3.1.1]) -AC_CONFIG_AUX_DIR([./project]) -AM_INIT_AUTOMAKE([1.6.3 subdir-objects]) -AC_CONFIG_SRCDIR([src/Exception.cpp]) - -# Notices. -AC_COPYRIGHT([Copyright (c) 2004 The EU EGEE Project -See LICENCE file for details -]) -AC_REVISION([$Revision$]) - -# Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_PROG_LIBTOOL - -# Checks for libraries. - -# Checks for header files. - -# Checks for typedefs, structures, and compiler characteristics. - -# Checks for library functions. - -GLITE_BASE - -# Configuration items -AC_PREFIX_DEFAULT([/opt/glite]) -AM_CONFIG_HEADER([src/autogen/config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([src/Makefile]) -AC_CONFIG_FILES([interface/Makefile]) - -AC_OUTPUT - diff --git a/org.glite.wms-utils.exception/interface/Makefile.am b/org.glite.wms-utils.exception/interface/Makefile.am deleted file mode 100755 index 3c4ccb7..0000000 --- a/org.glite.wms-utils.exception/interface/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -exceptiondir = $(includedir) -nobase_exception_HEADERS = \ - glite/wmsutils/exception/exception_codes.h \ - glite/wmsutils/exception/Exception.h - -MAINTAINERCLEANFILES = Makefile.in diff --git a/org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h b/org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h deleted file mode 100644 index 19ca7c7..0000000 --- a/org.glite.wms-utils.exception/interface/glite/wmsutils/exception/Exception.h +++ /dev/null @@ -1,138 +0,0 @@ -#ifndef GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H -#define GLITE_WMS_UTILS_EXCEPTION_EXCEPTION_H - -/* - * Exception.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - * Contributors are mentioned in the code where appropriate. - */ - -#include -#include -//#include -#include // For logging exceptions to log file -#include // list the exception codes -#include -#include -#include // base ancestor stl::exception - - -namespace glite { - namespace wmsutils { - namespace exception { - -extern pthread_mutex_t METHOD_MUTEX; // used in order to store info into a file (rather then syslog) -#define GLITE_STACK_TRY(method_name) std::string METHOD = method_name ; int LINE = __LINE__ ; try { -#define GLITE_STACK_CATCH() } catch (glite::wmsutils::exception::Exception &exc){ exc.push_back ( __FILE__ , LINE, METHOD ); throw exc ; } catch (std::exception &ex){ glite::wmsutils::exception::Exception exc( __FILE__ , LINE, METHOD, 0, "Standard exception: " + std::string(ex.what()) ); throw exc; } - -/** - * The Exception base classe contains attributes into which are placed exception information and provides - * constructor that beyond the error code take parameters specifying the source file and line number - * (e.g. through __FILE__ and __LINE__) where the error has been generated and string messages, - * allowing an easy way of storing the origin of the exception. - * Moreover it provides methods for getting all the exception information and for logging them either - * in a log file or to the syslog daemon. - * Each of the derived types may contain its private attributes describing the actual error instance in detail. - * Moreover each exception has an attribute representing the exception identifier that is set by the - * class constructor and allows the identification of the original exception. - * - * @version 0.1 - * @date 22 July 2004 - * @author Alessandro Maraschini -*/ - -class Exception : public std::exception{ - public: - /** - * Constructor Update all mandatory fields - * @param method the name of the method that raised the exception - * @param source The source that raised the exception (could be the file path, the class Name, etc etc) - * @param exc the previous exception as in the stack trace */ - Exception ( const std::string& source, const std::string& method, Exception *exc); - /** - * Constructor Update all mandatory fields - * @param code the code representing the thrown exception - * @param exception the name of the thrown exception - * @param method the name of the method that raised the exception - * @param source The source that raised the exception (could be the file path, the class Name, etc etc) */ - Exception ( const std::string& source, const std::string& method, int code, const std::string& exception); - - /** - * Constructor Update all mandatory fields - * @param source the path of the file that raised the exception - * @param line_number the number of the line in the file that raised the exception - * @param method the name of the method that raised the exception - * @param code the code representing the thrown exception - * @param exception the name of the thrown exception */ - Exception (const std::string& source, int line_number, const std::string& method, int code, const std::string& exception); - /** - * Default Destructor - */ - virtual ~Exception() throw (); - /** - * Return a string debug message containing information about Exception thrown - * Debug message contains all the attributes stored in an exception instance such as the method, the file and the line - * that threw the exception. - *@return the debug message string representation - */ - virtual std::string dbgMessage(); - /** - * Return the error code - * @return The integer representing the code of the error that generated the exception - */ - virtual int getCode(); - - /** - * return the Error Message associated to the Exception - * @return The Exception string message representation - */ - virtual const char* what() const throw (); - - /** - * Print Exception error information into a log file - * @param logfile the file where to log exception information - */ - virtual void log(const std::string& logfile = ""); - /** - * Retrieve the Exception name - * @return the name of the Exception thrown - */ - virtual std::string getExceptionName(); - - /** - * Retrieve the Stack of the exception as a list of previous generated exceptions - *@return the string representation of the stack trace: each line correspond to an exception message - */ - virtual std::string printStackTrace() ; - /** - * Return the list of methods that caused the Exception - */ - virtual std::vector getStackTrace() ; - /** - * Update stack information - */ - virtual void push_back ( const std::string& source, int line_number, const std::string& method ) ; - protected: - /** Empty constructor*/ - Exception(); - /** integer error code representing the cause of the error */ - int error_code; - /** string exception message representation*/ - std::string error_message ; - /** line number where the exception was raised */ - int line; - /** The name of the file where the exception was raised */ - std::string source_file; - /** the name of the exception */ - std::string exception_name; - /** the name of the method where the expceiton was raised */ - std::string method_name ; - /** a string representation of the stacktrace */ - std::string stack; - /** the actual internal stacktrace representation */ - std::vector< std::string> stack_strings ; - /** the name of the ancestor exception */ - std::string ancestor ; -}; //End Exception Class -}}} // Closing namespace -#endif diff --git a/org.glite.wms-utils.exception/interface/glite/wmsutils/exception/exception_codes.h b/org.glite.wms-utils.exception/interface/glite/wmsutils/exception/exception_codes.h deleted file mode 100755 index fce99aa..0000000 --- a/org.glite.wms-utils.exception/interface/glite/wmsutils/exception/exception_codes.h +++ /dev/null @@ -1,41 +0,0 @@ -#ifndef GLITE_WMSUTILS_EXCEPTION_CODES_H -#define GLITE_WMSUTILS_EXCEPTION_CODES_H -// pure C-style code (needed by some libraries) -#define GLITE_WMS_COMMON_ERROR_BASE 900 -#define GLITE_WMS_USERINTERFACE_ERROR_BASE 1000 -#define GLITE_WMS_NETWORKSERVER_ERROR_BASE 1200 -#define GLITE_WMS_SOCKET_ERROR_BASE 1300 -#define GLITE_WMS_LDAP_ERROR_BASE 1350 -#define GLITE_WMS_LOGGING_ERROR_BASE 1400 -#define GLITE_WMS_REQUESTAD_ERROR_BASE 1500 -#define GLITE_WMS_CHECKPOINT_ERROR_BASE 1600 -#define GLITE_WMS_CONFIGURATION_ERROR_BASE 1800 -#ifdef __cplusplus -namespace glite { -namespace wmsutils { -namespace exception { - /** - * The Error Code - */ - enum { - WMS_COMMON_BASE = GLITE_WMS_COMMON_ERROR_BASE, - THREAD_INIT , // pthread_attr_init method failed - THREAD_DETACH , // pthread_attr_setdetachstate method failed - THREAD_CREATE , // pthread_create method failed - THREAD_JOIN, - THREAD_SSL, - WMS_FATAL_ERROR, - WMS_UI_ERROR_BASE = GLITE_WMS_USERINTERFACE_ERROR_BASE, - WMS_NS_ERROR_BASE = GLITE_WMS_NETWORKSERVER_ERROR_BASE, - WMS_SOCKET_ERROR_BASE = GLITE_WMS_SOCKET_ERROR_BASE, - WMS_LDAP_ERROR_BASE = GLITE_WMS_LDAP_ERROR_BASE, - WMS_LB_ERROR_BASE = GLITE_WMS_LOGGING_ERROR_BASE , - WMS_REQUESTAD_ERROR_BASE = GLITE_WMS_REQUESTAD_ERROR_BASE, - WMS_CHKPT_ERROR_BASE = GLITE_WMS_CHECKPOINT_ERROR_BASE, - WMS_CONFIGURATION_ERROR_BASE = GLITE_WMS_CONFIGURATION_ERROR_BASE - }; -} // exception namespace -} // wmsutils namespace -} // glite namespace -#endif //ifdef c++ -#endif diff --git a/org.glite.wms-utils.exception/project/build.number b/org.glite.wms-utils.exception/project/build.number deleted file mode 100644 index 95bc38e..0000000 --- a/org.glite.wms-utils.exception/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Sat Oct 15 02:08:14 CEST 2005 -module.build=154 diff --git a/org.glite.wms-utils.exception/project/build.properties b/org.glite.wms-utils.exception/project/build.properties deleted file mode 100755 index f4aef51..0000000 --- a/org.glite.wms-utils.exception/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -build.package.summary="files for gLite wms utils exception" -build.package.description="exception api" diff --git a/org.glite.wms-utils.exception/project/configure.properties.xml b/org.glite.wms-utils.exception/project/configure.properties.xml deleted file mode 100644 index 04d3b17..0000000 --- a/org.glite.wms-utils.exception/project/configure.properties.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/org.glite.wms-utils.exception/project/properties.xml b/org.glite.wms-utils.exception/project/properties.xml deleted file mode 100755 index 1e49af0..0000000 --- a/org.glite.wms-utils.exception/project/properties.xml +++ /dev/null @@ -1,83 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.wms-utils.exception/project/version.properties b/org.glite.wms-utils.exception/project/version.properties deleted file mode 100755 index 40c3916..0000000 --- a/org.glite.wms-utils.exception/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=3.1.1 -module.age=1 diff --git a/org.glite.wms-utils.exception/src/Exception.cpp b/org.glite.wms-utils.exception/src/Exception.cpp deleted file mode 100644 index 546f253..0000000 --- a/org.glite.wms-utils.exception/src/Exception.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/* ************************************************************************** -* filename : Exceptions.cpp -* author : Alessandro Maraschini -* copyright : (C) 2002 by DATAMAT -***************************************************************************/ - -#include "glite/wmsutils/exception/Exception.h" -#include "glite/wmsutils/exception/exception_codes.h" - -namespace glite { -namespace wmsutils{ -namespace exception { -using namespace std ; -pthread_mutex_t METHOD_MUTEX ; // This mutex is used in order to lock the file for writing log infornation - -/* ********************************* -* Exception Class Implementation -************************************/ -//Constructor/Destructor - -Exception::Exception () { - line = 0; -}; - -Exception::~Exception() throw(){ } - -/** -* Exception chainig -*/ -void Exception::push_back (const string& source, int line_number, const string& method){ - stack_strings.push_back (dbgMessage()); - ancestor = what(); - source_file = source; - line = line_number; - method_name = method; - error_message = ""; - exception_name = ""; -} - -Exception::Exception( const std::string& file, int line_number, const std::string& method, int code, const std::string& name) - : error_code(code), exception_name(name){ - source_file = file; - line = line_number; - method_name = method; -}; - -Exception::Exception (const string& source, const string& method, int code, const string& exception) - : error_code(code), exception_name(exception){ - source_file = source; - method_name = method; - // stack= ""; - line = 0; -}; - -int Exception::getCode(){ - if (error_code != 0) return error_code; - else - return WMS_COMMON_BASE; -}; - -const char* Exception::what() const throw(){ - if (!ancestor.empty()) return ancestor.c_str(); - - return error_message.c_str(); -}; - -string Exception::getExceptionName(){ - return exception_name; -}; - -void Exception::log(const std::string& logfile) -{ - if (logfile == "") - syslog (LOG_PERROR, (char *)(dbgMessage()).c_str()); - else{ - pthread_mutex_lock( &METHOD_MUTEX); // LOCK - //TBD : test if file exist-->>Create HEADER ?? - ofstream fout ((char *) logfile.c_str() , ios::app ); //Open the file for writing (if it doesn't exist then it will be created) - fout << "\n" << dbgMessage() ; //write (append) the message - fout.close(); //close the file - pthread_mutex_unlock( &METHOD_MUTEX); // UNLOCK - } -}; - -string Exception::printStackTrace(){ - string stack = "" ; - for (unsigned int i = 0 ; i < stack_strings.size() ; i++ ){ - stack+=stack_strings[i] +"\n" ; - } - return stack +dbgMessage(); -}; - -vector Exception::getStackTrace(){ - // make a copy of the stack - vector stack = stack_strings ; - stack.push_back(dbgMessage()) ; - return stack; -}; - -string Exception::dbgMessage(){ - string result ; - //Adding exception Name - result = exception_name; - - //Adding error msg - if (error_message!="") result +=": " + string(what()); - - if (result != "") result+="\n"; - - //Adding Source - result +="\tat " + method_name +"[" +source_file; - - //Adding line number - if (line!=0){ - char buffer [1024] ; - sprintf (buffer, "%i" , line) ; - result += ":" + string ( buffer ); - } - result +="]" ; - return result; -} - -}}} // Closing namespace - diff --git a/org.glite.wms-utils.exception/src/Makefile.am b/org.glite.wms-utils.exception/src/Makefile.am deleted file mode 100755 index 0c5caac..0000000 --- a/org.glite.wms-utils.exception/src/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -lib_LTLIBRARIES = libglite_wmsutils_exception.la - -libglite_wmsutils_exception_la_SOURCES = \ - Exception.cpp - -AM_CPPFLAGS = -I$(top_srcdir)/interface \ - -I$(top_srcdir)/src - -MAINTAINERCLEANFILES = Makefile.in *.*~ diff --git a/org.glite.wms-utils.exception/test/Makefile.am b/org.glite.wms-utils.exception/test/Makefile.am deleted file mode 100755 index a972450..0000000 --- a/org.glite.wms-utils.exception/test/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -EXCEPTION_LIBS = $(top_builddir)/src/libglite_wmsutils_exception.la - -TESTS = glite-wmsutils-exception - -check_PROGRAMS = $(TESTS) - -glite_wmsutils_exception_SOURCES = exception_cu_suite.cpp \ - exception_cu_suite.h \ - exception_cu_main.cpp - -glite_wmsutils_exception_LDADD = \ - $(GLITE_WMSUTILS_EXCEPTION_LIBS) \ - $(GLOBUS_GSS_THR_LIBS) \ - $(EXCEPTION_LIBS) \ - $(CPPUNIT_LIBS) - -AM_CPPFLAGS = \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/test \ - $(GLITE_CFLAGS) \ - $(GLOBUS_THR_CFLAGS) \ - $(CPPUNIT_CFLAGS) - -MAINTAINERCLEANFILES = Makefile.in *~ - diff --git a/org.glite.wms-utils.exception/test/exception_cu_main.cpp b/org.glite.wms-utils.exception/test/exception_cu_main.cpp deleted file mode 100644 index 182df4c..0000000 --- a/org.glite.wms-utils.exception/test/exception_cu_main.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -#include "exception_cu_suite.h" - -#include -#include -#include -#include -#include - -using namespace CppUnit; -using namespace std; - -int main (int argc , char** argv) -{ - std::ofstream xml("./cppUnit_output.xml",ios::app); - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - TestRunner runner; - runner.addTest(Exception_test::suite()); - runner.run(controller); - - CppUnit::XmlOutputter outputter( &result, xml ); - CppUnit::TextOutputter outputter2( &result, std::cerr ); - outputter.write(); - outputter2.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} diff --git a/org.glite.wms-utils.exception/test/exception_cu_suite.cpp b/org.glite.wms-utils.exception/test/exception_cu_suite.cpp deleted file mode 100644 index f749af9..0000000 --- a/org.glite.wms-utils.exception/test/exception_cu_suite.cpp +++ /dev/null @@ -1,56 +0,0 @@ -#include "exception_cu_suite.h" -#include "glite/wmsutils/exception/Exception.h" -#include -#include - -using namespace CppUnit; -using namespace std; -using namespace glite::wmsutils::exception; - -void Exception_test::setUp() -{} - -void Exception_test::tearDown() -{} - - -void Exception_test::constructor_case() -{ - - //constructor class name, line number, method name, code, exception name - glite::wmsutils::exception::Exception exc_5("TEST_Class", 3, "test_method", 1, "exception_test"); - - //constructor class name, method name, code, exception name - glite::wmsutils::exception::Exception exc_4("TEST_Class", "test_method", 1, "exception_test"); - - CPPUNIT_ASSERT(exc_5.getExceptionName() == "exception_test"); - CPPUNIT_ASSERT(exc_5.getCode() == 1); -} - -void Exception_test::tostring_case() -{ - cout<<"TEST TO STRING METHODS"< msgvec = exc_5.getStackTrace(); - - for (int i=0; i -#include -#include - -#include - - -class Exception_test : public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(Exception_test); - CPPUNIT_TEST(constructor_case); - CPPUNIT_TEST(tostring_case); - CPPUNIT_TEST(stackTrace_case); - CPPUNIT_TEST_SUITE_END(); - - -public: - - void setUp(); - void tearDown(); - - void constructor_case(); - void tostring_case(); - void stackTrace_case(); - -}; - - - diff --git a/org.glite.wms-utils.jobid/.cvsignore b/org.glite.wms-utils.jobid/.cvsignore deleted file mode 100755 index 1df717b..0000000 --- a/org.glite.wms-utils.jobid/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -.project -.cdtproject \ No newline at end of file diff --git a/org.glite.wms-utils.jobid/LICENSE b/org.glite.wms-utils.jobid/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.wms-utils.jobid/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.wms-utils.jobid/Makefile.am b/org.glite.wms-utils.jobid/Makefile.am deleted file mode 100755 index bf956e1..0000000 --- a/org.glite.wms-utils.jobid/Makefile.am +++ /dev/null @@ -1,69 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -## Process this file with automake to produce Makefile.in - -EXTRA_DIST = LICENSE - -docdir = $(datadir)/doc/@PACKAGE@-@VERSION@ -doc_DATA = LICENSE - -## Subdirectories list -SUBDIRS = interface src examples - -## Default flags to run aclocal -ACLOCAL_AMFLAGS = -I project - -stage: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target="install"; \ - prefix_arg="@prefix@"; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target $$prefix_arg in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \ - fi; test -z "$$fail" - -distsrc: dist - mv $(distdir).tar.gz $(DISTTAR)/$(distdir)_src.tar.gz - -distbin: - @set fnord $(MAKEFLAGS); amf=$$2; \ - dot_seen=no; \ - target="install"; \ - tmpdistbin="$(WORKDIR)/dist_bin"; \ - prefix_arg="prefix=$$tmpdistbin"; \ - list='$(SUBDIRS)'; for subdir in $$list; do \ - echo "Making $$target $$prefix_arg in $$subdir"; \ - if test "$$subdir" = "."; then \ - dot_seen=yes; \ - local_target="$$target-am"; \ - else \ - local_target="$$target"; \ - fi; \ - (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target $$prefix_arg) \ - || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \ - done; \ - if test "$$dot_seen" = "no"; then \ - $(MAKE) $(AM_MAKEFLAGS) "$$target-am" $$prefix_arg || exit 1; \ - fi; test -z "$$fail"; \ - pushd $$tmpdistbin; \ - $(AMTAR) -zcf $(DISTTAR)/$(distdir)_bin.tar.gz .; \ - popd; \ - rm -rf $$tmpdistbin - diff --git a/org.glite.wms-utils.jobid/bootstrap b/org.glite.wms-utils.jobid/bootstrap deleted file mode 100755 index ceeb099..0000000 --- a/org.glite.wms-utils.jobid/bootstrap +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/sh - -mkdir -p src/autogen -set -x -aclocal -I project -libtoolize --force -autoheader -automake --foreign --add-missing --copy -autoconf diff --git a/org.glite.wms-utils.jobid/build.xml b/org.glite.wms-utils.jobid/build.xml deleted file mode 100755 index 44c110c..0000000 --- a/org.glite.wms-utils.jobid/build.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.wms-utils.jobid/configure.ac b/org.glite.wms-utils.jobid/configure.ac deleted file mode 100755 index e255849..0000000 --- a/org.glite.wms-utils.jobid/configure.ac +++ /dev/null @@ -1,147 +0,0 @@ -# -# Copyright (c) 2004 on behalf of the EU EGEE Project: -# The European Organization for Nuclear Research (CERN), -# Istituto Nazionale di Fisica Nucleare (INFN), Italy -# Datamat Spa, Italy -# Centre National de la Recherche Scientifique (CNRS), France -# CS Systeme d'Information (CSSI), France -# Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -# Universiteit van Amsterdam (UvA), Netherlands -# University of Helsinki (UH.HIP), Finland -# University of Bergen (UiB), Norway -# Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom -# -# Common configure.ac file for the GLite WMS Common module -# -# Authors: Alberto Di Meglio -# Version info: $Id$ -# Release: $Name$ -# -# Revision history: -# $Log$ -# Revision 1.19 2006/03/20 15:30:43 eronchie -# Increased version -# -# Revision 1.18 2005/10/15 07:55:00 eronchie -# Increased version -# -# Revision 1.17 2005/09/20 10:41:49 eronchie -# Started merging with rc1.4 -# -# Revision 1.16 2004/12/10 07:33:42 eronchie -# Increased version -# -# Revision 1.15 2004/11/16 15:35:22 eronchie -# Increased version -# -# Revision 1.14 2004/11/16 15:15:45 eronchie -# Increased version -# -# Revision 1.13 2004/09/22 00:25:17 glbuild -# Fixed missing parenthesis -# -# Revision 1.12 2004/09/21 19:22:09 glbuild -# modified module.version -# -# Revision 1.11 2004/08/17 13:46:28 eronchie -# Added interface -# -# Revision 1.10 2004/08/17 13:41:20 eronchie -# Moved out JobIdExceptions.h cjobid.h JobId.h -# Put in interface/glite/wmsutils/jobid -# -# Revision 1.9 2004/08/17 10:40:34 eronchie -# Added optimize option -# -# Revision 1.8 2004/07/27 09:14:19 eronchie -# Removed AC_WMSUTILS_EXCEPTION and AC_GLOBUS_SSL_UTILS checks -# Set directly exception library macro -# -# Revision 1.7 2004/07/21 17:53:36 eronchie -# Moved out org.glite.wms.jobid from org.glite.wms and put in org.glite.wms-utils -# -# -# - -# Process this file with autoconf to produce a configure script. - -AC_PREREQ(2.57) -AC_INIT([GLite WMS Utils Jobid], [3.1.1]) -AC_CONFIG_AUX_DIR([./project]) -AM_INIT_AUTOMAKE([1.6.3 subdir-objects]) -AC_CONFIG_SRCDIR([src/jobid/strmd5.h]) - -# Notices. -AC_COPYRIGHT([Copyright (c) 2004 The EU EGEE Project -See LICENCE file for details -]) -AC_REVISION([$Revision$]) - -#Environment. -WORKDIR=`pwd` -AC_SUBST(WORKDIR) - -# Checks for programs. -AC_PROG_CC -AC_PROG_CPP -AC_PROG_CXX -AC_PROG_CXXCPP -AM_PROG_CC_C_O -AC_PROG_LIBTOOL - -# Checks for libraries. - -# Checks for header files. -AC_CHECK_HEADERS([fcntl.h mntent.h sys/vfs.h syslog.h unistd.h]) - -# Checks for typedefs, structures, and compiler characteristics. -AC_HEADER_STDBOOL -AC_C_CONST -AC_C_INLINE -AC_TYPE_OFF_T -AC_TYPE_SIZE_T -AC_CHECK_MEMBERS([struct stat.st_rdev]) -AC_TYPE_UID_T -AC_CHECK_TYPES([ptrdiff_t]) - -# Checks for library functions. -AC_HEADER_STDC -AC_FUNC_ERROR_AT_LINE -AC_FUNC_GETMNTENT -AC_FUNC_MEMCMP -AC_FUNC_STAT -AC_FUNC_STRFTIME -AC_FUNC_VPRINTF -AC_CHECK_FUNCS([bzero endpwent ftruncate getmntent memset mkdir pow strerror strtol]) - -have_globus=no - -AC_GLOBUS([], have_globus=yes, have_globus=no) -AC_MSG_RESULT(["GLOBUS found $have_globus"]) - -if test "$have_globus" = "no"; then - AC_MSG_RESULT(["Please verify GLOBUS package"]) -fi - -if test "$have_globus" = "no"; then - AC_MSG_ERROR([Cannot continue building]) -fi -AC_GLITE - -GLITE_WMSUTILS_EXCEPTION_LIBS="-L$GLITE_LOCATION/lib -lglite_wmsutils_exception" - -AC_SUBST(GLITE_WMSUTILS_EXCEPTION_LIBS) - -AC_OPTIMIZE - -# Configuration items -AC_PREFIX_DEFAULT([/opt/glite]) -AM_CONFIG_HEADER([src/autogen/config.h]) -AC_CONFIG_FILES([Makefile]) -AC_CONFIG_FILES([examples/Makefile]) -AC_CONFIG_FILES([interface/Makefile]) -AC_CONFIG_FILES([src/Makefile]) -AC_CONFIG_FILES([src/jobid/Makefile]) - -AC_OUTPUT - diff --git a/org.glite.wms-utils.jobid/examples/Makefile.am b/org.glite.wms-utils.jobid/examples/Makefile.am deleted file mode 100755 index fa9a407..0000000 --- a/org.glite.wms-utils.jobid/examples/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -STDCPP = -lstdc++ - -JOBID = $(top_builddir)/src/jobid/libglite_wmsutils_cjobid.la - -check_PROGRAMS = testjobid - -testjobid_SOURCES = testjobid.c -testjobid_LDADD = \ - $(JOBID) \ - $(GLITE_WMSUTILS_EXCEPTION_LIBS) \ - $(GLOBUS_SSL_THR_LIBS) \ - $(STDCPP) - -AM_CPPFLAGS = -I$(top_srcdir)/src \ - -I$(top_srcdir)/interface \ - $(GLITE_CFLAGS) \ - $(GLOBUS_THR_CFLAGS) - -MAINTAINERCLEANFILES = Makefile.in *~ - diff --git a/org.glite.wms-utils.jobid/examples/testjobid.c b/org.glite.wms-utils.jobid/examples/testjobid.c deleted file mode 100755 index 56f6cba..0000000 --- a/org.glite.wms-utils.jobid/examples/testjobid.c +++ /dev/null @@ -1,33 +0,0 @@ -/* test code for jobid routines */ - -#include -#include - -#include "glite/wmsutils/jobid/cjobid.h" - -int main(int argc, char* argv[]) -{ - char* ju; - char* bkserver = "ujsa.uhjs"; - - edg_wlc_JobId ji = 0; - edg_wlc_JobId ji2 = 0; - - int r = edg_wlc_JobIdCreate(bkserver, 0, &ji); - printf("Create: %d\n", r); - - ju = edg_wlc_JobIdUnparse(ji); - printf("Unparse: %s\n", ju); - - edg_wlc_JobIdParse(ju, &ji2); - free(ju); - - ju = edg_wlc_JobIdUnparse(ji); - printf("Unparse2: %s\n", ju); - free(ju); - - edg_wlc_JobIdFree(ji); - edg_wlc_JobIdFree(ji2); - - return 0; -} diff --git a/org.glite.wms-utils.jobid/interface/Makefile.am b/org.glite.wms-utils.jobid/interface/Makefile.am deleted file mode 100755 index 8737f19..0000000 --- a/org.glite.wms-utils.jobid/interface/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -jobiddir = $(includedir) -nobase_jobid_HEADERS = \ - glite/wmsutils/jobid/cjobid.h \ - glite/wmsutils/jobid/manipulation.h \ - glite/wmsutils/jobid/JobIdExceptions.h \ - glite/wmsutils/jobid/JobId.h - -MAINTAINERCLEANFILES = Makefile.in diff --git a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h b/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h deleted file mode 100755 index 8d0b7b4..0000000 --- a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobId.h +++ /dev/null @@ -1,126 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_JOBID_H -#define GLITE_WMSUTILS_JOBID_JOBID_H - -/* - * JobId.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - * - */ - -#include -#include - -#include "glite/wmsutils/jobid/cjobid.h" - -typedef struct _edg_wlc_jobid_s* edg_wlc_jobid_t; - -namespace glite { -namespace wmsutils { -namespace jobid { - -/** - * Managing Identification, checking, retreiving info from a job - * File name: JobId.h - * The JobId class provides a representation of the Datagrid job identifier - * (dg_jobId) and the methods for manipulating it. - * We remind that the format of the dg_jobId is as follows: - * :/ - * - * @ingroup common - * @version 0.1 - * @date 15 April 2002 - * @author Alessandro Maraschini */ - -class JobId { -public: - /**@name Constructors/Destructor */ - //@{ - /** Instantiates an empty JobId object */ - JobId() ; - /** - * Instantiates a JobId object from the passed dg_jobId in string format. - * @param job_id_string a string representig a classAd expression - * @throws WrongIdException When a string is passed in a wrong format - */ - JobId(const std::string& job_id_string); - JobId(const JobId&); - JobId(const edg_wlc_JobId&); - /** - * Destructor - * Destroy the Job Id instance - */ - ~JobId() ; - //@} - - /**@name Miscellaneous */ - //@{ - /** Unsets the JobId instance. Clear all it's memebers */ - void clear() ; - /** - * Check wheater the jobId has been already created (true) or not (false) - *@return true (jobId created) or false (jobId not yet created) - */ - bool isSet() { return ( m_JobId != 0 ) ; } - /** - * Set the JobId instance according to the LB and RB server addresses and the unique string passed as input parameters. - * @param lb_server Loggin and Bookkeeping server address - * @param port Loggin and Bookkeeping port ( dafault value is 9000 ) - * @param unique A Unique identification ( automatically generatad by md5 protocol ) - * @throws WrongIdException When one parameter has been passed in a wrong format */ - void setJobId(const std::string& lb_server, int port = 0, const std::string& unique = ""); - //@} - /**@name Get Methods */ - //@{ - /** @return the LB address into its string format - * @throws EmptyIdException If the jobId has not been initialised yet */ - std::string getServer() const; - /** @return the Unique string into its string format - * @throws EmptyIdException If the jobId has not been initialised yet */ - std::string getUnique() const; - //@} - /** This method sets the JobId instance from the JobId in string format given - * as input. - * @param dg_JobId the string representing the job - * @throws WrongIdException When a string is passed in a wrong format */ - void fromString ( const std::string& dg_JobId ); - /** Converts the jobId into a string - @return the string representation of a JobId*/ - std::string toString() const; - /** casting operator */ - operator const edg_wlc_JobId() const { return m_JobId; } - /** Operator "=" create a deep copy of the JobId instance*/ - JobId & operator=(JobId const &); - /** Operator "=" create a deep copy of the JobId instance*/ - JobId & operator=(const edg_wlc_JobId &); - /** Retrieve the internal id reference - *@return the JobId internal reference used by some LB methods */ - edg_wlc_JobId getId() const ; -private: - // This Variable stores the Job unique identification String - edg_wlc_JobId m_JobId; - mutable char* m_pStr; - mutable char* m_pBkserver; - mutable char* m_pUnique; - /** Operator "<"*/ - friend bool operator<(JobId const& lhs, JobId const& rhs); - /** Operator "=="*/ - friend bool operator==(JobId const& lhs, JobId const& rhs); -}; - -inline bool operator<(JobId const& lhs, JobId const& rhs) -{ - return strcmp ( lhs.m_pStr , rhs.m_pStr ) <0 ; -} - -inline bool operator==(JobId const& lhs, JobId const& rhs) -{ -return strcmp ( lhs.m_pStr , rhs.m_pStr ) ==0 ; -} - -std::ostream& operator<<(std::ostream& os, JobId const& id); - -} // namespace jobid -} // namespace wmsutils -} // namespace glite - -#endif // GLITE_WMSUTILS_JOBID_JOBID_H diff --git a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobIdExceptions.h b/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobIdExceptions.h deleted file mode 100755 index cd414e1..0000000 --- a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/JobIdExceptions.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_EXCEPTIONS_H -#define GLITE_WMSUTILS_JOBID_EXCEPTIONS_H - -/* - * JobIdExceptions.h - * Copyright (c) 2001 The European Datagrid Project - IST programme, all rights reserved. - */ - -#include "glite/wmsutils/exception/Exception.h" - -namespace glite { -namespace wmsutils { -namespace jobid { - -/** - * JobIdException - Exception thrown by JobId Class - * @ingroup Common - * @version 0.1 - * @date 15 April 2002 - * @author Alessandro Maraschini -*/ - -class JobIdException : public glite::wmsutils::exception::Exception { -public: - /** - * Update all mandatory Exception Information - */ - JobIdException (const std::string& file, - int line, - const std::string& method, - int code, - const std::string& exception_name) ; -};//End CLass JobIdException - -/** -* WrongIdFieldException -* This Exception is thrown when a Job Id syntax error is found -* A valid Job Identification string should be made as follows: -* :/ */ -class WrongIdException : public JobIdException { -public: - /** - * Constructor - * @param file - The source file which has generated the Exception - * @param line - The line number in the source file where the Exception has been thrown - * @param method - The Name of the method which has thrown the Exception - * @param code - The Code of the Error raised - * @param field - The wrong expression catched */ - WrongIdException(const std::string& file, - int line, - const std::string& method, - int code ); -}; //End CLass WrongIdException -/** -* EmptyIdException -* This Exception is thrown when the user tries to get information from a JobId -* which has not been initialized yet, i.e tries to use the get Methods -*/ -class EmptyIdException : public JobIdException { -public: - /** - * Constructor - * @param file - The source file which has generated the Exception - * @param line - The line number in the source file where the Exception has been thrown - * @param method - The Name of the method which has thrown the Exception - * @param code - The Code of the Error raised - * @param field - The Empty filed requested for */ - EmptyIdException(const std::string& file, - int line, - const std::string& method, - int code , - const std::string& field ); -}; //End CLass EmptyIdException - -} // namespace jobid -} // namespace wmsutils -} // namespace glite - -#endif // GLITE_WMSUTILS_JOBID_EXCEPTIONS_H - diff --git a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/cjobid.h b/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/cjobid.h deleted file mode 100755 index e8f84f5..0000000 --- a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/cjobid.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _GLITE_JOBID_H -#define _GLITE_JOBID_H - -/*! - * \file cjobid.h - * \brief L&B consumer API - */ - -#ident "$Header$" - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct _edg_wlc_JobId *edg_wlc_JobId; - -#define GLITE_WMSC_JOBID_DEFAULT_PORT 9000 /**< Default port where bookkeeping server listens */ -#define GLITE_WMSC_JOBID_PROTO_PREFIX "https://" /**< JobId protocol prefix */ - - -/* All the pointer functions return malloc'ed objects (or NULL on error) */ - -/** - * Create a Job ID. - * See the lb_draft document for details on its construction and components - * \param bkserver book keeping server hostname - * \param port port for the bk service - * \param jobid new created job id - * \ret al 0 success - * \retval EINVAL invalid bkserver - * \retval ENOMEM if memory allocation fails - */ -int edg_wlc_JobIdCreate(const char * bkserver, int port, edg_wlc_JobId * jobid); - -/** - * Recreate a Job ID - * \param bkserver bookkeeping server hostname - * \param port port for the bk service - * \param unique string which represent created jobid (if NULL then new - * one is created) - * \param jobid new created job id - * \retval 0 success - * \retval EINVAL invalid bkserver - * \retval ENOMEM if memory allocation fails - */ -int edg_wlc_JobIdRecreate(const char *bkserver, int port, const char * unique, edg_wlc_JobId * jobid); - -/** - * Create copy of Job ID - * \param in jobid for duplication - * \param jobid duplicated jobid - * \retval 0 for success - * \retval EINVAL invalid jobid - * \retval ENOMEM if memory allocation fails - */ -int edg_wlc_JobIdDup(const edg_wlc_JobId in, edg_wlc_JobId * jobid); - -/* - * Free jobid structure - * \param jobid for dealocation - */ -void edg_wlc_JobIdFree(edg_wlc_JobId jobid); - -/** - * Parse Job ID string and creates jobid structure - * \param jobidstr string representation of jobid - * \param jobid parsed job id - * \retval 0 for success - * \retval EINVAL jobidstr can't be parsed - * \retval ENOMEM if memory allocation fails - */ -int edg_wlc_JobIdParse(const char* jobidstr, edg_wlc_JobId * jobid); - -/** - * Unparse Job ID (produce the string form of JobId). - * \param jobid to be converted to string - * \return allocated string which represents jobid - */ -char* edg_wlc_JobIdUnparse(const edg_wlc_JobId jobid); - -/** - * Extract bookkeeping server address (address:port) - * \param jobid from which the bkserver address should be extracted - * \retval pointer to allocated string with bkserver address - * \retval NULL if jobid is 0 or memory allocation fails - */ -char* edg_wlc_JobIdGetServer(const edg_wlc_JobId jobid); - -/** - * Extract bookkeeping server address and port - * \param jobid from which the bkserver address should be extracted - * \param srvName pointer where to return server name - * \param srvPort pointer where to return server port - * */ -void edg_wlc_JobIdGetServerParts(const edg_wlc_JobId jobid, char **srvName, unsigned int *srvPort); - -/** - * Extract unique string - * \param jobid - * \retval pointer to allocated unique string representing jobid - * \retval NULL if jobid is 0 or memory allocation fails - */ -char* edg_wlc_JobIdGetUnique(const edg_wlc_JobId jobid); - -#ifdef __cplusplus -} -#endif - -#endif /* _GLITE_JOBID_H */ diff --git a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/manipulation.h b/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/manipulation.h deleted file mode 100755 index 9f862ae..0000000 --- a/org.glite.wms-utils.jobid/interface/glite/wmsutils/jobid/manipulation.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef GLITE_WMSUTILS_JOBID_MANIPULATION_H -#define GLITE_WMSUTILS_JOBID_MANIPULATION_H - -#include - -namespace glite { -namespace wmsutils { -namespace jobid { - -class JobId; - -std::string get_reduced_part( const JobId &id, int level = 0 ); -std::string to_filename( const JobId &id ); -JobId from_filename( const std::string &filename ); - -} // namespace jobid -} // namespace wmsutils -} // namespace glite - -#endif /* GLITE_WMSUTILS_JOBID_MANIPULATION_H */ - -// Local Variables: -// mode: c++ -// End: diff --git a/org.glite.wms-utils.jobid/project/build.number b/org.glite.wms-utils.jobid/project/build.number deleted file mode 100644 index 1acc27a..0000000 --- a/org.glite.wms-utils.jobid/project/build.number +++ /dev/null @@ -1,2 +0,0 @@ -#Sat Oct 15 02:12:40 CEST 2005 -module.build=152 diff --git a/org.glite.wms-utils.jobid/project/build.properties b/org.glite.wms-utils.jobid/project/build.properties deleted file mode 100755 index f5a9095..0000000 --- a/org.glite.wms-utils.jobid/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -build.package.summary="files for gLite wms utils jobid" -build.package.description="jobid api" diff --git a/org.glite.wms-utils.jobid/project/configure.properties.xml b/org.glite.wms-utils.jobid/project/configure.properties.xml deleted file mode 100644 index 04d3b17..0000000 --- a/org.glite.wms-utils.jobid/project/configure.properties.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/org.glite.wms-utils.jobid/project/properties.xml b/org.glite.wms-utils.jobid/project/properties.xml deleted file mode 100755 index 9662658..0000000 --- a/org.glite.wms-utils.jobid/project/properties.xml +++ /dev/null @@ -1,86 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.glite.wms-utils.jobid/project/version.properties b/org.glite.wms-utils.jobid/project/version.properties deleted file mode 100755 index 40c3916..0000000 --- a/org.glite.wms-utils.jobid/project/version.properties +++ /dev/null @@ -1,2 +0,0 @@ -module.version=3.1.1 -module.age=1 diff --git a/org.glite.wms-utils.jobid/src/Makefile.am b/org.glite.wms-utils.jobid/src/Makefile.am deleted file mode 100755 index 5225c64..0000000 --- a/org.glite.wms-utils.jobid/src/Makefile.am +++ /dev/null @@ -1,12 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -## Subdirectories list -SUBDIRS = jobid - -MAINTAINERCLEANFILES = Makefile.in diff --git a/org.glite.wms-utils.jobid/src/jobid/JobId.cpp b/org.glite.wms-utils.jobid/src/jobid/JobId.cpp deleted file mode 100755 index 273f9f9..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/JobId.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* ************************************************************************** - * filename : JobId.cpp - * author : Alessandro Maraschini - * copyright : (C) 2002 by DATAMAT - ***************************************************************************/ - -#include "glite/wmsutils/jobid/JobId.h" - -#include - -#include "glite/wmsutils/jobid/JobIdExceptions.h" - -namespace glite { -namespace wmsutils { -namespace jobid { - -using namespace std ; - -/****************************************************************** - Constructor / Destructor - *******************************************************************/ -JobId::JobId() : m_JobId( 0 ), m_pStr( 0 ), m_pBkserver( 0 ), m_pUnique( 0 ) -{ -} - -JobId::JobId(const std::string& job_id_string ) - : m_JobId( 0 ), m_pStr( 0 ), m_pBkserver( 0 ), m_pUnique( 0 ) -{ - fromString( job_id_string ) ; -} - -JobId::JobId(const JobId &old) -{ - edg_wlc_JobIdDup(old.m_JobId,&m_JobId); - m_pStr = old.m_pStr ? strdup(old.m_pStr) : 0; - m_pBkserver = old.m_pBkserver ? strdup(old.m_pBkserver) : 0; - m_pUnique = old.m_pUnique ? strdup(old.m_pUnique) : 0; -} - -JobId & JobId::operator=(JobId const &old) -{ - clear(); - edg_wlc_JobIdDup(old.m_JobId,&m_JobId); - m_pStr = old.m_pStr ? strdup(old.m_pStr) : 0; - m_pBkserver = old.m_pBkserver ? strdup(old.m_pBkserver) : 0; - m_pUnique = old.m_pUnique ? strdup(old.m_pUnique) : 0; - - return *this; -} - - -JobId::JobId(const edg_wlc_JobId &old) - : m_pStr(0), m_pBkserver(0), m_pUnique(0) -{ - edg_wlc_JobIdDup(old,&m_JobId); -} - - -JobId & JobId::operator=(const edg_wlc_JobId &old) -{ - clear(); - edg_wlc_JobIdDup(old,&m_JobId); - m_pStr = 0; - m_pBkserver = 0; - m_pUnique = 0; - return(*this); -} - -JobId::~JobId() -{ - clear(); -} - -/****************************************************************** - method : clear - unsets the JobId instance. - *******************************************************************/ -void JobId::clear() -{ - if ( m_JobId ) - { - edg_wlc_JobIdFree( m_JobId ); - m_JobId = 0; - if (m_pStr) - free(m_pStr); - if (m_pBkserver) - free(m_pBkserver); - if (m_pUnique) - free(m_pUnique); - m_pStr = m_pBkserver = m_pUnique = NULL; - } -} - - -/****************************************************************** - method : setJobId - sets the JobId instance according to the LB and RB - server addresses and the unique string passed as input parameters. - *******************************************************************/ -void JobId::setJobId(const string& bkserver, int port, const string& unique) -{ - int code = edg_wlc_JobIdRecreate(bkserver.c_str(), port, unique.size() ? unique.c_str() : NULL, &m_JobId) ; - if ( code != 0 ) - throw WrongIdException(__FILE__ , __LINE__ , "setJobId(const string& bkserver, int port, const string& unique)" , code ) ; -} - - -/****************************************************************** - Protected method : fromString - sets the JobId instance from the dg_jobId in string format given as input. - *******************************************************************/ -void JobId::fromString (const string& dg_JobId) -{ - clear(); - int code = edg_wlc_JobIdParse(dg_JobId.c_str(), &m_JobId) ; - if ( code != 0 ) - throw WrongIdException(__FILE__ , __LINE__ , "fromString (const string& dg_JobId)" , code ) ; -} - -/****************************************************************** - method : ToString - converts the JobId instance into its string format. - and put it in the dg_jobId output variable - *******************************************************************/ -std::string JobId::toString() const -{ - if ( m_JobId && !m_pStr ) - m_pStr = edg_wlc_JobIdUnparse(m_JobId) ; - if ( !m_pStr ) - throw EmptyIdException (__FILE__ , __LINE__ ,"toString()" ,ENOENT , "JobId") ; - return m_pStr; -} - -/****************************************************************** - method : getServer - return a string containing the LB server address, - *******************************************************************/ -std::string JobId::getServer() const -{ - if ( m_JobId && !m_pBkserver ) - m_pBkserver = edg_wlc_JobIdGetServer( m_JobId ) ; - - if ( !m_pBkserver ) - throw EmptyIdException (__FILE__ , __LINE__ , "getServer()", ENOENT , "LB server Address") ; - - return m_pBkserver; -} - -/****************************************************************** - method : getUnique - return a string containing unique jobid string - *******************************************************************/ -std::string JobId::getUnique() const -{ - if ( m_JobId && !m_pUnique ) - m_pUnique = edg_wlc_JobIdGetUnique( m_JobId ) ; - - if ( !m_pUnique ) - throw EmptyIdException (__FILE__ , __LINE__ , "getUnique()" , ENOENT , "Unique") ; - - return m_pUnique; -} -/****************************************************************** - method : getId - return the c JobId struct representing this instance - *******************************************************************/ -edg_wlc_JobId JobId::getId() const -{ - edg_wlc_JobId out ; - if ( edg_wlc_JobIdDup(m_JobId, &out) ) - throw EmptyIdException (__FILE__ , __LINE__ , "getId()" , ENOENT , "JobId") ; - return out ; -} - -std::ostream& -operator<<(std::ostream& os, JobId const& id) -{ - return os << id.toString(); -} - -} // namespace jobid -} // namespace wmsutils -} // namespace glite diff --git a/org.glite.wms-utils.jobid/src/jobid/JobIdExceptions.cpp b/org.glite.wms-utils.jobid/src/jobid/JobIdExceptions.cpp deleted file mode 100755 index 6be40b7..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/JobIdExceptions.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* ************************************************************************** -* filename : JobIdExecptions.cpp -* author : Alessandro Maraschini -* copyright : (C) 2002 by DATAMAT -***************************************************************************/ - -#include "glite/wmsutils/jobid/JobIdExceptions.h" - -namespace glite { -namespace wmsutils { -namespace jobid { - -using namespace std; -using namespace glite::wmsutils::exception; - -/***************************** -* JobIdException -*****************************/ -JobIdException::JobIdException (const string& file, - int line, - const string& method, - int code, - const string& exception_name) - : Exception(file, line, method, code, exception_name) -{ -} - -/***************************** -* WrongIdException -*****************************/ -WrongIdException::WrongIdException(const string& file, - int line, - const string& method, - int code ) - : JobIdException(file, line, method, code, - "WrongIdException") -{ - error_message = "Wrong Field caught while parsing Job Id" ; -} - -/***************************** -* EmptyIdException -*****************************/ -EmptyIdException::EmptyIdException(const string& file, - int line, - const string& method, - int code , - const string& field ) - : JobIdException(file, line, method, code, - "EmptyIdException") -{ - error_message = "Unable to retrieve " + field + ": the instance has not been initialized yet"; -} - -} // namespace jobid -} // namespace wmsutils -} // namespace glite - diff --git a/org.glite.wms-utils.jobid/src/jobid/Makefile.am b/org.glite.wms-utils.jobid/src/jobid/Makefile.am deleted file mode 100755 index 7a23118..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -lib_LTLIBRARIES = libglite_wmsutils_jobid.la libglite_wmsutils_cjobid.la - -libglite_wmsutils_jobid_la_SOURCES = \ - JobId.cpp \ - JobIdExceptions.cpp \ - manipulation.cpp - -libglite_wmsutils_cjobid_la_SOURCES = \ - cjobid.c \ - strmd5.c - -jobidincludedir = $(includedir)/glite/wmsutils/jobid -jobidinclude_HEADERS = \ - strmd5.h - -AM_CPPFLAGS = -I$(top_srcdir)/src \ - -I$(top_srcdir)/interface \ - $(GLITE_CFLAGS) \ - $(GLOBUS_THR_CFLAGS) \ - -D_GNU_SOURCE - -MAINTAINERCLEANFILES = Makefile.in diff --git a/org.glite.wms-utils.jobid/src/jobid/cjobid.c b/org.glite.wms-utils.jobid/src/jobid/cjobid.c deleted file mode 100755 index 2fa0010..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/cjobid.c +++ /dev/null @@ -1,258 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "glite/wmsutils/jobid/cjobid.h" -#include "strmd5.h" - -struct _edg_wlc_JobId { - char *id; /* unique job identification */ - /* additional information */ - char *BShost;/* bookkeeping server hostname */ - unsigned int BSport; /* bookkeeping server port */ - char *info; /* additional information (after ? in URI) */ -}; - -int edg_wlc_JobIdCreate(const char *bkserver, int port, edg_wlc_JobId *jobId) -{ - return edg_wlc_JobIdRecreate(bkserver, port, NULL, jobId); -} - - -int edg_wlc_JobIdRecreate(const char* bkserver, int port, const char *unique, edg_wlc_JobId *jobId) -{ - edg_wlc_JobId out; - char hostname[200]; /* used to hold string for encrypt */ - struct timeval tv; - int skip; - char* portbeg; - - struct hostent* he; - - if (!bkserver) - return EINVAL; - - if (unique == NULL) { - gethostname(hostname, 100); - he = gethostbyname(hostname); - assert(he->h_length > 0); - gettimeofday(&tv, NULL); - srandom(tv.tv_usec); - - skip = strlen(hostname); - skip += sprintf(hostname + skip, "-IP:0x%x-pid:%d-rnd:%d-time:%d:%d", - *((int*)he->h_addr_list[0]), getpid(), (int)random(), - (int)tv.tv_sec, (int)tv.tv_usec); - } - - *jobId = NULL; - out = (edg_wlc_JobId) malloc (sizeof(*out)); - if (!out) - return ENOMEM; - - memset(out, 0, sizeof(*out)); - - /* check if it begins with prefix */ - /* unsupported */ - if (strncmp(bkserver, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX)-1) == 0) - return EINVAL; - - out->BShost = strdup(bkserver); - portbeg = strchr(out->BShost, ':'); - if (portbeg) { - *portbeg = 0; - /* try to get port number */ - if (port == 0) - port = atoi(portbeg + 1); - } - - if (port == 0) - port = GLITE_WMSC_JOBID_DEFAULT_PORT; - - out->BSport = port; - - out->id = (unique) ? strdup(unique) : str2md5base64(hostname); - //printf("Encrypt: %s\nBASE64 %s\n", hostname, out->id); - - if (!out->id || !out->BShost) { - edg_wlc_JobIdFree(out); - return ENOMEM; - } - - *jobId = out; - return 0; -} - - -int edg_wlc_JobIdDup(const edg_wlc_JobId in, edg_wlc_JobId *out) -{ - edg_wlc_JobId jid; - *out = NULL; - if (in == NULL) - return 0; - - jid = malloc(sizeof(*jid)); - if (!jid) - return ENOMEM; - - memset(jid, 0,sizeof(*jid)); - jid->BShost = strdup(in->BShost); - jid->id = strdup(in->id); - if (in->info) - jid->info = strdup(in->info); - - if (jid->BShost == NULL || jid->id == NULL) { - edg_wlc_JobIdFree(jid); - return ENOMEM; - } - - jid->BSport = in->BSport; - *out = jid; - return 0; -} - - -// XXX -// use recreate -// parse name, port, unique -int edg_wlc_JobIdParse(const char *idString, edg_wlc_JobId *jobId) -{ - char *pom, *pom1, *pom2; - edg_wlc_JobId out; - - *jobId = NULL; - - out = (edg_wlc_JobId) malloc (sizeof(*out)); - if (out == NULL ) - return ENOMEM; - - memset(out,0,sizeof(*out)); - - if (strncmp(idString, GLITE_WMSC_JOBID_PROTO_PREFIX, sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1)) { - out->BShost = (char *) NULL; - out->BSport = 0; - - free(out); - return EINVAL; - } - - pom = strdup(idString + sizeof(GLITE_WMSC_JOBID_PROTO_PREFIX) - 1); - pom1 = strchr(pom, '/'); - pom2 = strchr(pom, ':'); - - if (!pom1) { free(pom); free(out); return EINVAL; } - - if ( pom2 && (pom1 > pom2)) { - pom[pom2-pom] = '\0'; - out->BShost = strdup(pom); - pom[pom1-pom] = '\0'; - out->BSport = (unsigned int) strtoul(pom2 + 1,NULL,10); - } else { - pom[pom1-pom] = '\0'; - out->BShost = strdup(pom); - out->BSport = GLITE_WMSC_JOBID_DEFAULT_PORT; - } - - /* XXX: localhost not supported in jobid - if (!strncmp(out->BShost,"localhost",9) { - free(pom); - free(out->BShost); - free(out); - return EINVAL; - } - */ - - /* additional info from URI */ - pom2 = strchr(pom1+1,'?'); - if (pom2) { - *pom2 = 0; - out->info = strdup(pom2+1); - } - - /* extract the unique part */ - out->id = strdup(pom1+1); - - for (pom1 = out->BShost; *pom1; pom1++) - if (isspace(*pom1)) break; - - for (pom2 = out->id; *pom2; pom2++) - if (isspace(*pom2)) break; - - if (*pom1 || *pom2) { - free(pom); - edg_wlc_JobIdFree(out); - return EINVAL; - } - - free(pom); - *jobId = out; - return 0; -} - - -void edg_wlc_JobIdFree(edg_wlc_JobId job) -{ - if (job) { - free(job->id); - free(job->BShost); - free(job->info); - free(job); - } -} - - -char* edg_wlc_JobIdUnparse(const edg_wlc_JobId jobid) -{ - char *out, port[40]; - - if (!jobid) - return NULL; - - if (jobid->BSport) - sprintf(port,":%d",jobid->BSport); - else - *port = 0; - - asprintf(&out, GLITE_WMSC_JOBID_PROTO_PREFIX"%s%s/%s%s%s", - jobid->BShost,port, - jobid->id, - (jobid->info ? "?" : ""), - (jobid->info ? jobid->info : "")); - - return out; -} - - -char* edg_wlc_JobIdGetServer(const edg_wlc_JobId jobid) -{ - char *bs = NULL; - - if (jobid) - asprintf(&bs, "%s:%u", jobid->BShost, - jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT); - - return bs; -} - - -void edg_wlc_JobIdGetServerParts(const edg_wlc_JobId jobid, char **srvName, unsigned int *srvPort) -{ - if (jobid) { - *srvName = strdup(jobid->BShost); - *srvPort = jobid->BSport ? jobid->BSport : GLITE_WMSC_JOBID_DEFAULT_PORT; - } -} - - -char* edg_wlc_JobIdGetUnique(const edg_wlc_JobId jobid) -{ - return jobid ? strdup(jobid->id) : NULL; -} diff --git a/org.glite.wms-utils.jobid/src/jobid/manipulation.cpp b/org.glite.wms-utils.jobid/src/jobid/manipulation.cpp deleted file mode 100755 index cf3a710..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/manipulation.cpp +++ /dev/null @@ -1,180 +0,0 @@ -#include - -#include -#include - -#include "glite/wmsutils/jobid/JobId.h" - -using namespace std; - -namespace glite { -namespace wmsutils { -namespace jobid { - -namespace { - -class HexInt { -public: - HexInt( unsigned int i = 0 ); - HexInt( const string &str ); - HexInt( string::const_iterator begin, string::const_iterator end ); - ~HexInt( void ); - - inline operator unsigned int( void ) const { return this->hi_int; } - inline operator const string &( void ) const { return this->hi_str; } - - static unsigned int least( void ) { return hi_s_least; } - static void least( unsigned int least ) { hi_s_least = least; } - -private: - void parseString( void ); - - unsigned int hi_int; - string hi_str; - - static unsigned int hi_s_least; - static const char *hi_s_map; -}; - -class BadChar { -public: - BadChar( void ); - ~BadChar( void ); - - inline bool operator()( char c ) - { return( !(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')) || ((c >= '0') && (c <= '9')) || - (c == '.') || (c == '-') || (c == ' ')) ); } -}; - -unsigned int HexInt::hi_s_least = 2; -const char *HexInt::hi_s_map = "0123456789abcdef"; - -HexInt::HexInt( unsigned int ui ) : hi_int( ui ), hi_str( hi_s_least, '0' ) -{ - int n; - string::reverse_iterator pos = this->hi_str.rbegin(); - - while( ui != 0 ) { - n = ui % 16; - if( pos != this->hi_str.rend() ) { - *pos = hi_s_map[n]; - pos += 1; - } - else this->hi_str.insert( this->hi_str.begin(), hi_s_map[n] ); - - ui /= 16; - } - - if( this->hi_str.length() < hi_s_least ) - this->hi_str.insert( this->hi_str.begin(), (hi_s_least - this->hi_str.length()), '0' ); -} - -HexInt::HexInt( const string &str ) : hi_int( 0 ), hi_str( str ) -{ - this->parseString(); -} - -HexInt::HexInt( string::const_iterator begin, string::const_iterator end ) : hi_int( 0 ), hi_str( begin, end ) -{ - this->parseString(); -} - -void HexInt::parseString( void ) -{ - int hexbase; - char *pos, *end = (char *) hi_s_map + 16; - string::reverse_iterator it; - - for( it = this->hi_str.rbegin(), hexbase = 1; it != this->hi_str.rend(); ++it, hexbase *= 16 ) { - pos = find( (char *) hi_s_map, end, (char) tolower(*it) ); - - if( pos != end ) this->hi_int += hexbase * (pos - hi_s_map); - else { - this->hi_int = 0; - break; - } - } - - return; -} - -HexInt::~HexInt( void ) {} - -BadChar::BadChar( void ) {} - -BadChar::~BadChar( void ) {} - -/* - Helper function for the get_reduced_part(...) -*/ -string get_reduced_part_internal( const string &unique, int level ) -{ - string::size_type length = unique.length(); - string piece( unique.substr(0, 2) ), answer; - - if( (level == 0) || (length <= 2) ) answer.assign( piece ); - else if( length != 0 ) { - answer.assign( piece ); - answer.append( 1, '/' ); - answer.append( get_reduced_part_internal(unique.substr(2, length - 2), level - 1) ); - } - - return answer; -} - -}; // Unnamed namespace - -string get_reduced_part( const JobId &id, int level ) -{ - return get_reduced_part_internal( id.getUnique(), level ); -} - -string to_filename( const JobId &id ) -{ - string sid( id.toString() ), coded; - string::iterator last, next; - - last = sid.begin(); - do { - next = find_if( last, sid.end(), BadChar() ); - - if( next != sid.end() ) { - if( last != next ) coded.append( last, next ); - coded.append( 1, '_' ); - coded.append( HexInt(*next) ); - - last = next + 1; - } - else coded.append( last, sid.end() ); - } while( next != sid.end() ); - - return coded; -} - -JobId from_filename( const string &filename ) -{ - char c; - string decoded; - string::const_iterator last, next; - - last = filename.begin(); - do { - next = find( last, filename.end(), '_' ); - - if( next != filename.end() ) { - c = HexInt( next + 1, next + 3 ); - - if( last != next ) decoded.append( last, next ); - decoded.append( 1, c ); - - last = next + 3; - } - else decoded.append( last, filename.end() ); - } while( next != filename.end() ); - - return JobId( decoded ); -} - -} // namespace jobid -} // namespace wmsutils -} // namespace glite diff --git a/org.glite.wms-utils.jobid/src/jobid/strmd5.c b/org.glite.wms-utils.jobid/src/jobid/strmd5.c deleted file mode 100755 index e1f6134..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/strmd5.c +++ /dev/null @@ -1,118 +0,0 @@ -#ident "$Header$" - -#include -#include -#include -#include - -#include "jobid/strmd5.h" - -#warning Thread unsafe! -static char mbuf[33]; - -static int base64_encode(const void *enc, int enc_size, char *out, int out_max_size) -{ - static const char* b64 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"; - - unsigned char* enc_buf = (unsigned char*)enc; - int out_size = 0; - unsigned int bits = 0; - unsigned int shift = 0; - - while ( out_size < out_max_size ) { - if ( enc_size>0 ) { - // Shift in byte - bits <<= 8; - bits |= *enc_buf; - shift += 8; - // Next byte - enc_buf++; - enc_size--; - } else if ( shift>0 ) { - // Pad last bits to 6 bits - will end next loop - bits <<= 6 - shift; - shift = 6; - } else { - // Terminate with Mime style '=' - *out = '='; - out_size++; - - return out_size; - } - - // Encode 6 bit segments - while ( shift>=6 ) { - shift -= 6; - *out = b64[ (bits >> shift) & 0x3F ]; - out++; - out_size++; - } - } - - // Output overflow - return -1; -} - -char *strmd5(const char *s, unsigned char *digest) -{ - MD5_CTX md5; - unsigned char d[16]; - int i; - - MD5_Init(&md5); - MD5_Update(&md5,s,strlen(s)); - MD5_Final(d,&md5); - - if (digest) memcpy(digest,d,sizeof(d)); - - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - mbuf[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - mbuf[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - mbuf[32] = 0; - return (char *) mbuf; -} - -char *str2md5(const char *s) -{ - MD5_CTX md5; - unsigned char d[16]; - char* ret = malloc(33); - int i; - - if (!ret) - return NULL; - - MD5_Init(&md5); - MD5_Update(&md5, s, strlen(s)); - MD5_Final(d, &md5); - - for (i=0; i<16; i++) { - int dd = d[i] & 0x0f; - ret[2*i+1] = dd<10 ? dd+'0' : dd-10+'a'; - dd = d[i] >> 4; - ret[2*i] = dd<10 ? dd+'0' : dd-10+'a'; - } - ret[32] = 0; - return ret; -} - -char *str2md5base64(const char *s) -{ - MD5_CTX md5; - unsigned char d[16]; - char buf[50]; - int l; - - MD5_Init(&md5); - MD5_Update(&md5, s, strlen(s)); - MD5_Final(d, &md5); - - l = base64_encode(d, 16, buf, sizeof(buf) - 1); - if (l < 1) - return NULL; - buf[l - 1] = 0; - return strdup(buf); -} diff --git a/org.glite.wms-utils.jobid/src/jobid/strmd5.h b/org.glite.wms-utils.jobid/src/jobid/strmd5.h deleted file mode 100755 index c5d76b6..0000000 --- a/org.glite.wms-utils.jobid/src/jobid/strmd5.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _GLITE_STRMD5_H -#define _GLITE_STRMD5_H - -#ident "$Header$" - -/* Compute MD5 sum of the first argument. - * The sum is returned in the 16-byte array pointed to by 2nd argument - * (if not NULL) - * - * Return value: ASCII string of the sum, i.e. 32 characters [0-9a-f] - * (pointer to static area, changed by subsequent calls) - */ - -char *strmd5(const char *src, unsigned char *dst); - -/** - * Returns: allocated 32bytes long ASCII string with md5 sum - * of the first argument - */ -char *str2md5(const char *src); - -/** - * Returns: allocated 22bytes long ASCII string with md5 sum in base64 - * format of the source argument - */ -char *str2md5base64(const char *src); - -#endif /* _GLITE_STRMD5_H */ diff --git a/org.glite.wms-utils.jobid/test/Makefile.am b/org.glite.wms-utils.jobid/test/Makefile.am deleted file mode 100755 index 5111c30..0000000 --- a/org.glite.wms-utils.jobid/test/Makefile.am +++ /dev/null @@ -1,48 +0,0 @@ -## ********************************************************************* -## * -## * Copyright (c) 2002 CERN and INFN on behalf of the EU DataGrid. -## * For license conditions see LICENSE file or -## * http://www.edg.org/license.html -## * -## ********************************************************************* - -JOBID_LIBS = $(top_builddir)/src/jobid/libglite_wmsutils_jobid.la -CJOBID_LIBS = $(top_builddir)/src/jobid/libglite_wmsutils_cjobid.la - -TESTS = glite-wmsutils-jobid \ - glite-wmsutils-manipulation - -check_PROGRAMS = $(TESTS) - -glite_wmsutils_jobid_SOURCES = jobid_cu_suite.cpp \ - jobid_cu_suite.h \ - jobid_cu_main.cpp - -glite_wmsutils_jobid_LDADD = \ - $(GLITE_WMSUTILS_EXCEPTION_LIBS) \ - $(GLOBUS_GSS_THR_LIBS) \ - $(CPPUNIT_LIBS) \ - $(JOBID_LIBS) \ - $(CJOBID_LIBS) - -glite_wmsutils_manipulation_SOURCES = manipulation_cu_suite.cpp \ - manipulation_cu_suite.h \ - manipulation_cu_main.cpp - -glite_wmsutils_manipulation_LDADD = \ - $(GLITE_WMSUTILS_EXCEPTION_LIBS) \ - $(GLOBUS_GSS_THR_LIBS) \ - $(CPPUNIT_LIBS) \ - $(JOBID_LIBS) \ - $(CJOBID_LIBS) - - -AM_CPPFLAGS = -I$(top_srcdir)/interface \ - -I$(top_srcdir)/src \ - -I$(top_srcdir)/test \ - $(GLITE_CFLAGS) \ - $(GLOBUS_THR_CFLAGS) \ - $(CPPUNIT_CFLAGS) - -MAINTAINERCLEANFILES = Makefile.in *~ - diff --git a/org.glite.wms-utils.jobid/test/jobid_cu_main.cpp b/org.glite.wms-utils.jobid/test/jobid_cu_main.cpp deleted file mode 100644 index 770e306..0000000 --- a/org.glite.wms-utils.jobid/test/jobid_cu_main.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -#include "jobid_cu_suite.h" - -#include -#include -#include -#include -#include - -using namespace CppUnit; -using namespace std; - -int main (int argc , char** argv) -{ - std::ofstream xml("./cppUnit_output.xml",ios::app); - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - TestRunner runner; - runner.addTest(Jobid_test::suite()); - runner.run(controller); - - CppUnit::XmlOutputter outputter( &result, xml ); - CppUnit::TextOutputter outputter2( &result, std::cerr ); - outputter.write(); - outputter2.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} diff --git a/org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp b/org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp deleted file mode 100644 index ebe04da..0000000 --- a/org.glite.wms-utils.jobid/test/jobid_cu_suite.cpp +++ /dev/null @@ -1,102 +0,0 @@ -#include "jobid_cu_suite.h" - - -using namespace CppUnit; -using namespace std; -using namespace glite::wmsutils::jobid; - - -void Jobid_test::setUp() -{} - -void Jobid_test::tearDown() -{} - -void Jobid_test::Constructor_case() -{ - //EMPTY CONSTRUCTOR - JobId empty; - - CPPUNIT_ASSERT(empty.isSet()==false); - - //create a string with cjobid - string bkserver="grid012g.cnaf.infn.it"; - edg_wlc_JobId jobid; - int bkport=6000; - int ok=edg_wlc_JobIdCreate(bkserver.c_str(), bkport, &jobid); - CPPUNIT_ASSERT(ok == 0); - if (ok==0) - { - string jobstring=edg_wlc_JobIdUnparse(jobid); - - //STRING CONSTRUCTOR - JobId stringCons(jobstring); - - //EDG_WLC CONSTRUCTOR - JobId edg_wlc_Cons(jobid); - - //test copy constructor - JobId copycon(stringCons); - - CPPUNIT_ASSERT(stringCons.isSet()); - CPPUNIT_ASSERT(edg_wlc_Cons.isSet()); - CPPUNIT_ASSERT(copycon.isSet()); - - //test = - JobId testequal; - testequal=stringCons; - CPPUNIT_ASSERT(testequal.isSet()); - - JobId testoperator; - testoperator=jobid; - CPPUNIT_ASSERT(testoperator.isSet()); - - edg_wlc_JobId testget = edg_wlc_Cons.getId(); - char *server; - unsigned int port; - edg_wlc_JobIdGetServerParts(testget, &server, &port); - string serverstring = server; - CPPUNIT_ASSERT(port==bkport); - CPPUNIT_ASSERT(serverstring==bkserver); - } - - CPPUNIT_ASSERT_THROW( JobId stringwrong("grid012"), WrongIdException); -} - -void Jobid_test::Clear_case() -{ - JobId *element; - string jobstring="https://grid012g.cnaf.infn.it:6000/qaKyEoV3G144rmoyXeW6QA"; - CPPUNIT_ASSERT_NO_THROW(element= new JobId(jobstring)); - - CPPUNIT_ASSERT(element->isSet()); - element->clear(); - CPPUNIT_ASSERT(element->isSet()==false); - delete element; -} - -void Jobid_test::SetandGet_case() -{ - JobId element; - string lbserver="grid012g.cnaf.infn.it"; - int port=6000; - string unique ="qaKyEoV3G144rmoyXeW6QA"; - element.setJobId(lbserver, port, unique); - - string server=element.getServer(); - lbserver=lbserver+":6000"; - - CPPUNIT_ASSERT(server==lbserver); - string lonely=element.getUnique(); - CPPUNIT_ASSERT(lonely==unique); - - string descr=element.toString(); - cout << "!!! BEGIN TEST toString() METHOD!!!"<< endl; - cout << descr < -#include -#include - -#include - -#include "glite/wmsutils/jobid/JobId.h" -#include "glite/wmsutils/jobid/cjobid.h" -#include "glite/wmsutils/jobid/JobIdExceptions.h" - -class Jobid_test : public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(Jobid_test); - - CPPUNIT_TEST(Constructor_case); - CPPUNIT_TEST(Clear_case); - CPPUNIT_TEST(SetandGet_case); - - CPPUNIT_TEST_SUITE_END(); - - -public: - - void setUp(); - void tearDown(); - - void Constructor_case(); - void Clear_case(); - void SetandGet_case(); - -}; - - - diff --git a/org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp b/org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp deleted file mode 100644 index 07d2914..0000000 --- a/org.glite.wms-utils.jobid/test/manipulation_cu_main.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#include -#include - -#include "manipulation_cu_suite.h" - -#include -#include -#include -#include -#include - -using namespace CppUnit; -using namespace std; - -int main (int argc , char** argv) -{ - std::ofstream xml("./cppUnit_output.xml",ios::app); - - CppUnit::TestResult controller; - CppUnit::TestResultCollector result; - controller.addListener( &result ); - - TestRunner runner; - runner.addTest(Manipulation_test::suite()); - runner.run(controller); - - CppUnit::XmlOutputter outputter( &result, xml ); - CppUnit::TextOutputter outputter2( &result, std::cerr ); - outputter.write(); - outputter2.write(); - - return result.wasSuccessful() ? 0 : 1 ; -} diff --git a/org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp b/org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp deleted file mode 100644 index a6a69d8..0000000 --- a/org.glite.wms-utils.jobid/test/manipulation_cu_suite.cpp +++ /dev/null @@ -1,34 +0,0 @@ -#include "manipulation_cu_suite.h" - - -using namespace CppUnit; -using namespace std; -using namespace glite::wmsutils::jobid; - - -void Manipulation_test::setUp() -{} - -void Manipulation_test::tearDown() -{} - -void Manipulation_test::to_fromfile_case() -{ - JobId element; - - string lbserver="grid012g.cnaf.infn.it"; - int port=6000; - string unique ="qaKyEoV3G144rmoyXeW6QA"; - element.setJobId(lbserver, port, unique); - - string filename=to_filename(element); - - JobId newelement = from_filename(filename); - - string reduced = get_reduced_part(element, 7); - - string newreduced = get_reduced_part(newelement, 7); - - CPPUNIT_ASSERT(reduced==newreduced); -} - diff --git a/org.glite.wms-utils.jobid/test/manipulation_cu_suite.h b/org.glite.wms-utils.jobid/test/manipulation_cu_suite.h deleted file mode 100644 index 287b902..0000000 --- a/org.glite.wms-utils.jobid/test/manipulation_cu_suite.h +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -#include - -#include "glite/wmsutils/jobid/JobId.h" -#include "glite/wmsutils/jobid/manipulation.h" - -class Manipulation_test : public CppUnit::TestFixture { - - CPPUNIT_TEST_SUITE(Manipulation_test); - - CPPUNIT_TEST(to_fromfile_case); - - CPPUNIT_TEST_SUITE_END(); - - -public: - - void setUp(); - void tearDown(); - - void to_fromfile_case(); - -}; - - - diff --git a/org.glite.yaim.lb/.cvsignore b/org.glite.yaim.lb/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.yaim.lb/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.yaim.lb/LICENSE b/org.glite.yaim.lb/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.yaim.lb/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.yaim.lb/Makefile b/org.glite.yaim.lb/Makefile deleted file mode 100644 index 7fc5e75..0000000 --- a/org.glite.yaim.lb/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -prefix=/opt/glite -package=glite-yaim-lb -name=$Name$ -tag:=$(shell echo $(name) | sed 's/^[^:]*: //' ) -version:=$(shell echo "$(tag)" | sed 's/^.*R_//' | sed 's/_/\./g') -release:=$(shell echo "$(version)" | sed 's/.*\.//') -version:=$(shell echo "$(version)" | sed 's/\(.*\)\.[0-9]*/\1/') - -.PHONY: configure install clean rpm - -all: configure - -install: - @echo installing ... - @mkdir -p $(prefix)/yaim/functions/ - @mkdir -p $(prefix)/yaim/functions/local - @mkdir -p $(prefix)/yaim/node-info.d - @mkdir -p $(prefix)/yaim/defaults - @mkdir -p $(prefix)/yaim/etc/versions - @install -m 0644 config/functions/config* $(prefix)/yaim/functions - @install -m 0644 config/node-info.d/glite* $(prefix)/yaim/node-info.d - @install -m 0644 config/defaults/glite* $(prefix)/yaim/defaults - @echo "$(package) $(version)-$(release)" > $(prefix)/yaim/etc/versions/$(package) - -clean:: - rm -f *~ test/*~ etc/*~ doc/*~ src/*~ - rm -rf rpmbuild - -rpm: - @mkdir -p RPMS - @mkdir -p rpmbuild/RPMS/noarch - @mkdir -p rpmbuild/SRPMS/ - @mkdir -p rpmbuild/SPECS/ - @mkdir -p rpmbuild/SOURCES/ - @mkdir -p rpmbuild/BUILD/ - echo "|$(tag)|" -ifneq ("$(tag)","ame:") - @sed -i 's/^Version:.*/Version: $(version)/' $(package).spec - @sed -i 's/^Release:.*/Release: $(release)/' $(package).spec -endif - @tar --gzip --exclude='*CVS*' -cf rpmbuild/SOURCES/${package}.src.tgz * - rpmbuild -ba ${package}.spec - - - - diff --git a/org.glite.yaim.lb/config/defaults/glite-lb.pre b/org.glite.yaim.lb/config/defaults/glite-lb.pre deleted file mode 100644 index 765eb59..0000000 --- a/org.glite.yaim.lb/config/defaults/glite-lb.pre +++ /dev/null @@ -1,3 +0,0 @@ -### Default values to some glite-LB variables -# backward compatible default location of GLITE_LOCATION_VAR -GLITE_LOCATION_VAR=/var/glite diff --git a/org.glite.yaim.lb/config/defaults/glite-lb_30.pre b/org.glite.yaim.lb/config/defaults/glite-lb_30.pre deleted file mode 100644 index 4b697ab..0000000 --- a/org.glite.yaim.lb/config/defaults/glite-lb_30.pre +++ /dev/null @@ -1,3 +0,0 @@ -### Default values to some glite-LB variables -GLITE_USER=glite -GLITE_WMS_LCGMON_FILE="/var/glite/logging/status.log" diff --git a/org.glite.yaim.lb/config/functions/config_gip_lb b/org.glite.yaim.lb/config/functions/config_gip_lb deleted file mode 100644 index dde5c00..0000000 --- a/org.glite.yaim.lb/config/functions/config_gip_lb +++ /dev/null @@ -1,14 +0,0 @@ -function config_gip_lb_check () { - - yaimlog DEBUG "This function currently doesn't set any environment variables." - -} - -function config_gip_lb () { - - SERVICE_TYPE=org.glite.lb.Server - - rm -f $INSTALL_ROOT/glite/var/tmp/gip/service-${SERVICE_TYPE}.conf - rm -f $INSTALL_ROOT/glite/etc/gip/ldif/service-${SERVICE_TYPE}.ldif - -} diff --git a/org.glite.yaim.lb/config/functions/config_gip_lb_30 b/org.glite.yaim.lb/config/functions/config_gip_lb_30 deleted file mode 100644 index ac15a5e..0000000 --- a/org.glite.yaim.lb/config/functions/config_gip_lb_30 +++ /dev/null @@ -1,44 +0,0 @@ -function config_gip_lb_30_check () { - - requires $1 SITE_NAME - retcode=$? - return ${retcode} - -} - -function config_gip_lb_30 () { - - SERVICE_HOST=`hostname -f` - - SERVICE_TYPE=org.glite.lb.Server - SERVICE_PORT=9003 - SERVICE_VERSION=1.6.2 - SERVICE_ENDPOINT="https://${SERVICE_HOST}:${SERVICE_PORT}/lb" - - conffile=$INSTALL_ROOT/glite/var/tmp/gip/service-${SERVICE_TYPE}.conf - cat << EOF > $conffile -dn: GlueServiceUniqueID=${SERVICE_ENDPOINT} -GlueServiceName: ${SITE_NAME}-${SERVICE_TYPE} -GlueServiceType: ${SERVICE_TYPE} -GlueServiceVersion: ${SERVICE_VERSION} -GlueServiceEndpoint: ${SERVICE_ENDPOINT} -GlueServiceURI: unset -GlueServiceAccessPointURL: ${SERVICE_ENDPOINT} -GlueServiceStatus: OK -GlueServiceStatusInfo: No Problems -GlueServiceWSDL: unset -GlueServiceSemantics: unset -GlueServiceStartTime: 1970-01-01T00:00:00Z -GlueForeignKey: GlueSiteUniqueID=${SITE_NAME} -EOF - - for VO in $VOS; do - echo "GlueServiceAccessControlRule: $VO" >> $conffile - echo "GlueServiceOwner: $VO" >> $conffile - done - - $INSTALL_ROOT/lcg/sbin/lcg-info-static-create -c $conffile -t \ - $INSTALL_ROOT/lcg/etc/GlueService.template > \ - $INSTALL_ROOT/glite/etc/gip/ldif/service-${SERVICE_TYPE}.ldif - -} diff --git a/org.glite.yaim.lb/config/functions/config_glite_lb b/org.glite.yaim.lb/config/functions/config_glite_lb deleted file mode 100644 index d999714..0000000 --- a/org.glite.yaim.lb/config/functions/config_glite_lb +++ /dev/null @@ -1,253 +0,0 @@ -function config_glite_lb_check(){ - requires $1 MYSQL_PASSWORD INSTALL_ROOT GLITE_LOCATION GLITE_LOCATION_VAR GLITE_USER -} - -function config_glite_lb_setenv(){ - - yaimgridenv_set GLITE_USER ${GLITE_USER:-glite} - # Redefine GLITE_HOME_DIR to make sure we retrieve the correct HOME directory of user glite - GLITE_HOME_DIR=`getent passwd ${GLITE_USER} | cut -d: -f6` - if [ "x${GLITE_HOME_DIR}" = "x" ]; then - yaimlog ERROR "The home directory of ${GLITE_USER} doesn't exist. Check whether the user ${GLITE_USER} was properly created" - exit ${YEX_NOSUCHFILE} - fi - yaimgridenv_set GLITE_JP_LOCATION ${GLITE_JP_LOCATION:-} - yaimgridenv_set GLITE_WMS_QUERY_TIMEOUT ${GLITE_WMS_QUERY_TIMEOUT:-300} - yaimgridenv_set GLITE_HOST_CERT ${GLITE_HOME_DIR:-/home/glite}/.certs/hostcert.pem - yaimgridenv_set GLITE_HOST_KEY ${GLITE_HOME_DIR:-/home/glite}/.certs/hostkey.pem - yaimgridenv_set X509_CERT_DIR /etc/grid-security/certificates - yaimgridenv_set X509_VOMS_DIR /etc/grid-security/vomsdir - - yaimgridenv_set GLITE_LB_EXPORT_ENABLED ${GLITE_LB_EXPORT_ENABLED:-false} - yaimgridenv_set GLITE_LB_EXPORT_PURGE_ARGS "${GLITE_LB_EXPORT_PURGE_ARGS:---cleared 2d --aborted 15d --cancelled 15d --other 60d}" - yaimgridenv_set GLITE_LB_EXPORT_JPPS ${GLITE_LB_EXPORT_JPPS:-} - yaimgridenv_set GLITE_LB_RTM_ENABLED ${GLITE_LB_RTM_ENABLED:-false} - yaimgridenv_set GLITE_LB_RTM_DN "${GLITE_LB_RTM_DN:-/C=UK/O=eScience/OU=Imperial/L=Physics/CN=heppc24.hep.ph.ic.ac.uk/Email=janusz.martyniak@imperial.ac.uk}" - yaimgridenv_set GLITE_LB_SUPER_USERS "${GLITE_LB_SUPER_USERS:-}" - yaimgridenv_set GLITE_LB_HARVESTER_ENABLED ${GLITE_LB_HARVESTER_ENABLED:-false} - yaimgridenv_set GLITE_LB_HARVESTER_MSG_OPTIONS "${GLITE_LB_HARVESTER_MSG_OPTIONS:---wlcg}" - - yaimgridenv_set GLITE_LB_TYPE ${GLITE_LB_TYPE:-server} - - cares_prefix=${INSTALL_ROOT:-/opt}/c-ares - classads_prefix=${INSTALL_ROOT:-/opt}/classads - if [ x`uname -m` = xx86_64 ]; then - if [ -d "$cares_prefix/lib64" ]; then - cares_libarch=lib64 - fi - if [ -d "$classads_prefix/lib64" ]; then - classads_libarch=lib64 - fi - fi - yaimgridpath_append LD_LIBRARY_PATH $cares_prefix/${cares_libarch:-lib} - yaimgridpath_append LD_LIBRARY_PATH $classads_prefix/${classads_libarch:-lib} -} - -function config_glite_lb() { - - ############################################# - # Logging and Bookkeeping configuration # - ############################################# - - HOSTNAME=`hostname -f` - - # Redefine GLITE_HOME_DIR to make sure we retrieve the correct HOME directory of user glite - GLITE_HOME_DIR=`getent passwd ${GLITE_USER} | cut -d: -f6` - if [ "x${GLITE_HOME_DIR}" = "x" ]; then - yaimlog ERROR "The home directory of ${GLITE_USER} doesn't exist. Check whether the user ${GLITE_USER} was properly created" - exit ${YEX_NOSUCHFILE} - fi - - # Let Job Provenance Primary Storage as localhost:8901 in LB startup script. - # More strict check of GLITE_LB_EXPORT_JPPS variable only here. - if [ x"$GLITE_LB_EXPORT_ENABLED" = x"true" -a -z "$GLITE_LB_EXPORT_JPPS" ]; then - yaimlog ABORT "Job Provenance Primary Storage for export not set! (GLITE_LB_EXPORT_JPPS)" - return 1 - fi - - LB_PURGE="$GLITE_LOCATION/bin/glite-lb-purge" - if [ ! -x "$LB_PURGE" ]; then - LB_PURGE="$GLITE_LOCATION/sbin/glite-lb-purge" - fi - if [ ! -x "$LB_PURGE" ]; then - yaimlog ABORT "Purge utility not found! Install glite-lb-utils (or glite-lb-client in older version)" - return 1 - fi - - chmod og+rx /var/lib/mysql/ - chown mysql:mysql /var/run/mysqld/ - - # add option --max_allowed_packet=17M - if [ ! -f /etc/my.cnf ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - else - grep "^[mysqld]" /etc/my.cnf > /dev/null - if [ ! $? = 0 ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - fi - fi - - /sbin/chkconfig mysqld on - ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - /etc/init.d/mysqld start - sleep 1 - fi - - ls /tmp/mysql.sock > /dev/null 2>&1 - if [ ! $? = 0 ]; then - ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock - fi - - # set mysql password - set_mysql_passwd || return 1 # the function uses $MYSQL_PASSWORD - - # Check if database exist - mysqlshow --password="$MYSQL_PASSWORD" | grep "\" > /dev/null 2>&1 - - if [ ! $? = 0 ]; then - mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE lbserver20" - mysql --password="$MYSQL_PASSWORD" lbserver20 < ${INSTALL_ROOT}/glite/etc/glite-lb-dbsetup.sql - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@localhost IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE short_fields MAX_ROWS=1000000000;" lbserver20 - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE long_fields MAX_ROWS=55000000;" lbserver20 - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE states MAX_ROWS=9500000;" lbserver20 - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE events MAX_ROWS=175000000;" lbserver20 - else - yaimlog WARNING "Database lbserver20 already exists" - fi - - # adjust indexes - # 1) if L&B with local harvester or L&B for Real Time Monitoring ==> lastUpdateTime needed - # 2) if GLITE_LB_INDEX_OWNER specified ==> create/destroy owner index - need_reindex=0 - $GLITE_LOCATION/bin/glite-lb-bkindex -d 2>/dev/null | tail -n +3 | head -n -2 | sed 's/\([^,]\)$/\1,/' > /var/tmp/glite-lb-bkindexes.txt - if [ x"$GLITE_LB_RTM_ENABLED" = x"true" -o x"GLITE_LB_HARVESTER_ENABLED" = x"true" ]; then - # index for querying older jobs by real time monitor - grep '\[ type = "system"; name = "lastUpdateTime" \]' /var/tmp/glite-lb-bkindexes.txt >/dev/null - if [ $? != 0 ]; then - need_reindex=1 - yaimlog INFO "Index 'lastUpdateTime' will be added" - echo '[ type = "system"; name = "lastUpdateTime" ],' >> /var/tmp/glite-lb-bkindexes.txt - fi - fi - if [ x"$GLITE_LB_INDEX_OWNER" = x"true" ]; then - grep 'name = "owner"' /var/tmp/glite-lb-bkindexes.txt >/dev/null - if [ $? != 0 ]; then - need_reindex=1 - yaimlog INFO "Index 'owner' will be added" - echo '[ type = "system"; name = "owner" ],' >> /var/tmp/glite-lb-bkindexes.txt - fi - elif [ x"$GLITE_LB_INDEX_OWNER" = x"false" ]; then - grep 'name = "owner"' /var/tmp/glite-lb-bkindexes.txt >/dev/null - if [ $? = 0 ]; then - need_reindex=1 - yaimlog INFO "Index 'owner' will be deleted" - mv /var/tmp/glite-lb-bkindexes.txt /var/tmp/glite-lb-bkindexes.txt.2 - grep -v 'name = "owner"' /var/tmp/glite-lb-bkindexes.txt.2 > /var/tmp/glite-lb-bkindexes.txt - rm -f /var/tmp/glite-lb-bkindexes.txt.2 - fi - fi - if [ $need_reindex = 1 ]; then - cat << EOF | $GLITE_LOCATION/bin/glite-lb-bkindex -rv -[ - JobIndices = { -`cat /var/tmp/glite-lb-bkindexes.txt` - } -] -EOF - fi - rm -f /var/tmp/glite-lb-bkindexes.txt - - mkdir -p $GLITE_LOCATION_VAR # Needed to store PID of LB server - - chown $GLITE_USER:$GLITE_USER $GLITE_LOCATION_VAR - chmod 0755 $GLITE_LOCATION_VAR - - mkdir -p $GLITE_HOME_DIR/.certs - chown $GLITE_USER:$GLITE_USER $GLITE_HOME_DIR/.certs - chmod 0755 $GLITE_HOME_DIR/.certs - cp -f /etc/grid-security/hostcert.pem /etc/grid-security/hostkey.pem $GLITE_HOME_DIR/.certs/ - if [ ! $? = 0 ] ; then - yaimlog WARNING "Please copy host certificate and key into /etc/grid-security and" - yaimlog WARNING " $GLITE_HOME_DIR/.certs/, change the owner of the ones in" - yaimlog WARNING " $GLITE_HOME_DIR/.certs/ to $GLITE_USER" - fi - chown $GLITE_USER:$GLITE_USER $GLITE_HOME_DIR/.certs/hostcert.pem $GLITE_HOME_DIR/.certs/hostkey.pem - chmod 0644 $GLITE_HOME_DIR/.certs/hostcert.pem - chmod 0400 $GLITE_HOME_DIR/.certs/hostkey.pem - - # Create cron for purging - mkdir -p /var/log/glite - logfile=/var/log/glite/glite-lb-purger.log - if $LB_PURGE --help 2>&1 | grep 'target-runtime' > /dev/null; then - purge_target_runtime_cmd='export GLITE_LB_PURGE_TARGET_RUNTIME=84600s; ' - fi - cat << EOF > /etc/cron.d/glite-lb-purge.cron -HOME=/ -MAILTO=$SITE_EMAIL - -1 1 * * * $GLITE_USER . /opt/glite/etc/profile.d/grid-env.sh ; export GLITE_LB_EXPORT_BKSERVER=$HOSTNAME; $purge_target_runtime_cmd/opt/glite/sbin/glite-lb-export.sh >> $logfile 2>&1 -EOF - - touch $logfile - chown $GLITE_USER:$GLITE_USER $logfile - - cat > /etc/logrotate.d/lb-purger < /dev/null - if [ ! $? = 0 ] ; then - echo "${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd" >> ${GLITE_LOCATION}/etc/gLiteservices - fi - - if [ -z "$GLITE_LB_SUPER_USERS" ]; then - touch ${GLITE_LOCATION}/etc/LB-super-users - else - echo "$GLITE_LB_SUPER_USERS" > ${GLITE_LOCATION}/etc/LB-super-users - fi - if [ x"$GLITE_LB_RTM_ENABLED" = x"true" ]; then - echo "$GLITE_LB_RTM_DN" >> ${GLITE_LOCATION}/etc/LB-super-users - fi - - if [ ! -f ${GLITE_LOCATION}/etc/glite-lb-harvester.conf ]; then - echo $HOSTNAME > ${GLITE_LOCATION}/etc/glite-lb-harvester.conf - fi - - . /opt/glite/etc/profile.d/grid-env.sh - ${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd stop - #Temporary workaround to kill glite-lb-*-interlogd - ps ax | grep -v grep | grep glite-lb-notif-interlogd > /dev/null - if [ $? = 0 ]; then - killall -9 /opt/glite/bin/glite-lb-notif-interlogd - fi - ps ax | grep -v grep | grep glite-lb-interlogd > /dev/null - if [ $? = 0 ]; then - killall -9 /opt/glite/bin/glite-lb-interlogd - fi - ${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd start - - if [ ! $? = 0 ] ; then - yaimlog ABORT "Service glite-lb-bkserverd failed to start!" - return 1 - fi - - return 0 - -} diff --git a/org.glite.yaim.lb/config/functions/config_glite_lb_30 b/org.glite.yaim.lb/config/functions/config_glite_lb_30 deleted file mode 100644 index 9ac8cb6..0000000 --- a/org.glite.yaim.lb/config/functions/config_glite_lb_30 +++ /dev/null @@ -1,141 +0,0 @@ -function config_glite_lb_30_check(){ - requires $1 MYSQL_PASSWORD -} - -function config_glite_lb_30_setenv(){ - - yaimgridenv_set GLITE_LOCATION ${INSTALL_ROOT:-opt}/glite - yaimgridenv_set GLITE_LOCATION_VAR /var/glite - yaimgridenv_set GLITE_USER ${GLITE_USER:-glite} - yaimgridenv_set GLITE_WMS_QUERY_TIMEOUT 300 - yaimgridenv_set GLITE_HOST_CERT ${GLITE_HOME_DIR:-/home/glite}/.certs/hostcert.pem - yaimgridenv_set GLITE_HOST_KEY ${GLITE_HOME_DIR:-/home/glite}/.certs/hostkey.pem - yaimgridenv_set X509_CERT_DIR /etc/grid-security/certificates - yaimgridenv_set X509_VOMS_DIR /etc/grid-security/vomsdir - - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/glite/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/globus/lib - yaimgridpath_append LD_LIBRARY_PATH ${INSTALL_ROOT:-opt}/c-ares/lib -} - -function config_glite_lb_30() { - - ############################################# - # Logging and Bookkeeping configuration # - ############################################# - - HOSTNAME=`hostname -f` - - chmod og+rx /var/lib/mysql/ - - # add option --max_allowed_packet=17M - if [ ! -f /etc/my.cnf ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - else - grep "^[mysqld]" /etc/my.cnf > /dev/null - if [ ! $? = 0 ]; then - echo "[mysqld]" >> /etc/my.cnf - echo "max_allowed_packet=17M" >> /etc/my.cnf - fi - fi - - /sbin/chkconfig mysql on - ps ax | grep -v grep |grep mysqld_safe > /dev/null 2>&1 - if [ ! $? = 0 ] ; then - /etc/init.d/mysql start - sleep 1 - fi - - ls /tmp/mysql.sock > /dev/null 2>&1 - if [ ! $? = 0 ]; then - ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock - fi - - # set mysql password - set_mysql_passwd || return 1 # the function uses $MYSQL_PASSWORD - - # Check if database exist - mysqlshow --password="$MYSQL_PASSWORD" | grep "lbserver20" > /dev/null 2>&1 - - if [ ! $? = 0 ]; then - mysql -u root --password="$MYSQL_PASSWORD" -e "CREATE DATABASE lbserver20" - mysql --password="$MYSQL_PASSWORD" lbserver20 < ${INSTALL_ROOT}/glite/etc/glite-lb-dbsetup.sql - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@'$HOSTNAME' IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "GRANT ALL PRIVILEGES on lbserver20.* to lbserver@localhost IDENTIFIED BY '' WITH GRANT OPTION;" - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE short_fields MAX_ROWS=1000000000;" lbserver20 - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE long_fields MAX_ROWS=55000000;" lbserver20 - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE states MAX_ROWS=9500000;" lbserver20 - mysql -u root --password="$MYSQL_PASSWORD" -e "ALTER TABLE events MAX_ROWS=175000000;" lbserver20 - else - yaimlog WARNING "Database lbserver20 already exists" - fi - - # do we need bkindex? - - GLITE_LOCATION_VAR=${GLITE_LOCATION_VAR:-/var/glite} - mkdir -p $GLITE_LOCATION_VAR # Needed to store PID of LB server - - chown $GLITE_USER:$GLITE_USER $GLITE_LOCATION_VAR - chmod 0755 $GLITE_LOCATION_VAR - - mkdir -p $GLITE_HOME_DIR/.certs - chown $GLITE_USER:$GLITE_USER $GLITE_HOME_DIR/.certs - chmod 0755 $GLITE_HOME_DIR/.certs - cp -f /etc/grid-security/hostcert.pem /etc/grid-security/hostkey.pem $GLITE_HOME_DIR/.certs/ - if [ ! $? = 0 ] ; then - echo "Please copy host certificate and key into /etc/grid-security and" - echo " $GLITE_HOME_DIR/.certs/, change the owner of the ones in" - echo " $GLITE_HOME_DIR/.certs/ to $GLITE_USER" - fi - chown $GLITE_USER:$GLITE_USER $GLITE_HOME_DIR/.certs/hostcert.pem $GLITE_HOME_DIR/.certs/hostkey.pem - chmod 0644 $GLITE_HOME_DIR/.certs/hostcert.pem - chmod 0400 $GLITE_HOME_DIR/.certs/hostkey.pem - - # Create cron for purging - mkdir -p /var/log/glite - logfile=/var/log/glite/glite-lb-purger.log - cat << EOF > /etc/cron.d/glite-lb-purge.cron -HOME=/ -MAILTO=$SITE_EMAIL - -1 1 * * * $GLITE_USER . /opt/glite/etc/profile.d/grid-env.sh ; export GLITE_LB_EXPORT_BKSERVER=$HOSTNAME; export GLITE_LB_EXPORT_ENABLED=false; export GLITE_LB_EXPORT_PURGE_ARGS="--cleared 2d --aborted 15d --cancelled 15d --other 60d"; /opt/glite/sbin/glite-lb-export.sh >> $logfile 2>&1 -EOF - - touch $logfile - chown $GLITE_USER:$GLITE_USER $logfile - - cat > /etc/logrotate.d/lb-purger < /dev/null - if [ ! $? = 0 ] ; then - echo "${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd" >> ${GLITE_LOCATION}/etc/gLiteservices - fi - - touch ${GLITE_LOCATION}/etc/LB-super-users - - . /opt/glite/etc/profile.d/grid-env.sh - ${GLITE_LOCATION}/etc/init.d/glite-lb-bkserverd restart - - if [ ! $? = 0 ] ; then - yaimlog ABORT "Service glite-lb-bkserverd failed to start!" - return 1 - fi - - return 0 - -} diff --git a/org.glite.yaim.lb/config/functions/config_info_service_lb b/org.glite.yaim.lb/config/functions/config_info_service_lb deleted file mode 100644 index 9154391..0000000 --- a/org.glite.yaim.lb/config/functions/config_info_service_lb +++ /dev/null @@ -1,92 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_info_service_lb -# -# DESCRIPTION : This function configures the dynamic service publisher -# for site LB server node. -# -# AUTHORS : Maria.Alandes.Pradillo@cern.ch -# salvet@ics.muni.cz -# -# NOTES : -# -# YAIM MODULE: glite-yaim-lb -# -############################################################################## - -config_info_service_lb_check () { - requires $1 SITE_NAME INSTALL_ROOT -} - -config_info_service_lb_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_info_service_lb () { - -INFO_SERVICE_CONFIG=${INFO_SERVICE_CONFIG:-${INSTALL_ROOT}/glite/etc} -INFO_SERVICE_SCRIPT=${INFO_SERVICE_SCRIPT:-${INSTALL_ROOT}/glite/libexec} -INFO_PROVIDER_PATH=${INFO_PROVIDER_PATH:-${INSTALL_ROOT}/glite/etc/gip/provider} - -SERVICE=LBSERVER -SERVICE_LC=lbserver - -SERVICE_HOST=`hostname -f` - -if [ ! -f ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ]; then - yaimlog ERROR "The template file for glite-info-service-${SERVICE_LC}.conf.template was not found in ${INFO_SERVICE_CONFIG}." - exit 1 -fi - -if [ ! -f ${INFO_SERVICE_SCRIPT}/glite-info-service ]; then - yaimlog ERROR "The script file for glite-info-service was not found in ${INFO_SERVICE_SCRIPT}." - exit 1 -fi - -yaimlog DEBUG "Delete a previous version of the glite-info-service-${SERVICE_LC}.conf if it exists" -rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -yaimlog DEBUG "Create the glite-info-service-${SERVICE_LC}.conf file out of the template file" -cp ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -# Note: the configuration file may need to be altered if non standard values have been used. - -yaimlog DEBUG "Delete a previous version of the glite-info-provider-service-${SERVICE_LC}-wrapper if it exists" -rm -rf ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - -yaimlog DEBUG "Create the ${INFO_PROVIDER_PATH} in case it doesn't exist" -mkdir -p ${INFO_PROVIDER_PATH} - -yaimlog DEBUG "Create the glite-info-provider-service-${SERVICE_LC}-wrapper file" -cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper -#!/bin/sh -export PATH=$PATH:${INFO_SERVICE_SCRIPT} -export ${SERVICE}_HOST=${SERVICE_HOST} -${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf $SITE_NAME -${INFO_SERVICE_SCRIPT}/glite-info-service-glue2 ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf $SITE_NAME -EOF - -chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - - -return 0 - -} - - diff --git a/org.glite.yaim.lb/config/functions/config_jobmon b/org.glite.yaim.lb/config/functions/config_jobmon deleted file mode 100644 index 717aabd..0000000 --- a/org.glite.yaim.lb/config/functions/config_jobmon +++ /dev/null @@ -1,87 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_jobmon -# -# DESCRIPTION : Monitoring using RGMA export (deprecated). -# -# AUTHORS : Di.Qing@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-lb -# -############################################################################## - -function config_jobmon_check(){ - - requires $1 GLITE_WMS_LCGMON_FILE GLITE_USER - retcode=$? - return ${retcode} - -} - -function config_jobmon_setenv(){ - - yaimgridenv_set GLITE_LB_SERVER_OTHER_OPTIONS "${GLITE_LB_SERVER_OTHER_OPTIONS} --rgmaexport" - yaimgridenv_set GLITE_WMS_LCGMON_FILE "${GLITE_WMS_LCGMON_FILE}" - -} - - -function config_jobmon(){ - - mkdir -p `dirname ${GLITE_WMS_LCGMON_FILE}` - chown $GLITE_USER:root `dirname ${GLITE_WMS_LCGMON_FILE}` - - if [ ! -d /opt/lcg/etc ]; then - mkdir -p /opt/lcg/etc - fi - - cat > /opt/lcg/etc/lcg-mon-job-status.conf < /etc/logrotate.d/glite-lb-bkserver-rgma << EOF -# Logrotation for bkserver R-GMA status file. -$GLITE_WMS_LCGMON_FILE { -daily -rotate 9 -missingok -} -EOF - - if [ -f /opt/lcg/etc/init.d/lcg-mon-logfile-daemon ]; then - ln -sf /opt/lcg/etc/init.d/lcg-mon-logfile-daemon /etc/rc.d/init.d/lcg-mon-job-status - /sbin/chkconfig lcg-mon-job-status on - /etc/rc.d/init.d/lcg-mon-job-status restart - fi - - return 0; -} - diff --git a/org.glite.yaim.lb/config/node-info.d/glite-lb b/org.glite.yaim.lb/config/node-info.d/glite-lb deleted file mode 100644 index 4a44960..0000000 --- a/org.glite.yaim.lb/config/node-info.d/glite-lb +++ /dev/null @@ -1,14 +0,0 @@ -LB_FUNCTIONS=" -config_add_pool_env -config_crl -config_host_certs -config_edgusers -config_gip_only -config_gip_lb -config_info_service_lb -config_gip_service_release -config_globus_clients -config_glite_lb -config_glite_locallogger -config_bdii_only -config_glite_initd" diff --git a/org.glite.yaim.lb/config/node-info.d/glite-lb_30 b/org.glite.yaim.lb/config/node-info.d/glite-lb_30 deleted file mode 100644 index acd1d95..0000000 --- a/org.glite.yaim.lb/config/node-info.d/glite-lb_30 +++ /dev/null @@ -1,15 +0,0 @@ -LB_FUNCTIONS=" -config_add_pool_env -config_crl -config_host_certs -config_edgusers -config_java_30 -config_rgma_client -config_gip_only -config_gip_lb_30 -config_globus_clients -config_jobmon -config_glite_lb_30 -config_glite_locallogger -config_bdii -config_glite_initd" diff --git a/org.glite.yaim.lb/glite-yaim-lb.spec b/org.glite.yaim.lb/glite-yaim-lb.spec deleted file mode 100644 index 88af220..0000000 --- a/org.glite.yaim.lb/glite-yaim-lb.spec +++ /dev/null @@ -1,39 +0,0 @@ -%define topdir %(pwd)/rpmbuild -%define _topdir %{topdir} -Summary: glite-yaim-lb -Name: glite-yaim-lb -Version: 4.0.1 -Vendor: EGEE -Release: 3 -License: EGEE -Group: EGEE -Source: %{name}.src.tgz -BuildArch: noarch -Requires: glite-yaim-core -Prefix: /opt/glite -BuildRoot: %{_tmppath}/%{name}-%{version}-build -Packager: EGEE - -%description -This package contains the yaim functions to configuration of the LB node. - -%prep - -%setup -c - -%build -make install prefix=%{buildroot}%{prefix} - -%files -%defattr(0644,root,root) -%{prefix}/yaim/functions/config_* -%{prefix}/yaim/defaults/glite-* -%{prefix}/yaim/etc/versions/%{name} -%config(noreplace) %{prefix}/yaim/node-info.d/glite-* -%doc LICENSE - -%clean -rm -rf %{buildroot} - - - diff --git a/org.glite.yaim.myproxy/.cvsignore b/org.glite.yaim.myproxy/.cvsignore deleted file mode 100644 index 3a4edf6..0000000 --- a/org.glite.yaim.myproxy/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project diff --git a/org.glite.yaim.myproxy/Changelog b/org.glite.yaim.myproxy/Changelog deleted file mode 100644 index 394b3a7..0000000 --- a/org.glite.yaim.myproxy/Changelog +++ /dev/null @@ -1,38 +0,0 @@ -#################################################################### -############### TAG glite-yaim-myproxy_R_4_0_4_2 ################### -#################################################################### - -09/08/2009 -> - -by Maria Alandes - -config/functions/config_myproxy_server -- Fix for bug #54094: host cert and key is now copied for the bdii user - -config/node-info.d/glite-px -- config_myproxy_libs is now removed. - -#################################################################### -############### TAG glite-yaim-myproxy_R_4_0_4_1 ################### -#################################################################### - -06/07/2009 -> - -by Maria Alandes - -glite-yaim-myproxy.spec -- Force dependency on glite-yaim-core >= 4.0.10 - -config/node-info.d/glite-px -- Fix for bug #i52822 configuration changes -> new config_myproxy_libs is now added. - -config/services/glite-px -- Fix for bug #48440: Extra spaces have been removed - -14/11/2008 -> - -by Maria Alandes - -Makefile, spec file -- Fix for bug #44000: RPM_BUILD_ROOT is not used anymore in the Makefile. -- Fix for bug #40565: version for myproxy and fix in spec file for man pages diff --git a/org.glite.yaim.myproxy/LICENSE b/org.glite.yaim.myproxy/LICENSE deleted file mode 100755 index 01b973b..0000000 --- a/org.glite.yaim.myproxy/LICENSE +++ /dev/null @@ -1,69 +0,0 @@ -LICENSE file for EGEE Middleware -================================ - -Copyright (c) 2004 on behalf of the EU EGEE Project: -The European Organization for Nuclear Research (CERN), -Istituto Nazionale di Fisica Nucleare (INFN), Italy -Datamat Spa, Italy -Centre National de la Recherche Scientifique (CNRS), France -CS Systeme d'Information (CSSI), France -Royal Institute of Technology, Center for Parallel Computers (KTH-PDC), Sweden -Universiteit van Amsterdam (UvA), Netherlands -University of Helsinki (UH.HIP), Finlan -University of Bergen (UiB), Norway -Council for the Central Laboratory of the Research Councils (CCLRC), United Kingdom - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are -met: - -1. Redistributions of source code must retain the above copyright -notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright -notice, this list of conditions and the following disclaimer in the -documentation and/or other materials provided with the distribution. - -3. The end-user documentation included with the redistribution, if -any, must include the following acknowledgment: "This product includes -software developed by The EU EGEE Project (http://cern.ch/eu-egee/)." -Alternatively, this acknowledgment may appear in the software itself, if -and wherever such third-party acknowledgments normally appear. - -4. The names EGEE and the EU EGEE Project must not be -used to endorse or promote products derived from this software without -prior written permission. For written permission, please contact -. - -5. You are under no obligation whatsoever to provide anyone with any -bug fixes, patches, or upgrades to the features, functionality or -performance of the Software ("Enhancements") that you may develop over -time; however, if you choose to provide your Enhancements to The EU -EGEE Project, or if you choose to otherwise publish or distribute your -Enhancements, in source code form without contemporaneously requiring -end users of The EU EGEE Proejct to enter into a separate written license -agreement for such Enhancements, then you hereby grant The EU EGEE Project -a non-exclusive, royalty-free perpetual license to install, use, copy, -modify, prepare derivative works, incorporate into the EGEE Middleware -or any other computer software, distribute, and sublicense your -Enhancements or derivative works thereof, in binary and source code -form (if any), whether developed by The EU EGEE Project or third parties. - -THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED -WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL PROJECT OR ITS CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -This software consists of voluntary contributions made by many -individuals on behalf of the EU EGEE Prject. For more information on The -EU EGEE Project, please see http://cern.ch/eu-egee/. For more information on -EGEE Middleware, please see http://egee-jra1.web.cern.ch/egee-jra1/ - - diff --git a/org.glite.yaim.myproxy/Makefile b/org.glite.yaim.myproxy/Makefile deleted file mode 100644 index 9d8707d..0000000 --- a/org.glite.yaim.myproxy/Makefile +++ /dev/null @@ -1,47 +0,0 @@ -prefix=/opt/glite -package=glite-yaim-myproxy -name=$Name$ -tag:=$(shell echo $(name) | sed 's/^[^:]*: //' ) -version:=$(shell echo "$(tag)" | sed 's/^.*R_//' | sed 's/_/\./g') -release:=$(shell echo "$(version)" | sed 's/.*\.//') -version:=$(shell echo "$(version)" | sed 's/\(.*\)\.[0-9]*/\1/') - -.PHONY: configure install clean rpm - -all: configure - -install: - @echo installing ... - @mkdir -p $(prefix)/yaim/functions - @mkdir -p $(prefix)/yaim/node-info.d - @mkdir -p $(prefix)/yaim/examples - @mkdir -p $(prefix)/yaim/examples/siteinfo - @mkdir -p $(prefix)/yaim/examples/siteinfo/services - @mkdir -p ${prefix}/share/man/man1 - @mkdir -p $(prefix)/yaim/etc/versions - - @install -m 0644 config/functions/config* $(prefix)/yaim/functions - @install -m 0644 config/node-info.d/glite* $(prefix)/yaim/node-info.d - @install -m 0644 config/services/glite* $(prefix)/yaim/examples/siteinfo/services/. - @install -m 0644 config/man/yaim-myproxy.1 ${prefix}/share/man/man1/ - @echo "$(package) $(version)-$(release)" > $(prefix)/yaim/etc/versions/$(package) - - -clean:: - rm -f *~ test/*~ etc/*~ doc/*~ src/*~ - rm -rf rpmbuild - -rpm: - @mkdir -p rpmbuild/RPMS/noarch - @mkdir -p rpmbuild/SRPMS/ - @mkdir -p rpmbuild/SPECS/ - @mkdir -p rpmbuild/SOURCES/ - @mkdir -p rpmbuild/BUILD/ - -ifneq ("$(tag)","ame:") - @sed -i 's/^Version:.*/Version: $(version)/' $(package).spec - @sed -i 's/^Release:.*/Release: $(release)/' $(package).spec -endif - @tar --gzip --exclude='*CVS*' -cf rpmbuild/SOURCES/${package}.src.tgz * - @rpmbuild -ba ${package}.spec - diff --git a/org.glite.yaim.myproxy/config/functions/config_gip_px b/org.glite.yaim.myproxy/config/functions/config_gip_px deleted file mode 100755 index e7f49e8..0000000 --- a/org.glite.yaim.myproxy/config/functions/config_gip_px +++ /dev/null @@ -1,52 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_gip_px -# -# DESCRIPTION : This function configures the generic information providor (GIP) -# for MyProxy (PX) node. -# -# AUTHORS : Shu-Ting.Liao@cern.ch -# -# NOTES : The config_gip_ function creates the ldif file. -# This is currently done by the function config_info_service_. -# This function is still included in the function list for cleaning tasks. -# -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## -config_gip_px_check () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_gip_px_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_gip_px () { - -CONF_DIR="$INSTALL_ROOT/glite/var/tmp/gip" -LDIF_DIR="${INSTALL_ROOT}/glite/etc/gip/ldif" - -rm -rf ${CONF_DIR}/glite-info-static-px.conf -rm -rf ${LDIF_DIR}/static-file-PX.ldif - -return 0 - -} diff --git a/org.glite.yaim.myproxy/config/functions/config_info_service_px b/org.glite.yaim.myproxy/config/functions/config_info_service_px deleted file mode 100644 index 06725d6..0000000 --- a/org.glite.yaim.myproxy/config/functions/config_info_service_px +++ /dev/null @@ -1,88 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_info_service_px -# -# DESCRIPTION : This function configures the dynamic service publisher -# for MyProxy (PX) node. -# -# AUTHORS : Maria.Alandes.Pradillo@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -config_info_service_px_check () { - requires $1 SITE_NAME INSTALL_ROOT PX_HOST -} - -config_info_service_px_setenv () { - yaimlog DEBUG "This function currently doesn't set any environment variables." -} - -config_info_service_px () { - -INFO_SERVICE_CONFIG=${INFO_SERVICE_CONFIG:-${INSTALL_ROOT}/glite/etc} -INFO_SERVICE_SCRIPT=${INFO_SERVICE_SCRIPT:-${INSTALL_ROOT}/glite/libexec} -INFO_PROVIDER_PATH=${INFO_PROVIDER_PATH:-${INSTALL_ROOT}/glite/etc/gip/provider} - -SERVICE=MYPROXY -SERVICE_HOST=${PX_HOST} - -SERVICE_LC=`echo ${SERVICE} | tr '[:upper:]' '[:lower:]'` - -if [ ! -f ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ]; then - yaimlog ERROR "The template file for glite-info-service-${SERVICE_LC}.conf.template was not found in ${INFO_SERVICE_CONFIG}." - exit 1 -fi - -if [ ! -f ${INFO_SERVICE_SCRIPT}/glite-info-service ]; then - yaimlog ERROR "The script file for glite-info-service was not found in ${INFO_SERVICE_SCRIPT}." - exit 1 -fi - -yaimlog DEBUG "Delete a previous version of the glite-info-service-${SERVICE_LC}.conf if it exists" -rm -rf ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -yaimlog DEBUG "Create the glite-info-service-${SERVICE_LC}.conf file out of the template file" -cp ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf.template ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf - -# Note: the configuration file may need to be altered if non standard values have been used. - -yaimlog DEBUG "Delete a previous version of the glite-info-provider-service-${SERVICE_LC}-wrapper if it exists" -rm -rf ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - -yaimlog DEBUG "Create the ${INFO_PROVIDER_PATH} in case it doesn't exist" -mkdir -p ${INFO_PROVIDER_PATH} - -yaimlog DEBUG "Create the glite-info-provider-service-${SERVICE_LC}-wrapper file" -cat << EOF > ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper -#!/bin/sh -export PATH=$PATH:${INFO_SERVICE_SCRIPT} -export ${SERVICE}_HOST=${SERVICE_HOST} -${INFO_SERVICE_SCRIPT}/glite-info-service ${INFO_SERVICE_CONFIG}/glite-info-service-${SERVICE_LC}.conf $SITE_NAME -EOF - -chmod +x ${INFO_PROVIDER_PATH}/glite-info-provider-service-${SERVICE_LC}-wrapper - - -return 0 - -} diff --git a/org.glite.yaim.myproxy/config/functions/config_proxy_server b/org.glite.yaim.myproxy/config/functions/config_proxy_server deleted file mode 100644 index eb6a60b..0000000 --- a/org.glite.yaim.myproxy/config/functions/config_proxy_server +++ /dev/null @@ -1,132 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : config_proxy_server -# -# DESCRIPTION : This function configures the 3.0 proxy server. -# -# AUTHORS : Robert.Harakaly@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# UPDATES: Ulrich.Schwickerath@cern.ch, Steve.Traylen@cern.ch -# -############################################################################## -# -# 21/05/2008 US,ML rewrite to support more configuration options -# - -config_proxy_server_check () { - -requires $1 BDII_USER BDII_GROUP BDII_HOME_DIR X509_HOST_CERT X509_HOST_KEY -return $? - -} - -config_proxy_server_setenv () { - -return 0 - -} - -config_proxy_server () { - -# Fix for bug 54094: BDII_USER needs copies of host cert and key -mkdir -p ${BDII_HOME_DIR}/.globus -cp ${X509_HOST_CERT} ${BDII_HOME_DIR}/.globus/usercert.pem -cp ${X509_HOST_KEY} ${BDII_HOME_DIR}/.globus/userkey.pem -chown -R ${BDII_USER}.${BDII_GROUP} ${BDII_HOME_DIR}/.globus - - -MYPROXY_CONF=${INSTALL_ROOT}/glite/etc/myproxy-server.conf -MYPROXY_CONF_NEW=${INSTALL_ROOT}/glite/etc/myproxy-server.conf_NEW - - -# Special case where we are upgrading from the old style configuration. -# with a configuration file myproxy-server.config file. -pgrep -lf myproxy-server.config 2>&1 > /dev/null -if [ $? = "0" ] ; then - yaimlog INFO "MyProxy Running with old style configuration, stopping" - /sbin/service myproxy stop -fi - - -yaimlog DEBUG "Creating Minimal myproxy configuration." -cat < $MYPROXY_CONF_NEW -# YAIM generated configuration file for MyProxy -# -# We allow anyone to use this service. They are checked against the -# installed CAs anyway. -# -accepted_credentials "*" - -EOF - -if [ "x$GRID_TRUSTED_BROKERS" != "x" ] ; then - yaimlog WARNING "Use of GRID_TRUSTED_BROKERS is deprecated in YAIM, use GRID_AUTHORIZED_RENEWERS" - echo "# Adding GRID_TRUSTED_BROKERS as authorized_renewers - Deprecated" >> $MYPROXY_CONF_NEW - split_quoted_variable $GRID_TRUSTED_BROKERS | while read x; do - test "x$x" != "x" && echo "authorized_renewers \"$x\"" >> $MYPROXY_CONF_NEW - done - echo "" >> $MYPROXY_CONF_NEW -fi - -for VALUE in GRID_AUTHORIZED_RENEWERS GRID_DEFAULT_RENEWERS \ - GRID_AUTHORIZED_RETRIEVERS GRID_DEFAULT_RETRIEVERS \ - GRID_AUTHORIZED_KEY_RETRIEVERS GRID_DEFAULT_KEY_RETRIEVERS \ - GRID_TRUSTED_RETRIEVERS GRID_DEFAULT_TRUSTED_RETRIEVERS - -do - KEY=`echo $VALUE | sed 's/^GRID_//' | tr "[:upper:]" "[:lower:]"` - echo "#Adding YAIM value $VALUE if any as $KEY values" >> $MYPROXY_CONF_NEW - split_quoted_variable ${!VALUE} | while read x; do - test "x$x" != "x" && echo "$KEY \"$x\"" >> $MYPROXY_CONF_NEW - done - echo "" >> $MYPROXY_CONF_NEW -done - -/sbin/chkconfig --add myproxy - -# -# check if the configuration changed and reload/replace only if necessary -# - -[ -f $MYPROXY_CONF ] && diff $MYPROXY_CONF_NEW $MYPROXY_CONF 2>&1 > /dev/null -rc=$? - -if [ $rc == 0 ]; then - yaimlog INFO "MyProxy server configuration unchanged" - rm -f $MYPROXY_CONF_NEW -else - yaimlog INFO "Reloading MyProxy server" - mv $MYPROXY_CONF_NEW $MYPROXY_CONF - /etc/init.d/myproxy reload < /dev/null -fi - -/etc/init.d/myproxy status 2>&1 > /dev/null -if [ $? != "0" ] ; then - yaimlog INFO "MyProxy server not running so starting" - /etc/init.d/myproxy start -fi - - - -return 0 -} diff --git a/org.glite.yaim.myproxy/config/man/yaim-myproxy.1 b/org.glite.yaim.myproxy/config/man/yaim-myproxy.1 deleted file mode 100644 index e8b3824..0000000 --- a/org.glite.yaim.myproxy/config/man/yaim-myproxy.1 +++ /dev/null @@ -1,86 +0,0 @@ -.TH "YAIM - Yet Another Installation Manager" 1 -.SH NAME -yaim \- YAIM (YAIM Aint an Installation Manager) is, as the name suggests, a way of configuring Grid Services. -The aim of YAIM is to provide a simple installation and configuration method that can be used to set up a simple Grid Site -but can be easily adapted and extended to meet the need of larger sites. The yaim-myproxy module is configuring the MyProxy server. - -.SH DESCRIPTION -The yaim-myproxy module allows you to configure the MyProxy server. - -.SH CONFIGURATION VARIABLES -This is the list of variables needed to set up in order to configure the MyProxy server. -.TP -For more details, please check: -.TP -.B https://twiki.cern.ch/twiki/bin/view/LCG/PX_configuration_variables -.TP -.B Mandatory Variables: -Site admins must ensure these variables are properly defined according to the features of the site -.TP -site-info.def variables: These variables are defined in /opt/glite/yaim/examples/site-info.def. -.TP -INSTALL_ROOT : Installation root - change if using the re-locatable distribution. -.TP -SITE_NAME : The GIIS of the site where the MyProxy server belongs to. -.TP -GLOBUS_TCP_PORT_RANGE: Port range for Globus IO. It should be specified as "num1,num2". YAIM automatically handles the syntax of this variable depending on the version of VDT. If it's VDT 1.6 it leaves "num1,num2". If it's a version < VDT 1.6 it changes to "num1 num2". -.TP -.TP -node specific variables: These variables are defined in /opt/glite/yaim/examples/services/glite-px. -.TP -GRID_TRUSTED_BROKERS : List of the DNs of the Resource Brokers host certificates which are trusted by the Proxy node. (ex: /O=Grid/O=CERN/OU=cern.ch/CN=host/testbed013.cern.ch). Now deprecated, use GRID_DEFAULT_RENEWERS instead. -.TP -GRID_AUTHORIZED_RENEWERS : List of authorized_renewrs. -.TP -GRID_DEFAULT_RENEWERS : List of default_renewers -.TP -GRID_AUTHORIZED_RETRIEVERS : List of authorized_retrievers. -.TP -GRID_DEFAULT_RETRIEVERS : List of default_retrievers. -.TP -GRID_AUTHORIZED_KEY_RETRIEVERS : List of authorized_key_retrievers. -.TP -GRID_DEFAULT_KEY_RETRIEVERS : List default_key_retrievers. -.TP -GRID_TRUSTED_RETRIEVERS : List of trusted_retrievers. -.TP -GRID_DEFAULT_TRUSTED_RETRIEVERS List of default_trusted_retrievers. -.TP - -.SH EXAMPLES -How to configure the Myproxy node. -.TP -.B ./yaim -c -s /root/site-info.def -n glite-PX -.TP -To debug the configuration process: -.TP -.B ./yaim -c -s /root/site-info.def -n glite-PX -d 6 - -.SH DOCUMENTATION -You can find useful information on these web pages: -.TP -Entry point for YAIM documentation: -.TP -.B https://twiki.cern.ch/twiki/bin/view/EGEE/YAIM -.TP -The Generic Installation and Configuration guides as well as the YAIM guides: -.TP -.B https://twiki.cern.ch/twiki/bin/view/LCG/LcgDocs -.TP -Useful links: -.TP -.B http://lcg.web.cern.ch/LCG/Sites/the-LCG-directory.html - -.SH AUTHORS -YAIM is a collaborative project where different modules are developed and maintened by different -groups. Here are some of the present contributors: -.TP -.B Maria Allandes Pradillo, Gergely Debreczeni, Laurence Field, \ -Di Qing, Andreas Unterkircher, Oliver Keeble, Steve Traylen, Owen Synge, Gavin Mccance , Maarten Litmaath, \ -and we are happy to receive patches from everybody ! - -.SH CONTACT -To contact YAIM people use the -.B yaim-contact@cern.ch -email address. - diff --git a/org.glite.yaim.myproxy/config/node-info.d/glite-px b/org.glite.yaim.myproxy/config/node-info.d/glite-px deleted file mode 100644 index 8230ef9..0000000 --- a/org.glite.yaim.myproxy/config/node-info.d/glite-px +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This function contains the function list that configures the 3.1 proxy server. -# -# AUTHORS : Shu-Ting.Liao@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -PX_FUNCTIONS=" -config_crl -config_host_certs -config_edgusers -config_gip_only -config_gip_px -config_gip_service_release -config_globus_clients -config_proxy_server -config_bdii_only -config_info_service_px -" - - diff --git a/org.glite.yaim.myproxy/config/node-info.d/glite-px_30 b/org.glite.yaim.myproxy/config/node-info.d/glite-px_30 deleted file mode 100644 index 260ce8f..0000000 --- a/org.glite.yaim.myproxy/config/node-info.d/glite-px_30 +++ /dev/null @@ -1,48 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This function contains the function list that configures the 3.0 proxy server. -# -# AUTHORS : Robert.Harakaly@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -BASE1_FUNCTIONS=" -config_ldconf -config_sysconfig_edg -config_sysconfig_globus -config_sysconfig_lcg -config_crl -config_rfio" - -PX_FUNCTIONS="${BASE1_FUNCTIONS} -config_host_certs -config_edgusers -config_java -config_rgma_client -config_gip -config_globus -config_proxy_server" - diff --git a/org.glite.yaim.myproxy/config/services/glite-px b/org.glite.yaim.myproxy/config/services/glite-px deleted file mode 100644 index cd80a88..0000000 --- a/org.glite.yaim.myproxy/config/services/glite-px +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################## -# Copyright (c) Members of the EGEE Collaboration. 2004. -# See http://www.eu-egee.org/partners/ for details on the copyright -# holders. -# -# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS -# OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -############################################################################## -# -# NAME : glite-px -# -# DESCRIPTION : This configuration file contains the list of variables needed -# to configure Myproxy together with site-info.def. -# -# AUTHORS : yaim-contact@cern.ch -# -# NOTES : -# -# YAIM MODULE: glite-yaim-myproxy -# -############################################################################## - -# GRID_TRUSTED_BROKERS: DNs of services (RBs) allowed to renew/retrives -# credentials from/at the myproxy server. Put single quotes around each trusted DN !!! - -# Deprecated -#GRID_TRUSTED_BROKERS=" -#'broker one' -#'broker two' -#" - - -GRID_AUTHORIZED_RENEWERS=${GRID_AUTHORIZED_RENEWERS:-""} -# WMS has traditionally used this next one. -GRID_DEFAULT_RENEWERS=${GRID_DEFAULT_RENEWERS:-""} -GRID_AUTHORIZED_RETRIEVERS=${GRID_AUTHORIZED_RETRIEVERS:-""} -GRID_DEFAULT_RETRIEVERS=${GRID_DEFAULT_RETRIEVERS:-""} -GRID_AUTHORIZED_KEY_RETRIEVERS=${GRID_AUTHORIZED_KEY_RETRIEVERS:-""} -GRID_DEFAULT_KEY_RETRIEVERS=${GRID_DEFAULT_KEY_RETRIEVERS:-""} - -# This is what NCG nagios solution uses this next one. -GRID_TRUSTED_RETRIEVERS=${GRID_TRUSTED_RETRIEVERS:-""} -GRID_DEFAULT_TRUSTED_RETRIEVERS=${GRID_DEFAULT_TRUSTED_RETRIEVERS:-""} - - diff --git a/org.glite.yaim.myproxy/glite-yaim-myproxy.spec b/org.glite.yaim.myproxy/glite-yaim-myproxy.spec deleted file mode 100644 index 7327334..0000000 --- a/org.glite.yaim.myproxy/glite-yaim-myproxy.spec +++ /dev/null @@ -1,41 +0,0 @@ -%define topdir %(pwd)/rpmbuild -%define _topdir %{topdir} -Summary: glite-yaim-myproxy module configures myproxy server. -Name: glite-yaim-myproxy -Version: x -Vendor: EGEE -Release: x -License: EGEE -Group: EGEE -Source: %{name}.src.tgz -BuildArch: noarch -Prefix: /opt/glite -Requires: glite-yaim-core >= 4.0.10-1 -BuildRoot: %{_tmppath}/%{name}-%{version}-build -Packager: EGEE - -%description -This package contains the yaim functions necessary to configure myproxy server. - -%prep - -%setup -c - -%build -make install prefix=%{buildroot}%{prefix} - -%files -%defattr(-,root,root) -%{prefix}/yaim/functions/config_* -%config(noreplace) %{prefix}/yaim/node-info.d/glite-* -%{prefix}/yaim/examples/siteinfo/services/glite-* -%{prefix}/share/man/man1/yaim-myproxy.1 -%{prefix}/yaim/etc/versions/%{name} -%doc LICENSE - - -%clean -rm -rf %{buildroot} - - - diff --git a/org.gridsite.core/.cvsignore b/org.gridsite.core/.cvsignore deleted file mode 100644 index e970233..0000000 --- a/org.gridsite.core/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -.project \ No newline at end of file diff --git a/org.gridsite.core/CHANGES b/org.gridsite.core/CHANGES deleted file mode 100644 index cf8f196..0000000 --- a/org.gridsite.core/CHANGES +++ /dev/null @@ -1,484 +0,0 @@ -- ==== GridSite version 1.7.13 ==== -* Tue Apr 5 13:00:24 2011 FrantiÅ¡ek Dvořák -- adding gridsite-1.5-compat in separated patch -* Tue Apr 5 12:58:10 2011 FrantiÅ¡ek Dvořák -- rpm packaging updates (guidelines, rpmbuild vs make rpm, optional build - dependencies) -- ==== GridSite version 1.7.12 ==== -* Tue Mar 18 19:04:15 CET 2011 Frantisek Dvorak -- Makefile distinguishes between -lgsoap and -lgsoapssl in cflags. -- Makefile: CFLAGS cleanup, HTTPD_FLAGS replaces httpd-specific cflags. -- Unresolved symbols from xml in _globus and _nossl library versions fixed. -- Compile and link flags of dependencies unified. -- Portability improvements -- ==== GridSite version 1.7.11 ==== -* Tue Mar 1 10:31:27 CET 2011 Daniel Kouril -- Support for using IPv6 -* Tue Feb 22 2011 Zdenek Sustr - - Extended formulation of dependencies btw. packages - to fix conflicts when upgrading from EPEL. -* Tue Nov 23 2010 Andrew McNab -- ==== GridSite version 1.7.10 ==== -* Mon Nov 22 2010 Andrew McNab -- Patch to grst_x509.c VOMS verification from - Daniel Kouril -* Tue Nov 2 2010 Andrew McNab -- ==== GridSite version 1.7.9 ==== -* Tue Nov 2 2010 Andrew McNab -- Fix free of grst->serial string in grst_x509.c -* Wed Oct 29 2010 Andrew McNab -- ==== GridSite version 1.7.8 ==== -* Tue Oct 12 2010 Andrew McNab -- Cert serial number now represented as a string - rather than an int -* Wed Sep 1 2010 Andrew McNab -- Support hashes other than MD5 for VOMS ACs to - address Bug #72185 -* Wed Apr 7 2010 Andrew McNab -- ==== GridSite version 1.7.7 ==== -* Wed Mar 31 2010 Andrew McNab -- Introduce SSLSrvConfigRec_server macro to take - this into account when accessing the *server member -* Tue Mar 30 2010 Andrew McNab -- Apply patch to mod_gridsite.c from Jan Just Keijser - to detect change to - SSLSrvConfigRec etc in "sslireneg" patch to mod_ssl -* Fri Nov 27 2009 Andrew McNab -- GRSTx509MakeProxyCert() now creates RFC 3280 - proxies if any earlier proxies are RFC style -* Tue Nov 10 2009 Andrew McNab -- Discard X509_V_ERR_PROXY_CERTIFICATES_NOT_ALLOWED - errors in GRST_callback_SSLVerify_wrapper(), needed - for newer OpenSSL -* Mon Oct 19 2009 Andrew McNab -- Discard X509_V_ERR_INVALID_PURPOSE errors in - GRST_callback_SSLVerify_wrapper(), needed by - OpenSSL 0.9.8e -* Thu Sep 17 2009 Andrew McNab -- GRSThttpUrlEncode rather than GRSThttpUrlMildencode - in mod_gridsite directory listings. -* Fri Sep 11 2009 Andrew McNab -- Include GRSTgaclUserFree() memory leak fix in - mod_gridsite_perm_handler() in mod_gridsite.c -* Mon Aug 10 2009 Andrew McNab -- Fix %016lx specification when creating passcodes. -* Fri Aug 7 2009 Andrew McNab -- ==== GridSite version 1.7.6 ==== -* Wed Jul 29 2009 Andrew McNab -- When creating proxies with GRSTx509MakeProxyCert, - use 2=v3 rather than the old 3=v4 Globus behaviour. - See Bug #53721 from Joni Hahkala. -* Fri Jul 23 2009 Andrew McNab -- ==== GridSite version 1.7.5 ==== -* Thu Jul 23 2009 Andrew McNab -- Check multiple VOMS issuer certs if present, and - use most permissive time range they provide to - resolve Bug #53497 -- Change (GRSTerrorLogFunc) to return int, to allow - if-less C macro using && instead. -- Remove 2 argument open(...O_CREAT...) instance in - grst_admin_file.c -- Fix Bug #53314 due to change in VOMS (user cert DN - vs user cert issuer's DN) -* Fri Jul 03 2009 Andrew McNab -- ==== GridSite version 1.7.4 ==== -* Thu Jul 02 2009 Andrew McNab -- Use lib/lib64 for mod_gridsite.so location in - Makefile and make-gridsite-spec -* Wed Jul 01 2009 Andrew McNab -- ==== GridSite version 1.7.3 ==== -* Wed Jul 01 2009 Andrew McNab -- Tidy up debugging messages -- Fix URL encoding bug in DN lists (' ' vs '+') -* Tue Jun 30 2009 Andrew McNab -- ==== GridSite version 1.7.2 ==== -* Tue Jun 30 2009 Andrew McNab -- Merge in VOMS LSC support -* Tue Jun 30 2009 Andrew McNab -- ==== GridSite version 1.7.1 ==== -* Thu Jan 29 2009 Andrew McNab -- Merge in private version changes from Yibiao Li. -- Merge in major 1.7.x vs 1.5.x divergences. -* Fri Feb 8 2008 Andrew McNab -- ==== GridSite version 1.7.0 ==== -* Thu Nov 15 2007 Andrew McNab -- Add libgridsite_nossl.[so|a] with no dependencies - on OpenSSL (for gLite L&B.) -* Thu Nov 15 2007 Andrew McNab -- ==== GridSite version 1.5.7 ==== -* Fri Nov 9 2007 Andrew McNab -- Many changes, including switch to AURI internal - format for credentials -* Fri Nov 9 2007 Andrew McNab -- ==== GridSite version 1.5.5 ==== -* Wed Jun 13 2007 Andrew McNab -- Include ctx->param->flags fix in mod_gridsite for - OpenSSL 0.9.8 from Bruno Harbulot. -- Restrict export of VOMS attributes to ones present - in the last proxy of the chain to contain attributes -* Fri May 10 2007 Andrew McNab -- ==== GridSite version 1.5.1 ==== -* Fri Feb 16 2007 Andrew McNab -- ==== GridSite version 1.5.0 ==== -* Fri Feb 16 2007 Andrew McNab -- ==== GridSite version 1.4.0 ==== -* Thu Feb 15 2007 Andrew McNab -- Final preparations for 1.4.x -* Fri Sep 22 2006 Andrew McNab -- Transfer htproxyinfo utility functions into - grst_x509.c (GRSTx509ChainLoadCheck etc) -* Wed Aug 6 2006 Andrew McNab -- ==== GridSite version 1.3.4 ==== -* Mon Jul 17 2006 Andrew McNab -- Add Shibboleth handling from Joseph Dada's branch to - mod_gridsite in main GridSite tree. -* Tue Jun 27 2006 Andrew McNab -- Merge delegation services back into core. -- Add OCSP options -* Thu Jun 22 2006 Andrew McNab -- Lots of additions to SiteCast/SlashGrid, including - /grid/local/ filesystem with DNs from gridmapdir -- GridSiteCastAlias now allows any URL scheme (gsiftp, - xrootd, ...) not just HTTP(S). -- Replace static gridsite.spec with make-gridsite-spec -* Fri Jun 9 2006 Andrew McNab -- Add patch from Jan Pospisil to - Makefile, to allow standalone building of libraries. -- Include code for June 2006 version of delegation - protocol (ie userproxy.pem rather than usercert.pem - and userkey.pem) -* Thu Jun 8 2006 Andrew McNab -- SiteCast support in SlashGrid -* Mon Jun 5 2006 Andrew McNab -- ==== GridSite version 1.3.1 ==== -* Sun May 26 2006 Andrew McNab -- Include SlashGrid code, and in gridsite.spec etc -- Add sample fuse.spec to docs for use with SlashGrid -* Fri May 26 2006 Andrew McNab -- ==== GridSite version 1.3.0 ==== -* Mon Apr 24 2006 Andrew McNab -- Reworked SSL session caching: passcodes directory now - because /var/www/sessions by default, and also used - to cache credentials according to SSL Session ID. -* Mon Apr 10 2006 Andrew McNab -- Patch from Alberto di Meglio - to allow use of relocated httpd include files. -* Mon Apr 3 2006 Andrew McNab -- Use dist for building tar balls -* Mon Apr 3 2006 Andrew McNab -- ==== GridSite version 1.1.19 ==== -* Fri Mar 31 2006 Andrew McNab -- Final tidy up for gLite 3.1 -* Fri Mar 31 2006 Andrew McNab -- ==== GridSite version 1.1.18 ==== -* Wed Mar 29 2006 Andrew McNab -- New proxy destroy and time functions. -* Tue Mar 28 2006 Shiv Kaushal -- Fixed bug in GACL admin interface that would cause - internal server erorr sometimes when adding new - entries to and ACL. -* Sat Mar 25 2006 Shiv Kaushal -- Change delegation header to Proxy-Delegation-Service - instead of Grst- -* Wed Mar 22 2006 Andrew McNab -- Add GRSTx509MakeDelegationID() to grst_x509.c -- Include code for new style delegation proxy storage -* Fri Mar 17 2006 Andrew McNab -- Associate ldconfig %post in spec with -shared RPM -* Thu Mar 16 2006 Andrew McNab -- Fixes for 200/201 error pages produced by Apache -- Fixes for onetime passcode non-removal if HTTPS -- Include new multi-RPM spec file: gridsite-shared, - gridsite-devel, gridsite-apache, gridsite-commands - (replacing htcp) and gridsite-gsexec -* Fri Mar 03 2006 Shiv Kaushal -- Modify GridSiteDelegationURI directive to insert HTTP - headers instead of modifying HTML -* Mon Feb 6 2006 Shiv Kaushal -- Add GridSiteDelegationURI directive to mod_gridsite - to allow Firefox extension to locate delegation service -* ==== GridSite version 1.1.17 ==== -* Thu Jan 12 2005 Andrew McNab -- Add 5 minute window for VOMS attributes valid slightly - in the future. -- Include Content-Range PUT support in mod_gridsite, - adapted from mod_dav by David O Callaghan -- Return 201 Created when PUT creates a file -* Mon Dec 5 2005 Andrew McNab -- Change GRIDHTTP_ONETIME to GRIDHTTP_PASSCODE -- Remove onetime=yes default from mod_gridsite -- Update gridsite.spec and Makefile for gridsite-copy.cgi -* Wed Nov 16 2005 Andrew McNab -- ==== GridSite version 1.1.16 ==== -* Wed Nov 16 2005 Andrew McNab -- Add -fPIC option to Makefile for IA64, as suggested - by Andreas Unterkircher. -* Wed Oct 12 2005 Andrew McNab -- ==== GridSite version 1.1.15 ==== -* Wed Oct 12 2005 Andrew McNab -- Fix for older OpenSSL to grst_x509.c from - Zoltan.Farkas -* Wed Oct 12 2005 Andrew McNab -- ==== GridSite version 1.1.14 ==== -* Tue Oct 11 2005 Andrew McNab -- Modify VOMS AC parsing to handle multiple ACs inside - the same X.509 AC extension. -* Mon Oct 10 2005 Andrew McNab -- ==== GridSite version 1.1.13 ==== -* Mon Oct 10 2005 Andrew McNab -- Add target_gname patch to gsexec from - Gerben Venekamp -* Thu Oct 6 2005 Andrew McNab -- Fix session reuse with Shared-Memory SSL Session - Cache bug #8856 in mod_gridsite. -- Add SiteCast support to file copying in htcp. -* Tue Oct 4 2005 Andrew McNab -- Move User, Config, Admin and Install guides from - doc directory into GridSite Wiki. -- Create/update man pages for htcp, mod_gridsite and - gsexec to be distributed with source/binaries. -* Mon Oct 3 2005 Andrew McNab -- Fix to gsexec GRST_CRED_0/SSL_CLIENT_S_DN bug found - by Ian Stokes-Rees -* Fri Sep 30 2005 Andrew McNab -- Add SiteCast ping (NOP) support to htcp -* Thu Sep 29 2005 Andrew McNab -- Add SiteCast support to mod_gridsite (file location - discovery via UDP multicast of HTCP messages.) -* Wed Sep 21 2005 Andrew McNab -- Add ports 777 and 488 to example httpd.conf files in - docs. See http://www.gridsite.org/wiki/IP_Ports -* Tue Sep 13 2005 Andrew McNab -- ==== GridSite version 1.1.12 ==== -* Tue Sep 13 2005 Andrew McNab -- Fix bug #10031 submitted by Fabrizio Pacini - (invalid free in - GRSTgaclAclLoadFile if ACL format not valid.) -* Mon Sep 12 2005 Andrew McNab -- Accept GRIDHTTP_ONETIME when passed in HTTP query - (still overridden by a GRIDHTTP_ONETIME in a cookie.) -* Sat Sep 10 2005 Andrew McNab -- Fix problem with attempted upgrades to GridHTTP when - already on the HTTP virtual server. -* Fri Sep 9 2005 Andrew McNab -- GRST_DESTINATION_TRANSLATED and GRST_DESTINATION_PERM - environment variables, for use with CGI-based COPY. -- Rework GridHTTP (ex-Downgrade) code to store method - and URI with permission, rather than credentials. -- Restrict use of GridSiteOnetimesDir to main server. -* Fri Aug 26 2005 Andrew McNab -- Fix for HTTP PUT lack-of-truncation bug found by - Mike Jones, and support for HTTP/WebDAV MOVE. -- Add MOVE support to htcp and update htcp manpage. -- Unset CURLOPT_SSL_VERIFYPEER in htcp etc when using - --noverify option. -* Fri Jun 10 2005 Andrew McNab -- ==== GridSite version 1.1.11 ==== -* Fri Jun 10 2005 Andrew McNab -- Tidy up gsexec vs GridSiteDiskMode -* Fri Jun 10 2005 Andrew McNab -- ==== GridSite version 1.1.10 ==== -* Wed Jun 8 2005 Andrew McNab -- Add GridSiteDiskMode Apache directive to set file - permissions. -- Add GridSiteExecMethod and GridSiteUserGroup to - configure suexec or extended gsexec functionality. -* Thu Jun 2 2005 Andrew McNab -- HTML improvements for Bug #4083 -- Note that GridSite currently doesn't work with SHM - SSL session cache, in httpd-*.conf and config guide. -- Add GridSiteExecMethod for use with gsexec -* Thu May 26 2005 Andrew McNab -- Include gsexec, a drop-in replacement for suexec, - which can do suexec execution of CGI programs or - pool-account mapping based on client DN. -* Tue May 24 2005 Shiv Kaushal -- Add XACML support to GACL code in libgridsite. -* Tue May 24 2005 Andrew McNab -- ==== GridSite version 1.1.9 ==== -* Mon Apr 25 2005 Andrew McNab -- Avoid build problems when using pre-0.9.7 OpenSSL - (ie with Globus compatibility.) -* Mon Apr 25 2005 Andrew McNab -- ==== GridSite version 1.1.8 ==== -* Mon Feb 28 2005 Andrew McNab -- Fix to GRSTgaclUndenyPerm in gridsite.h (bug #7135) - from Marco Sottilaro -* Mon Feb 28 2005 Andrew McNab -- ==== GridSite version 1.1.7 ==== -* Thu Feb 24 2005 Andrew McNab -- Add more sanity checking (signatures, dates, issuer,) - holder) to VOMS attribute parser. -* Mon Feb 21 2005 Andrew McNab -- Add bugfix for Bug #6357 from Fabrizio Pacini - to fix delegation proxy - cache names in OpenSSL 0.9.7. -* Sun Feb 20 2005 Andrew McNab -- Add basic VOMS support (signature checking not yet - in) for X.509 Attribute Certificates. -* Tue Feb 8 2005 Andrew McNab -- ==== GridSite version 1.1.6 ==== -* Tue Feb 8 2005 Andrew McNab -- Include GRSTx509MakeProxyFileName() and - GRSTx509StringToChain() (code to used hashes in cached - proxy file names.) Bug #6357 -- Change ordering of output proxy file produced by - GRSTx509CacheProxy so proxy private key is the 2nd PEM - encoded block (rather than at the end.) Bug #6365 -- Add libgridsite_globus[.so|.a] in preparation for - separate Globus OpenSSL and system OpenSSL versions -* Tue Feb 8 2005 Andrew McNab -- ==== GridSite version 1.1.5 ==== -* Tue Dec 14 2004 Andrew McNab -- Patch from Daniel Kouril to allow - switching Globus vs system OpenSSL libraries/headers. -* Tue Dec 14 2004 Andrew McNab -- ==== GridSite version 1.1.4 ==== -* Mon Nov 15 2004 Andrew McNab -- Back out of (most of) redone VOMS support for committing - to JRA1 CVS. -* Thu Oct 19 2004 Andrew McNab -- ==== GridSite version 1.1.3 ==== -* Thu Oct 19 2004 Andrew McNab -- Fix Bug #5203 from Martijn Steenbakkers - by fixing GACLparseEntry in gridsite-gacl.h -- Change to C style comments (mostly) in gridsite.h and - gridsite-gacl.h (fixes part of Bug #4222 from - ) -- Fix Bug #4225 from in - GRSTgaclCredsFree() -- Add GRSTx509CachedProxyFind() and findproxyfile - command to allow proxies to be found in proxy cache -- Change GRSTx509StoreProxy() to GRSTx509CacheProxy() for - consistency with this and GRSTx509CachedProxyKeyFind() -* Wed Oct 18 2004 Andrew McNab -- ==== GridSite version 1.1.2 ==== -* Tue Oct 19 2004 Andrew McNab -- Copy code from delegation prototype into grst_x509.c - and include htproxyput.c and grst-delegation.c - optional targets (which depend on gSOAP.) -* Wed Oct 13 2004 Andrew McNab -- Include per-file patch to GRSTgaclFileFindAclname: - .gacl:FILENAME controls FILENAME if it exists. -* Tue Jul 27 2004 Andrew McNab -- ==== GridSite version 1.1.1 ==== -* Tue Jul 27 2004 Andrew McNab -- Include HTTP Downgrade support in htcp -* Sat Jul 24 2004 Andrew McNab -- Include HTTP Downgrade support in mod_gridsite. -* Thu Jul 22 2004 Andrew McNab -- Begin development version 1.1.x -* Thu Jul 22 2004 Andrew McNab -- ==== GridSite version 1.1.0 ==== -* Mon Jul 19 2004 Andrew McNab -- Changes in line with EGEE SCM - most importantly - the top level directory becomes org.gridsite.core -* Mon Jul 19 2004 Andrew McNab -- ==== GridSite version 1.0.3 ==== -* Mon Jun 28 2004 Andrew McNab -- In GRSTx509CheckChain() and GRSTx509CompactCreds() - we now accept the first cert in a chain as a CA - even if it is X509v3 but without the CA bits set. - (On the basis that the first chain is from the - administrator-installed CA files store.) -* Sun Jun 27 2004 Andrew McNab -- ==== GridSite version 1.0.2 ==== -* Sun Jun 27 2004 Andrew McNab -- Fix for Bug #2860 (so can now read DN Lists over - HTTPS when have no user certificate if relevant - .gacl gives permission but not ) -- Include gridsite-gacl.h mods from Daniel Kouril - to fix faulty definitions - of GACLnewEntry() and GACLnewAcl() and to make - a legacy non-static GACLparseEntry() wrapper. -* Thu Jun 17 2004 Andrew McNab -- Changes to mod_gridsite.h for Fedora Core 2 / - Apache 2.0.49+ mod_ssl changes (mod_ssl-private.h) -* Wed Jun 9 2004 Andrew McNab -- Incorporate EGEE CVS layout changes in production - branch. -* Wed Jun 9 2004 Andrew McNab -- ==== GridSite version 1.0.1 ==== -* Sun Dec 14 2003 Andrew McNab -- 1.0.0 is first full production release - (development now in 1.1.x branch) -* Sun Dec 14 2003 Andrew McNab -- ==== GridSite version 1.0.0 ==== -* Sat Dec 13 2003 Andrew McNab -- Remove need for modified mod_ssl-gridsite: now - mod_gridsite intercepts callbacks with wrappers. -- Add GRSTx509NameCmp() which compares string reps of - DNs across OpenSSL version changes (ie Email=) -* Fri Dec 12 2003 Andrew McNab -- ==== GridSite version 0.9.11 ==== -* Thu Dec 11 2003 Andrew McNab -- Simplify checking of cert/proxy chain in - mod_ssl-gridsite: rely on mod_ssl/OpenSSL more. -* Wed Dec 2 2003 Andrew McNab -- ==== GridSite version 0.9.10 ==== -* Tue Dec 1 2003 Andrew McNab -- GACL ignores leading/trailing spaces in values. -* Sat Nov 29 2003 Andrew McNab -- Better directory listing in htcp. -- htcp now built as separate binary RPM. -- gridsite-admin.cgi upload now redirects to same - directory after upload (Bug #1939); allows - optional new name for file (Request / Bug #1940); - and has better checking of ../dir/file attacks. -* Sat Nov 29 2003 Andrew McNab -- ==== GridSite version 0.9.8 ==== -* Thu Nov 27 2003 Andrew McNab -- Shiv's updated GACL editor, with redirects. -* Wed Nov 26 2003 Andrew McNab -- Include Daniel Stenberg's roffit script to make - HTML man pages for htcp and urlencode. -- Various fixes found when installing GridPP WWW. -* Wed Nov 26 2003 Andrew McNab -- ==== GridSite version 0.9.7 ==== -* Thu Nov 20 2003 Andrew McNab -- Major updates to htcp (htrm/htls/htll) -- GACL now recurses subdirectories when examining - the DN List directories path. -* Sat Nov 15 2003 Andrew McNab -- ==== GridSite version 0.9.6 ==== -* Fri Nov 14 2003 Andrew McNab -- Function call fixes in grst-admin.cgi -* Thu Nov 13 2003 Andrew McNab -- Add htcp (curl-url-get reborn) -* Thu Nov 13 2003 Andrew McNab -- ==== GridSite version 0.9.5 ==== -* Thu Nov 13 2003 Andrew McNab -- More grst-admin.cgi GACL updates from Shiv. -- .gacl security improvements to grst-admin.cgi from - Shiv Kaushal and Peter Moore. -* Tue Nov 11 2003 Andrew McNab -- One RPM instead of three, with version from VERSION -- Textarea for HTML/Text editing now 80 columns -* Mon Nov 10 2003 Andrew McNab -- Add delegation level and GridSiteGSIProxyLimit - support. -- Add GridSiteAdminList handling to mod_gridsite - and real-gridsite-admin.cgi -* Sun Nov 9 2003 Andrew McNab -- Add directory create/delete, and file/dir rename. -- Add ZIP listing/unzipping via external unzip - utility from http://www.info-zip.org/pub/infozip/ -* Mon Nov 3 2003 Andrew McNab -- Include next version of Shiv's GACL editor. -- Add rpm-usr target to Makefile, to make RPMs - out-of-the-box compatible with RH9 and its Apache2 -- Use REMOTE_DOUBLE_REV for GACL hostname creds in - mod_gridsite.c/mod_gridsite_perm_handler() -* Sun Oct 26 2003 Andrew McNab -- Include GACL editor in real-gridsite-admin.cgi - from Shiv Kaushal -* Sun Oct 26 2003 Andrew McNab -- Reorganise into a single build tree, including - Apache 2.0 .h files to remove circular dependency. -* Sun Oct 26 2003 Andrew McNab -- ==== GridSite version 0.9.4 ==== -* Sun Oct 19 2003 Andrew McNab -- Include many pieces of GridSite code from 0.3.x (CGI) - fileGridSite and mod_gridsite 0.9.0 -* Sun Oct 19 2003 Andrew McNab -- ==== GridSite version 0.9.3 ==== diff --git a/org.gridsite.core/INSTALL b/org.gridsite.core/INSTALL deleted file mode 100644 index 4943047..0000000 --- a/org.gridsite.core/INSTALL +++ /dev/null @@ -1,37 +0,0 @@ -BUILDING/INSTALLING GRIDSITE -============================ - -For more detailed instructions, see the Installation and Build -pages in the GridSite Wiki http://www.gridsite.org/wiki/ - -GridSite is currently only supported on Linux, but should be -trivially portable to other Unix platforms where the GNU build -tools are available. - -When building from source, two routes are available: building -with Make or with RPM. - -BUILDING WITH MAKE -================== - -make -make install - -will build all components and install them all under the default -locations of /usr/local/[lib|bin|include|sbin] The default prefix -/usr/local is set by the prefix variable in the top level Makefile - -BUILDING WITH RPM -================= - -For RedHat Linux and derivatives, building with RPM is recommended. -The command - -make rpm - -will build the gridsite and htcp binary RPMs in the directory -../RPMTMP/RPMS/i386 relative to the working directory. A SRPM is -put into ../RPMTMP/SRPMS - -Building with RPM uses the default prefix /usr, although the -resulting RPMs are relocatable to other hierarchies. diff --git a/org.gridsite.core/LICENSE b/org.gridsite.core/LICENSE deleted file mode 100644 index befd74b..0000000 --- a/org.gridsite.core/LICENSE +++ /dev/null @@ -1,47 +0,0 @@ -Copyright (c) 2002-5, Andrew McNab and Shiv Kaushal, -University of Manchester. All rights reserved. - -Redistribution and use in source and binary forms, with or -without modification, are permitted provided that the following -conditions are met: - - o Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. - o Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials - provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -POSSIBILITY OF SUCH DAMAGE. - - -Clearly marked portions of the published GridSite source code -are derived from Apache httpd or its modules, and are covered -by the Apache Software License: - -Copyright 2001-2005 The Apache Software Foundation - -Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. diff --git a/org.gridsite.core/README b/org.gridsite.core/README deleted file mode 100644 index df81f32..0000000 --- a/org.gridsite.core/README +++ /dev/null @@ -1,6 +0,0 @@ -See INSTALL for build and installation instructions, and the -man pages for reference information. - -The GridSite Wiki at http://www.gridsite.org/wiki/ has guides -( http://www.gridsite.org/wiki/Category:Guides ) and cookbook -examples ( http://www.gridsite.org/wiki/Category:Cookbooks ) diff --git a/org.gridsite.core/VERSION b/org.gridsite.core/VERSION deleted file mode 100644 index 063aae5..0000000 --- a/org.gridsite.core/VERSION +++ /dev/null @@ -1,5 +0,0 @@ -MAJOR_VERSION=1 -MINOR_VERSION=1.7 -PATCH_VERSION=1.7.13 -DEFVERSION=010713 -VERSION=$(PATCH_VERSION) diff --git a/org.gridsite.core/build.xml b/org.gridsite.core/build.xml deleted file mode 100644 index 0f47b59..0000000 --- a/org.gridsite.core/build.xml +++ /dev/null @@ -1,294 +0,0 @@ - - - - - - - Ant build file to build the Gridsite Core Component - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ${global.prefix} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - New tag is ${cvs.label} - - - - - - - - - - - - - - - - - - New tag is ${cvs.label} - - - - - - - - - - - - - - - - - diff --git a/org.gridsite.core/doc/README.htcp-bin b/org.gridsite.core/doc/README.htcp-bin deleted file mode 100644 index ac546fc..0000000 --- a/org.gridsite.core/doc/README.htcp-bin +++ /dev/null @@ -1,13 +0,0 @@ -Binaries (and links) are in ./bin; man pages are in ./man/man1 - -Install by copying binaries/links onto your path, or by copying htcp -and making symbolic links to htcp from htls, htll, htrm and htmkdir. - -All the .1 man pages should be copied to a suitable ./man/man1 -directory on your man path. - -If you just want to install htcp in /usr/local, then unpacking this -tgz file in /usr/local should do the trick. (Delete this README when -you're finished!) - -For more about htcp see http://www.gridsite.org/ diff --git a/org.gridsite.core/doc/build-apache2.sh b/org.gridsite.core/doc/build-apache2.sh deleted file mode 100644 index 507be31..0000000 --- a/org.gridsite.core/doc/build-apache2.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/bin/sh -# -# Copyright (c) 2002-3, Andrew McNab, University of Manchester -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or -# without modification, are permitted provided that the following -# conditions are met: -# -# o Redistributions of source code must retain the above -# copyright notice, this list of conditions and the following -# disclaimer. -# o Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials -# provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -# CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS -# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, -# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED -# TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON -# ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -#--------------------------------------------------------------- -# For more information about GridSite: http://www.gridsite.org/ -#--------------------------------------------------------------- -# -# This script takes an Apache .tar.gz as the single command line argument, -# unpacks the file, modifies the httpd.spec it contains to work without -# the "-C" option to configure (which RedHat 7.3 doesnt like) and -# outputs source and binary RPMs in SRPMS and RPMS/i386 - -if [ "$1" = "" ] ; then - echo Must give a tar.gz file name - exit -fi - -export MYTOPDIR=`pwd` - -if [ -x /usr/bin/rpmbuild ] ; then - export RPMCMD=rpmbuild -else - export RPMCMD=rpm -fi - -echo "$1" | grep '\.tar\.gz$' >/dev/null 2>&1 -if [ $? = 0 ] ; then # a gzipped source tar ball - - rm -Rf $MYTOPDIR/BUILD $MYTOPDIR/BUILDROOT $MYTOPDIR/SOURCES - mkdir -p $MYTOPDIR/SOURCES $MYTOPDIR/SPECS $MYTOPDIR/BUILD \ - $MYTOPDIR/SRPMS $MYTOPDIR/RPMS/i386 $MYTOPDIR/BUILDROOT - - shortname=`echo $1 | sed 's:^.*/::' | sed 's:\.tar\.gz$::'` - - cp -f $1 SOURCES - - tar zxvf SOURCES/$shortname.tar.gz $shortname/httpd.spec - cp -f $shortname/httpd.spec SPECS - - sed -e 's/configure -C /configure /' \ - SPECS/httpd.spec >SPECS/httpd-2.spec - - $RPMCMD --define "_topdir $MYTOPDIR" \ - -ba --buildroot $MYTOPDIR/BUILDROOT SPECS/httpd-2.spec - - exit -fi - -echo I dont recognise the file type (must be .tar.gz) - -exit diff --git a/org.gridsite.core/doc/delegation-1.1.0.wsdl b/org.gridsite.core/doc/delegation-1.1.0.wsdl deleted file mode 100644 index df7e1f2..0000000 --- a/org.gridsite.core/doc/delegation-1.1.0.wsdl +++ /dev/null @@ -1,459 +0,0 @@ - - - - - - - - - - The cause of the delegation exception on the server side. - - - - - - - - - - New proxy certificate request, containing the certificate - request and a generated delegation ID. - - - - - - - The new RFC 3280 style proxy certificate request - in PEM format with Base64 encoding. - - - - - - - The ID associated with the new delegation session. - - - - - - - - - - - - The ID of the new delegation session, specified by the client. - The ID can be empty. - - - - - - - The new RFC 3280 style proxy certificate request - in PEM format with Base64 encoding. - - - - - - - - The ID of an already existing delegation session, - initiated by getProxyReq() or getNewProxyReq(). - - - - - RFC 3280 style proxy certificate, signed by the - client, in PEM format with Base64 encoding. - - - - - - - - - The ID of an already existing delegation session, - where the client wants to renew the delegated - credential. - - - - - - - The new RFC 3280 style proxy certificate request, - which is to replace the existing one, - in PEM format with Base64 encoding. - - - - - - - - - The server side generated ID of the new delegation - session and the new RFC 3280 style proxy certificate - request in PEM format with Base64 encoding. - - - - - - - - The ID of an already existing delegation session to be queried. - - - - - - - The date and time when the delegated credentials will expire. - - - - - - - - The ID of an already existing delegation session to be destroyed. - - - - - - - - - - - - Delegation interface. - - - - - - Starts the delegation procedure by asking for a certificate - signing request from the server. The server answers with a - certificate signing request which includes the public key - for the new delegated credentials. putProxy() has to be - called to finish the procedure. - - - - Check if a delegation ID was provided. If not, generate a delegation - id by hashing the client DN and client VOMS attributes. - - - Check if the delegation ID already exists in the - storage-area. If it does - (a credential renewal is happening), check - existing info (DN and VOMS attributes) against client info. - Throw exception if they do not match. - - - Create a new private/public key-pair (see also Key - Generation Semantics). - - - Generate a new proxy certificate request. - - - Store private key and cert request in - storage-cache-area, along with the - requesting DN and VOMS attributes. - - - - - - - - The client's DN and VOMS attributes do not match the stored ones, - i.e. the client is not authorized. - - - - - - - - Starts the delegation procedure by asking for a certificate - signing request from the server. The server answers with a - certificate signing request which includes the public key - for the new delegated credentials. putProxy() has to be - called to finish the procedure. - - - - Generate a delegation - ID by hashing the client DN and client VOMS attributes. - - - Check if the delegation ID already exists in the - storage-area. If it does, check - existing info (DN and VOMS attributes) against client info. - Throw exception if they do not match, because then this is - the rare case of hash collision, i.e. two different clients - are mapped to the same delegation ID. - - - Create a new private/public key-pair (see also Key - Generation Semantics). - - - Generate a new certificate request. - - - Store private key and cert request in - storage-cache-area, along with the - requesting DN and VOMS attributes. - - - - - - - - There were already credentials associated to the delegation ID. - - - - - - - - Finishes the delegation procedure by sending the signed - proxy certificate to the server. - - - - Check if a delegation ID was provided. If not, generate a - delegation id by hashing the client DN and client VOMS - attributes. - - - Check if the delegation ID already exists in the - storage-area. If it does, check - existing info (DN and VOMS attributes) against client info. - Throw exception if it does not match. - - - Check, if client information matches proxy information. - - - Check given proxy against private key of delegation ID in - storage-cache-area. If they do not - match, throw exception. - - - Store proxy in storage-area - and clean up the storage-cache-area. - - - - - - - - - There were no cached credentials associated to the delegation ID - (neither - getNewProxyReq() nor - - renewProxyReq() was called previously), - or the client's DN and VOMS attributes do not match the stored ones, - i.e. the client is not authorized. - - - - - - - - - Restarts the delegation procedure by asking for a certificate - signing request from the server for an already existing delegation ID. - The server answers with a certificate signing request which includes - the public key for new delegated credentials. putProxy() has to be - called to finish the procedure. - - - - Check if a delegation ID was provided. If not, generate a delegation - id by hashing the client DN and client VOMS attributes. - - - Check if the delegation ID already exists in the - storage-area. If it does - not, then throw an exception. - - - Check if the existing info (DN and VOMS attributes) against client info. - Throw exception if they do not match. - - - Create a new private/public key-pair (see also Key - Generation Semantics). - - - Generate a new certificate request. - - - Store private key and cert request in - storage-cache-area, along with the - requesting DN and VOMS attributes. - - - - - - - - There were no credentials associated to the delegation ID, or the - client's DN and VOMS attributes do not match the stored ones, i.e. - the client is not authorized. - - - - - - - Returns the termination (expiration) date and time of the credential, - associated with the given delegaion ID. If there was no delegation ID, - then generate one by hashing the client DN and client VOMS attributes. - - - - - - There were no credentials associated to the delegation ID, or the - client's DN and VOMS attributes do not match the stored ones, i.e. - the client is not authorized. - - - - - - - - Destroys the delegated credentials associated with the - given delegation ID immediately. If there was no delegation ID, - then generate one by hashing the client DN and client VOMS attributes. - - - - - - There were no credentials associated to the delegation ID, or the - client's DN and VOMS attributes do not match the stored ones, i.e. - the client is not authorized. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/org.gridsite.core/doc/findproxyfile.1 b/org.gridsite.core/doc/findproxyfile.1 deleted file mode 100644 index 9de4d47..0000000 --- a/org.gridsite.core/doc/findproxyfile.1 +++ /dev/null @@ -1,63 +0,0 @@ -.TH findproxyfile 1 "October 2004" "findproxyfile" "GridSite Manual" -.SH NAME -.B findproxyfile -\- returns full path to GSI Proxy file -.SH SYNOPSIS -.B findproxyfile -[--proxycache=PATH] [--delegation-id=ID] [--user-dn=DN] [--outsidecache] -.SH DESCRIPTION -.B findproxyfile -returns full path to a GSI Proxy file, either in the proxy cache maintained -by the GridSite G-HTTPS and delegation portType functions, or in other -standard places. - -If a User DN is given -.B findproxyfile -uses the value of the -.B --proxycache -argument, the GRST_PROXY_PATH or the -compile time default to detemine the location of the proxy cache directory. -The directory is searched for a proxy having the given User DN and -Delegation ID. (If no Delegation ID is specificed, then the default value is -used.) - -If -.B findproxyfile -does not find a proxy or if a User DN is not given, but -.B --outsidecache -was given, then the environment variable X509_USER_PROXY and the standard -location /tmp/x509up_uUID are searched as well. - -.SH OPTIONS - -.IP "--proxycache=PATH" -Give the path of the proxy cache directory explicitly, overriding the -default and the GRST_PROXY_PATH environment variable if present. - -.IP "--delegation-id=ID" -The optional delegation ID is search for in the proxy cache in addition to -the User DN. If absent, the default Delegation ID value is searched for. - -.IP "--user-dn=DN" -The DN of the full user certificate associated with the proxy to be searched -for in the proxy cache. (This is not the DN of any proxy earlier in the -chain: it is a the DN of a certificate issued by a recognised CA.) - -.IP "--outsidecache" -If a User DN is not given, or a proxy not found in the cache, then search -for a proxy using X509_USER_PROXY environment variable and file name of -form /tmp/x509up_uUID as well. - -.SH RETURN VALUE -If a proxy is found, its full path is output on standard out. - -.SH EXIT CODES -0 is returned on succcess. Non-zero otherwise. - -.SH BUGS -In this version, no attempt is made to verify or validate the proxies. - -.SH AUTHOR -Andrew McNab - -findproxyfile is part of GridSite: http://www.gridsite.org/ diff --git a/org.gridsite.core/doc/fuse.spec b/org.gridsite.core/doc/fuse.spec deleted file mode 100644 index ac785a2..0000000 --- a/org.gridsite.core/doc/fuse.spec +++ /dev/null @@ -1,139 +0,0 @@ -# -# You should be able to build your own FUSE RPMs for use with SlashGrid -# by fetching an up-to-date stable FUSE tar file from SourceForge, -# putting it in /usr/src/redhat/SOURCES, updating the Version: header in -# this file, and then executing rpmbuild -ba fuse.spec -# -Name: fuse -Version: 2.5.3 -URL: http://fuse.sourceforge.net -Source: %{name}-%{version}.tar.gz -Release: 3%(sed 's/^\([A-Z]\)[^ ]* \([A-Z]\)[^0-9]*\([0-9][^ ]*\).*/\1\2\3/g' /etc/redhat-release | sed 's/[^A-Z,a-z,0-9]//g')_%(uname -r | sed 's/-/_/g') -Summary: File System in Userspace (FUSE) utilities -Group: System Environment/Base -License: GPL -Packager: Andrew McNab -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -%description -With FUSE it is possible to implement a fully functional filesystem in a -userspace program. This package contains the FUSE userspace tools to -mount a FUSE filesystem. - -(This version is designed for use with the SlashGrid daemon: - http://www.gridsite.org/slashgrid/ ) - -%package libs -Summary: File System in Userspace (FUSE) libraries -Group: System Environment/Libraries -License: LGPL - -%description libs -Devel With FUSE it is possible to implement a fully functional filesystem in a -userspace program. This package contains the FUSE libraries. - -%package devel -Summary: File System in Userspace (FUSE) devel files -Group: Development/Libraries -Requires: %{name}-libs = %{version}-%{release} -Requires: pkgconfig -License: LGPL - -%description devel -With FUSE it is possible to implement a fully functional filesystem in a -userspace program. This package contains development files (headers, -pgk-config) to develop FUSE based applications/filesystems. - -%prep -%setup -q -#disable device creation during build/install -sed -i 's|mknod|echo Disabled: mknod |g' util/Makefile.in -sed -i 's|install-data-local | |g' util/Makefile.in -sed -i 's| install-data-local| |g' util/Makefile.in - -%build -%configure --disable-static -make %{?_smp_mflags} - -%install -rm -rf $RPM_BUILD_ROOT -make install DESTDIR=$RPM_BUILD_ROOT -find $RPM_BUILD_ROOT -type f -name "*.la" -exec rm -f {} ';' - -# change from 4755 to 0755 to allow stripping (setuid not needed by SlashGrid) -chmod 0755 $RPM_BUILD_ROOT/%{_bindir}/fusermount - -%clean -rm -rf $RPM_BUILD_ROOT - -%post -mknod --mode=0660 /dev/fuse c 10 229 -chown root.root /dev/fuse -depmod - -%postun - -%post libs -p /sbin/ldconfig - -%postun libs -p /sbin/ldconfig - -%files -%doc AUTHORS ChangeLog COPYING FAQ Filesystems NEWS README README.NFS -/sbin/mount.fuse -%attr(0755,root,root) %{_bindir}/fusermount -/lib/modules/%(uname -r)/kernel/fs/fuse/fuse.*o - -%files libs -%doc COPYING.LIB -%{_libdir}/libfuse.so.* - -%files devel -%defattr(-,root,root,-) -%{_libdir}/libfuse.so -%{_libdir}/pkgconfig/*.pc -%{_includedir}/fuse.h -%{_includedir}/fuse - -%changelog - -* Sun May 28 2006 Andrew McNab 2.5.3-3 -- Simplify for use with SlashGrid daemon (which only runs as root) on - Scientific Linux 3.*/4.* too - -* Wed May 03 2006 Peter Lemenkov 2.5.3-1%{?dist} -- Update to 2.5.3 - -* Thu Mar 30 2006 Peter Lemenkov 2.5.2-4%{?dist} -- rebuild - -* Mon Feb 13 2006 Peter Lemenkov - 2.5.2-3 -- Proper udev rule - -* Mon Feb 13 2006 Peter Lemenkov - 2.5.2-2 -- Added missing requires - -* Tue Feb 07 2006 Peter Lemenkov - 2.5.2-1 -- Update to 2.5.2 -- Dropped fuse-mount.fuse.patch - -* Wed Nov 23 2005 Thorsten Leemhuis - 2.4.2-1 -- Use dist - -* Wed Nov 23 2005 Thorsten Leemhuis - 2.4.2-1 -- Update to 2.4.2 (solves CVE-2005-3531) -- Update README.fedora - -* Sat Nov 12 2005 Thorsten Leemhuis - 2.4.1-3 -- Add README.fedora -- Add hint to README.fedora and that you have to be member of the group "fuse" - in the description -- Use groupadd instead of fedora-groupadd - -* Fri Nov 04 2005 Thorsten Leemhuis - 2.4.1-2 -- Rename packages a bit -- use makedev.d/40-fuse.nodes -- fix /sbin/mount.fuse -- Use a fuse group to restict access to fuse-filesystems - -* Fri Oct 28 2005 Thorsten Leemhuis - 2.4.1-1 -- Initial RPM release. diff --git a/org.gridsite.core/doc/gridsite-delegation.8 b/org.gridsite.core/doc/gridsite-delegation.8 deleted file mode 100644 index 41ce1e3..0000000 --- a/org.gridsite.core/doc/gridsite-delegation.8 +++ /dev/null @@ -1,19 +0,0 @@ -.TH gridsite-delegation 8 "March 2006" "gridsite-delegation" "GridSite Manual" -.SH NAME -.B gridsite-delegation.cgi -\- CGI implementation of GridSite/gLite GSI delegation Web Service -.SH SYNOPSIS -.B gridsite-delegation.cgi - -.SH DESCRIPTION -.B gridsite-delegation.cgi -is a server-side implementation of the GridSite/gLite GSI delegation Web -Service - -.SH AUTHOR -Andrew McNab - -gridsite-delegation.cgi is part of GridSite: http://www.gridsite.org/ - -.SH "SEE ALSO" -.BR htproxyput(1) diff --git a/org.gridsite.core/doc/gsexec.8 b/org.gridsite.core/doc/gsexec.8 deleted file mode 100644 index e229663..0000000 --- a/org.gridsite.core/doc/gsexec.8 +++ /dev/null @@ -1,134 +0,0 @@ -.TH GSEXEC 8 "October 2005" "gsexec" "GridSite Manual" -.SH NAME -.B gsexec -\- Switch user before executing external programs - -.SH "SYNOPSIS" - -.BR gsexec -[-V] - -.SH "SUMMARY" - -gsexec is used by the Apache HTTP Server to switch to another user before -executing CGI programs\&. In order to achieve this, it must run as root\&. -Since the HTTP daemon normally doesn't run as root, the gsexec executable -needs the setuid bit set and must be owned by root\&. It should never be -writable for any other person than root\&. - -gsexec is based on Apache's suexec, and its behaviour is controlled with -the Apache configuration file directives -.BR GridSiteExecMethod -and -.BR GridSiteUserGroup -added to Apache by -.BR mod_gridsite(8) -Four execution methods are supported: nosetuid, suexec, X509DN and directory, -and these may be set on a per-directory basis within the Apache configuration -file. - -.SH "NOSETUID METHOD" - -This is the default behaviour, but can also be produced by giving -.BR "GridSiteExecMethod nosetuid" - -CGI programs will then be executed without using gsexec, and will -run as the Unix user given by the User and Group Apache directives (normally -apache.apache on Red Hat derived systems.) - -.SH "SUEXEC METHOD" - -If -.BR "GridSiteExecMethod suexec" -is given for this virtual host or directory, then CGI programs will be -executed using the user and group given by the -.BR "GridSiteUserGroup user group" -directive, which may also be set on a per-directory basis (unlike suexec's -.BR SuexecUserGroup -which is per-server only.) The CGI program must either be owned by root, -the Apache user -and group specified at gsexec build-time (normally apache.apache) or by -the user and group given with the -.BR GridSiteUserGroup -directive. - -.SH "X509DN METHOD" - -If -.BR "GridSiteExecMethod X509DN" -is given, then the CGI program runs as a pool user, detemined using lock -files in the exec mapping directory chosen as build time of gsexec. -The pool user is chosen according -to the client's full certificate X.509 DN (ie with any trailing GSI proxy -name components stripped off.) Subsequent requests by the same X.509 -identity will be mapped to the same pool user. The CGI program must either be -owned by root, the Apache user -and group specified at gsexec build-time (normally apache.apache) or by -the pool user selected. - -.SH "DIRECTORY METHOD" - -If -.BR "GridSiteExecMethod directory" -is given, then the CGI program runs as a pool user chosen according -to the directory in which the CGI is located: all CGIs in that directory -run as the same pool user. The CGI program must either be -owned by root, the Apache user -and group specified at gsexec build-time (normally apache.apache) or by -the pool user selected. - - -.SH "EXECMAPDIR" - -The default exec mapping directory is /var/www/execmapdir and this is fixed -when the gsexec executable is built. The exec mapping directory and all -of its lock files must be owned and only writable by root. To initialise the -lock files, create an empty lock file for each pool user, with the pool -username as the filename (eg user0001, user0002, ...) As the pool users are -leased to X.509 identities or directories, they will become hard linked to -lock files with the URL-encoded X.509 DN or full directory path. - -You can recycle pool users by removing the corresponding URL-encoded -hard link. -.BR stat(1) -and -.BR "ls(1)" -with option -.BR "-i" -can be used to print the inodes of lock files to match up the hard links. - -.BR "However, you must ensure that all files and processes owned by the pool" -.BR "user are deleted before recycling!" - -.SH "OPTIONS" - -.TP --V -If you are root, this option displays the compile options of gsexec\&. -For security reasons all configuration options are changeable only at -compile time\&. - -.SH "MORE INFORMATION" -For further information about the concepts and the security model of -the original Apache suexec -please refer to the suexec documentation: - -http://httpd\&.apache\&.org/docs-2\&.0/suexec\&.html - -For examples using the gsexec extensions, please see the GridSite gsexec -page: - -http://www.gridsite.org/wiki/Gsexec - -.SH AUTHORS - -Apache project, for original suexec - -Andrew McNab for gsexec modifications. - -gsexec is part of GridSite: http://www.gridsite.org/ - -.SH "SEE ALSO" -.BR httpd(8), -.BR suexec(8), -.BR mod_gridsite(8) diff --git a/org.gridsite.core/doc/gsoap-devel.spec b/org.gridsite.core/doc/gsoap-devel.spec deleted file mode 100644 index 1eb61f0..0000000 --- a/org.gridsite.core/doc/gsoap-devel.spec +++ /dev/null @@ -1,52 +0,0 @@ -# -# You can use this spec file and the gSOAP source tar file from sourceforge -# to build a binary development RPM of gSOAP, suitable for building the -# gridsite-ws components. Installing the resulting RPM puts the gSOAP files -# directory in /usr, where the gridsite-ws Makefile expects them by default. -# -# See http://www.gridsite.org/wiki/GSOAP for more about GridSite and gSOAP -# -Name: gsoap-devel -Version: %(echo ${MYVERSION:-2.7.6b}) -Release: 1%(sed 's/^\([A-Z]\)[^ ]* \([A-Z]\)[^0-9]*\([0-9][^ ]*\).*/\1\2\3/g' /etc/redhat-release | sed 's/[^A-Z,a-z,0-9]//g') -Summary: gSOAP development compilers/libraries/headers -License: Modified BSD -Group: Development/Libraries -Source: gsoap_%{version}.tar.gz -Prefix: %(echo ${MYPREFIX:-/usr}) -URL: http://www.cs.fsu.edu/~engelen/soap.html -Packager: Andrew McNab - -%description -Enough of gSOAP to build clients and servers based on gSOAP, using its headers -and static libraries. -By default, everything is installed in /usr/lib|bin|include/ - -%prep - -%setup -n gsoap-2.7 - -%build - -./configure --prefix=$RPM_BUILD_ROOT/%{prefix} -make - -%install -make install - -%files -%attr(-, root, root) %{prefix}/bin/soapcpp2 -%attr(-, root, root) %{prefix}/bin/wsdl2h -%attr(-, root, root) %{prefix}/include/stdsoap2.h -%attr(-, root, root) %{prefix}/lib/libgsoap++.a -%attr(-, root, root) %{prefix}/lib/libgsoap.a -%attr(-, root, root) %{prefix}/lib/libgsoapck++.a -%attr(-, root, root) %{prefix}/lib/libgsoapck.a -%attr(-, root, root) %{prefix}/lib/libgsoapssl++.a -%attr(-, root, root) %{prefix}/lib/libgsoapssl.a -%attr(-, root, root) %{prefix}/lib/pkgconfig/gsoap++.pc -%attr(-, root, root) %{prefix}/lib/pkgconfig/gsoap.pc -%attr(-, root, root) %{prefix}/lib/pkgconfig/gsoapck++.pc -%attr(-, root, root) %{prefix}/lib/pkgconfig/gsoapck.pc -%attr(-, root, root) %{prefix}/lib/pkgconfig/gsoapssl++.pc -%attr(-, root, root) %{prefix}/lib/pkgconfig/gsoapssl.pc diff --git a/org.gridsite.core/doc/htcp.1 b/org.gridsite.core/doc/htcp.1 deleted file mode 100644 index 0731d33..0000000 --- a/org.gridsite.core/doc/htcp.1 +++ /dev/null @@ -1,200 +0,0 @@ -.TH HTCP 1 "October 2005" "htcp" "GridSite Manual" -.SH NAME -.B htcp, htmv, htrm, htls, htll, htmkdir, htfind, htping -\- file transfers and queries via HTTP/HTTPS/SiteCast -.SH SYNOPSIS -.B htcp, htmv -[options] Source-URL[s] Destination-URL - -.B htrm, htls, htll, htmkir, htfind -[options] Target-URL[s] - -.B htping -[options] -.SH DESCRIPTION -.B htcp -is a client to fetch files or directory listings from remote servers using -HTTP or HTTPS, or to put or delete files or directories onto remote servers -using HTTPS. htcp is similar to scp(1), but uses HTTP/HTTPS rather than ssh -as its transfer protocol. htcp can also use the HTCP protocol to query -HTTP(S) fileservers via SiteCast. - -When talking to a fileserver with HTTPS, htcp can run "anonymously", with a -standard X.509 user certificate and key, or with a GSI Proxy. This makes -htcp very useful in Grid environments where many users have certificates -and where jobs and users have access to GSI proxies. - -.SH URLs -htcp supports the file:, http: and https: URL schemes as sources and -destinations. If no scheme is given, the URL scheme is assumed to be file: -and relative to the current directory if not an absolute path. - -If multiple sources are given during a copy, they will be used in turn and -the destination must be a directory (directories are indicated by a trailing -/) However, source and destination cannot both refer to remote servers. - -.SH OPTIONS -.IP "-v/--verbose" -Turn on debugging information. Used once, this option will enable htcp's -messages to stderr. Used twice, will also enable the underlying libcurl -messages. - -.IP "--delete" -Instead of copying files, delete all the URLs given on the command line. -Calling the program as htrm has the same effect. - -.IP "--list" -Instead of copying files, output lists of files located in the URL-directories -given on the command line. Calling the program as htls has the same effect. - -.IP "--long-list" -Instead of copying files, output long listings of files located in the -URL-directories given on the command line. If available, the size in bytes -and modification time of each file is given. Calling the program as -htll has the same effect. - -.IP "--mkdir" -Instead of copying files, attempt to create a directory on a remote server -with HTTP PUT. The server must support the convention that PUT to a URL with -a trailing slash means create a directory. No file body is sent. Calling the -program as htmkdir has the same effect. - -.IP "--move" -Move/rename files on a single remote server, given the two, absolute URLs -of the remote file names. Server must support HTTP/WebDAV MOVE. Calling the -program as htmv has the same effect. - -.IP "--ping" -Query specified multicast groups with the HTCP NOP ("No Operation") code. -SiteCast enabled servers will respond immediately with a NOP reply, and all -of the responses will be listed, with the round trip time in milliseconds. -Any waiting times specified in the --groups option will be ignored. Calling -the program as htping has the same effect. -(--groups must be used for this option to work.) - -.IP "--find" -Query specified multicast groups with the HTCP TST code. SiteCast enabled -servers will respond with TST replies if they have the files corresponding -to the given SiteCast target URL(s). All of the transfer URLs returned -will be listed. Waiting times specified in the --groups option will be used -to space out the multicast queries, but the program listens for responses -continuously. Calling the program as htfind has the same effect. -(--groups must be used for this option to work.) - -.IP "--groups " -IP multicast groups to use for SiteCast queries. IP Groups is a comma -separated list of groups, in the format: nnn.nnn.nnn.nnn:port[:ttl[:seconds]] -The IP number and port must be specified. The IP time-to-live, ttl, controls -how many networks the multicast packets may pass through - the default, 1, -limits packets to the local network. Multiple groups may be specified, -separated by commas. If multiple groups are specified, then seconds is the -time to wait before making the next multicast - 1 second is the default. - -.IP "--timeout " -A request timeout used for multicast ping. - -.IP "--anon" -Do not attempt to use X.509 user certificates or GSI proxies to authenticate -to the remote HTTPS server. This means you are "anonymous", but the server's -identity may still be verified and the connection is still encrypted. - -.IP "--cert and --key " -Path to the PEM-encoded -X.509 or GSI Proxy user certificate and key to use for HTTPS -connections, intead of "anonymous mode." If only one of --key or --cert -is given, then that will be tried for both. If neither is given, then the -following order of precedence is used: -the file name held by the variable X509_USER_PROXY; the file -/tmp/x509up_uID (with Unix UID equal to ID); the file names held by -X509_USER_CERT / X509_USER_KEY; the files ~/.globus/usercert.pem and -~/.globus/userkey.pem (where ~/ is the home directory of the user.) - -.IP "--capath " -Path to the PEM-encoded CA root certificates to use when -verifying remote servers' host certificates in HTTPS connections. Ideally -this should be a directory of hash.0 files as described in the OpenSSL -verify(1) man page, but a file may be used instead. If --capath is not -given, the value of the environment variable X509_CERT_DIR will be tried. -If this is not valid, then /etc/grid-security/certificates will be used. - -.IP "--no-verify" -Do not use CA root certificates to verify remote servers' host certificates. -This is useful for testing sites before their certificate is set up properly, -but leaves you vulnerable to "man in the middle" attacks by hostile servers -masquerading as your target. - -.IP "--grid-http" -Try to use GridHTTP redirection for HTTPS URLs. Compatible servers will perform -authentication and authorization on the HTTPS connection and then redirect -to HTTP for the GET or PUT file transfer. htcp makes the HTTP request using -the GRID_AUTH_PASSCODE single-use passcode obtained via HTTPS. The --grid-http -option will be ignored for directory operations or HTTP URLs. If a redirected -transfer isn't possible, a normal HTTPS data transfer will be attempted. - -.IP "--sitecast" -Try to use SiteCast to locate remote files which are to be copied (currently -only for the -.BR fetching -of remote files.) If no location is found via SiteCast, then a direct request -for the given URL is tried. (--groups must be used for this option to work.) - -.IP "--domain " -Try to use SiteCast to locate remote files which are to be copied (currently -only for the -.BR fetching -of remote files) -.BR "if the domain component of the URL matches" -the SiteCast domain given. -If no location is found via SiteCast, then a direct request -for the given URL is tried. (--groups must be used for this option to work.) - -.SH FILES -.IP /tmp/x509up_uID -Default GSI Proxy file for Unix UID equal to ID. - -.IP /etc/grid-security/certificates -Default location for trusted Certification Authority root certificates to use -when checking server certificates. - -.IP /tmp/.ca-roots-XXXXXX -Prior to 7.9.8, the underlying curl library did not support the CA root -certificates directory. -If built with an old version of libcurl, htcp will concatenate the -certificates in the CA roots directory into a unique temporary file and use -that. - -.SH ENVIRONMENT - -.IP X509_CERT_DIR -Holds directory to search for Certification Authority root certificates when -verifying server certificates. (Tried if --capath is not given on the -command line.) - -.IP X509_USER_PROXY -Holds file name of a GSI Proxy to use as user certificate. (Tried if --cert or ---key are not given on the command line.) - -.IP "X509_USER_CERT and X509_USER_KEY" -Holds file name of X.509 user certificate and key. (Tried if X509_USER_PROXY -is not valid.) - -.SH EXIT CODES -0 is returned on complete success. Curl error codes are returned when -reported by the underlying curl library, and CURLE_HTTP_RETURNED_ERROR (22) -is returned when the HTTP(S) server returns a code outside the range 200-299. -The manpage libcurl-errors(3) lists all the curl error codes. - -.SH TO DO -Recursive copying. Server-side wildcards. Parallel streams. Better error -recovery. - -.SH AUTHOR -Andrew McNab - -htcp is part of GridSite: http://www.gridsite.org/ -.SH "SEE ALSO" -.BR scp(1), -.BR curl(1), -.BR wget(1), -.BR verify(1), -.BR libcurl-errors(3) diff --git a/org.gridsite.core/doc/htfind.1 b/org.gridsite.core/doc/htfind.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htfind.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/htll.1 b/org.gridsite.core/doc/htll.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htll.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/htls.1 b/org.gridsite.core/doc/htls.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htls.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/htmkdir.1 b/org.gridsite.core/doc/htmkdir.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htmkdir.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/htmv.1 b/org.gridsite.core/doc/htmv.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htmv.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/htping.1 b/org.gridsite.core/doc/htping.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htping.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/htproxydestroy.1 b/org.gridsite.core/doc/htproxydestroy.1 deleted file mode 100644 index 57f80ce..0000000 --- a/org.gridsite.core/doc/htproxydestroy.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htproxyput.1 diff --git a/org.gridsite.core/doc/htproxyinfo.1 b/org.gridsite.core/doc/htproxyinfo.1 deleted file mode 100644 index 57f80ce..0000000 --- a/org.gridsite.core/doc/htproxyinfo.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htproxyput.1 diff --git a/org.gridsite.core/doc/htproxyput.1 b/org.gridsite.core/doc/htproxyput.1 deleted file mode 100644 index a917054..0000000 --- a/org.gridsite.core/doc/htproxyput.1 +++ /dev/null @@ -1,121 +0,0 @@ -.TH HTPROXYPUT 1 "March 2006" "htproxyput" "GridSite Manual" -.SH NAME -.B htproxyput, htproxydestroy, htproxytime, htproxyunixtime, htproxyrenew -\- GSI proxy delegations and querying, using GridSite/gLite delegation API -.SH SYNOPSIS -.B htproxyput, htproxydestroy, htproxytime, htproxyunixtime, htproxyrenew -[options] Service-URL - -.B htproxyinfo -[options] - -.SH DESCRIPTION -.B htproxyput -is a client to perform GSI proxy delegations using the GridSite/gLite -delegation Web Service portType. The gridsite-delegation(8) CGI program is -the complementary server-side implementation. - -.B htproxyinfo -examines a local copy of a GSI proxy, and outputs a summary of its X.509 and -VOMS contents. - -.SH OPTIONS -.IP "-v/--verbose" -Turn on debugging information. - -.IP "--delegation-id " -Explicitly specify the Delegation ID to use. - -.IP "--destroy" -Instead of delegating a proxy, delete the proxy from the service's proxy -cache. Calling the program as htproxydestroy has the same effect. - -.IP "--time" -Instead of delegating a proxy, report the expiration time of the proxy, -in the local time of the client. Calling the program as htproxytime has the -same effect. - -.IP "--unixtime" -Instead of delegating a proxy, report the expiration time of the proxy, as -the number of seconds since 00:00:00 1970-01-01 UTC. Calling the program as -htproxyunixtime has the same effect. - -.IP "--renew" -Delegate an updated version of an existing proxy. The Delegation ID -.B must -be given when using this option. Calling the program as htproxyrenew has the -same effect. - -.IP "--info" -Examine a local proxy file, and output a summary of the X.509 certificates -and VOMS attributes it contains. Calling the program as htproxyinfo has the -same effect. - -.IP "--cert and --key " -Path to the PEM-encoded -X.509 or GSI Proxy user certificate and key to use for HTTPS -connections, intead of "anonymous mode." If only one of --key or --cert -is given, then that will be tried for both. If neither is given, then the -following order of precedence is used: -the file name held by the variable X509_USER_PROXY; the file -/tmp/x509up_uID (with Unix UID equal to ID); the file names held by -X509_USER_CERT / X509_USER_KEY; the files ~/.globus/usercert.pem and -~/.globus/userkey.pem (where ~/ is the home directory of the user.) - -.IP "--capath " -Path to the PEM-encoded CA root certificates to use when -verifying remote servers' host certificates in HTTPS connections. Ideally -this should be a directory of hash.0 files as described in the OpenSSL -verify(1) man page, but a file may be used instead. If --capath is not -given, the value of the environment variable X509_CERT_DIR will be tried. -If this is not valid, then /etc/grid-security/certificates will be used. - -.IP "--no-verify" -Do not use CA root certificates to verify remote servers' host certificates. -This is useful for testing sites before their certificate is set up properly, -but leaves you vulnerable to "man in the middle" attacks by hostile servers -masquerading as your target. - -.SH FILES -.IP /tmp/x509up_uID -Default GSI Proxy file for Unix UID equal to ID. - -.IP /etc/grid-security/certificates -Default location for trusted Certification Authority root certificates to use -when checking server certificates. - -.IP /tmp/.ca-roots-XXXXXX -Prior to 7.9.8, the underlying curl library did not support the CA root -certificates directory. -If built with an old version of libcurl, htproxyput will concatenate the -certificates in the CA roots directory into a unique temporary file and use -that. - -.SH ENVIRONMENT - -.IP X509_CERT_DIR -Holds directory to search for Certification Authority root certificates when -verifying server certificates. (Tried if --capath is not given on the -command line.) - -.IP X509_USER_PROXY -Holds file name of a GSI Proxy to use as user certificate. (Tried if --cert or ---key are not given on the command line.) - -.IP "X509_USER_CERT and X509_USER_KEY" -Holds file name of X.509 user certificate and key. (Tried if X509_USER_PROXY -is not valid.) - -.SH EXIT CODES -0 is returned on complete success, and non-zero on error. - -.SH TO DO -Better error recovery. - -.SH AUTHOR -Andrew McNab - -htproxyput is part of GridSite: http://www.gridsite.org/ -.SH "SEE ALSO" -.BR htcp(1), -.BR gridsite-delegation(8) diff --git a/org.gridsite.core/doc/htproxyrenew.1 b/org.gridsite.core/doc/htproxyrenew.1 deleted file mode 100644 index 57f80ce..0000000 --- a/org.gridsite.core/doc/htproxyrenew.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htproxyput.1 diff --git a/org.gridsite.core/doc/htproxytime.1 b/org.gridsite.core/doc/htproxytime.1 deleted file mode 100644 index 57f80ce..0000000 --- a/org.gridsite.core/doc/htproxytime.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htproxyput.1 diff --git a/org.gridsite.core/doc/htproxyunixtime.1 b/org.gridsite.core/doc/htproxyunixtime.1 deleted file mode 100644 index 57f80ce..0000000 --- a/org.gridsite.core/doc/htproxyunixtime.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htproxyput.1 diff --git a/org.gridsite.core/doc/htrm.1 b/org.gridsite.core/doc/htrm.1 deleted file mode 100644 index 11a60d1..0000000 --- a/org.gridsite.core/doc/htrm.1 +++ /dev/null @@ -1 +0,0 @@ -.so man1/htcp.1 diff --git a/org.gridsite.core/doc/httpd-fileserver.conf b/org.gridsite.core/doc/httpd-fileserver.conf deleted file mode 100644 index 5d701fb..0000000 --- a/org.gridsite.core/doc/httpd-fileserver.conf +++ /dev/null @@ -1,155 +0,0 @@ -############################################################################## -## GridSite httpd-fileserver.conf - Andrew McNab -## -## For GridSite documentation, see http://www.gridsite.org/ -## -## Example configuration file for GridSite as an HTTP(S) fileserver, -## listening on ports 80/777 (HTTP) and 443/488 (HTTPS) -## -## (777/488 is to allow firewalls to distinguish between Grid and -## Web HTTP(S) traffic. See http://www.gridsite.org/wiki/IP_Ports ) -## -## This file should be renamed /etc/httpd/conf/httpd.conf and Apache -## restarted to use Apache2/GridSite as a simple HTTP(S) fileserver. -## -## We assume that you have mod_gridsite.so in /usr/lib/httpd/modules -## and that you have (a) the host's hostcert.pem and hostkey.pem -## in /etc/grid-security/ and (b) the Certification Authorities' you -## trust have their root certs in /etc/grid-security/certificates -## -## (You can get RPMs for many European and North American Grid CAs -## from http://www.igtf.net/ ) -## -## If you want to use DN Lists in ACLs, they should be placed/downloaded -## in /etc/grid-security/dn-lists/ -## -## To start serving files, make a directory /var/www/html owned by -## apache.apache, including the file .gacl containing: -## -## -## -## -## -## -## -## -## -## To enable writing, add DN List, Person or VOMS entries to the GACL -## (see the GridSite GACL document for the syntax.) For example: -## -## -## -## -## -## -## -## -## -## /C=UK/O=eScience/OU=Manchester/L=HEP/CN=Andrew McNab -## -## -## -## -## -## and add the following directive to the HTTPS section: -## -## GridSiteMethods GET PUT DELETE MOVE -## -## If you wish to accept Globus GSI Proxies as well as full X.509 user -## certificates, set GridSiteGSIProxyLimit to the depth of proxy you -## wish to accept. -## -## (As a _rough_ guide: 0=No Proxies; 1=Proxy on user's machine; 2=Proxy -## owned by running Globus job; 3=Proxy delegated by a Globus job.) -## -## With this done and Apache restarted, you can upload a file with: -## -## curl -v --cert ~/.globus/usercert.pem --key ~/.globus/userkey.pem \ -## --capath /etc/grid-security/certificates --upload-file /tmp/tmp.txt \ -## https://INSERT.HOSTNAME.HERE/tmp.txt -## -## (or with --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` to use -## a Globus GSI Proxy created with grid-proxy-init.) -## -############################################################################## - -ServerRoot "/etc/httpd" - -PidFile logs/httpd.pid - -Timeout 300 -KeepAlive On -MaxKeepAliveRequests 100 -KeepAliveTimeout 300 - -# (Replace /lib/ with /lib64/ if on x86_64!) -LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so -LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so -LoadModule gridsite_module /usr/lib/httpd/modules/mod_gridsite.so -LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so -LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so - -TypesConfig /etc/mime.types - -# User and group who will own files created by Apache -User apache -Group apache - -DocumentRoot "/var/www/html" - - - AllowOverride None - - -LogLevel debug -LogFormat "%h \"%{SSL_CLIENT_S_DN}x\" %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - -CustomLog logs/httpd-gridsite-access combined -ErrorLog logs/httpd-gridsite-errors - -HostnameLookups On - -###################################################################### -# Plain unauthenticated HTTP on ports 80 and 777 -###################################################################### - -Listen 80 -Listen 777 - - - - GridSiteIndexes on - GridSiteAuth on - GridSiteDNlists /etc/grid-security/dn-lists/ - - - - -###################################################################### -# Secured and possibly authenticated HTTPS on ports 443 and 488 -###################################################################### -Listen 443 -Listen 488 -SSLSessionCacheTimeout 300 -SSLSessionCache shm:/var/cache/mod_ssl/shm_cache - - - -SSLEngine on -SSLCertificateFile /etc/grid-security/hostcert.pem -SSLCertificateKeyFile /etc/grid-security/hostkey.pem -SSLCACertificatePath /etc/grid-security/certificates -#SSLCARevocationPath YOUR CRL DIRECTORY WOULD GO HERE -SSLVerifyClient optional -SSLVerifyDepth 10 -SSLOptions +ExportCertData +StdEnvVars - - - GridSiteIndexes on - GridSiteAuth on - GridSiteDNlists /etc/grid-security/dn-lists/ - GridSiteGSIProxyLimit 9 - GridSiteMethods GET PUT DELETE MOVE - - - diff --git a/org.gridsite.core/doc/httpd-storage.conf b/org.gridsite.core/doc/httpd-storage.conf deleted file mode 100644 index eeba72f..0000000 --- a/org.gridsite.core/doc/httpd-storage.conf +++ /dev/null @@ -1,220 +0,0 @@ - -############################################################################## -## GridSite httpd-storage.conf - Andrew McNab -## -## For GridSite documentation, see http://www.gridsite.org/ -## -## Example configuration file for GridSite as an HTTP(S) storage server, -## listening on ports 80/777 (HTTP) and 443/488 (HTTPS), and -## multicast UDP 224.0.1.111:488 for SiteCast file location. -## -## (777/488 is to allow firewalls to distinguish between Grid and -## Web HTTP(S) traffic. See http://www.gridsite.org/wiki/IP_Ports ) -## -## This file should be renamed /etc/httpd/conf/httpd.conf and Apache -## restarted to use Apache2/GridSite as a simple HTTP(S) fileserver. -## -## We assume that you have mod_gridsite.so in /usr/lib/httpd/modules -## and that you have (a) the host's hostcert.pem and hostkey.pem -## in /etc/grid-security/ and (b) the Certification Authorities' you -## trust have their root certs in /etc/grid-security/certificates -## -## (You can get RPMs for many European and North American Grid CAs -## from http://www.igtf.net/ ) -## -## If you want to use DN Lists in ACLs, they should be placed/downloaded -## in /etc/grid-security/dn-lists/ -## -## To start serving files, make a directory /var/www/html owned by -## apache.apache, including the file .gacl containing: -## -## -## -## -## -## -## -## -## -## To enable writing, add DN List, Person or VOMS entries to the GACL -## (see the GridSite GACL document for the syntax.) For example: -## -## -## -## -## -## -## -## -## -## /C=UK/O=eScience/OU=Manchester/L=HEP/CN=Andrew McNab -## -## -## -## -## -## and add the following directive to the HTTPS section: -## -## GridSiteMethods GET PUT DELETE MOVE -## -## If you wish to accept Globus GSI Proxies as well as full X.509 user -## certificates, set GridSiteGSIProxyLimit to the depth of proxy you -## wish to accept. -## -## (As a _rough_ guide: 0=No Proxies; 1=Proxy on user's machine; 2=Proxy -## owned by running Globus job; 3=Proxy delegated by a Globus job.) -## -## With this done and Apache restarted, you can upload a file with: -## -## curl -v --cert ~/.globus/usercert.pem --key ~/.globus/userkey.pem \ -## --capath /etc/grid-security/certificates --upload-file /tmp/tmp.txt \ -## https://INSERT.HOSTNAME.HERE/tmp.txt -## -## (or with --cert /tmp/x509up_u`id -u` --key /tmp/x509up_u`id -u` to use -## a Globus GSI Proxy created with grid-proxy-init.) -## -############################################################################## - -ServerRoot "/etc/httpd" - -PidFile logs/httpd.pid - -Timeout 300 -KeepAlive On -MaxKeepAliveRequests 100 -KeepAliveTimeout 300 - -# (Replace /lib/ with /lib64/ if on x86_64!) -LoadModule log_config_module /usr/lib/httpd/modules/mod_log_config.so -LoadModule ssl_module /usr/lib/httpd/modules/mod_ssl.so -LoadModule gridsite_module /usr/lib/httpd/modules/mod_gridsite.so -LoadModule mime_module /usr/lib/httpd/modules/mod_mime.so -LoadModule dir_module /usr/lib/httpd/modules/mod_dir.so - -# used for gridsite-storage tests -LoadModule alias_module /usr/lib/httpd/modules/mod_alias.so -LoadModule cgi_module /usr/lib/httpd/modules/mod_cgi.so -LoadModule env_module /usr/lib/httpd/modules/mod_env.so - -LoadModule php4_module modules/libphp4.so -AddType application/x-httpd-php .php - -TypesConfig /etc/mime.types - -# User and group who will own files created by Apache -User apache -Group apache - -DocumentRoot "/var/www/html" -DirectoryIndex index.html - - - AllowOverride None - - -LogLevel debug -LogFormat "%h \"%{SSL_CLIENT_S_DN}x\" %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined - -CustomLog logs/httpd-gridsite-access combined -ErrorLog logs/httpd-gridsite-errors - -HostnameLookups On - -# Enable SiteCast location of files via multicast -GridSiteCastGroup 224.0.1.111:488 - -###################################################################### -# Plain unauthenticated HTTP on ports 80 and 777 -###################################################################### - -Listen 80 -Listen 777 -NameVirtualHost 127.0.0.1:80 - - - -GridSiteGridHTTP on -GridSiteCastAlias http://sitecast.domain:777/ /var/www/html/ - - - GridSiteIndexes on - GridSiteAuth on - GridSiteDNlists /etc/grid-security/dn-lists/ - GridSiteHtmlFormat on - - - - -###################################################################### -# Secured and possibly authenticated HTTPS on ports 443 and 488 -###################################################################### -Listen 443 -Listen 488 -SSLSessionCacheTimeout 300 -SSLSessionCache shm:/var/cache/mod_ssl/shm_cache - - - -ServerName pc63.hep.man.ac.uk - -SSLEngine on -SSLCertificateFile /etc/grid-security/hostcert.pem -SSLCertificateKeyFile /etc/grid-security/hostkey.pem -SSLCACertificatePath /etc/grid-security/certificates -#SSLCARevocationPath YOUR CRL DIRECTORY WOULD GO HERE -SSLVerifyClient optional -SSLVerifyDepth 10 -SSLOptions +ExportCertData +StdEnvVars - -GridSiteGridHTTP on -GridSiteCastAlias https://sitecast.domain:488/ /var/www/html/ - - - SetEnv GRST_FOOTER_BLOB '

    AOl9ARhwCtdIogIZ;F^Ik^6h`oWPt6R;Re8r)4Fn-J!9SicqcE){3aN%JOYdl z)b8vU;7;(k#AERuonf7Nlo}3)kM+f&j=&e22!!5_42=*yRv`-+bikhq485mXjd!65 zg}ltOSUeqWrJ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